Merge commit '5ee4ce1232' into apple-silicon-arm-build

This commit is contained in:
Andrew Dunn 2022-08-17 23:45:51 +10:00
commit 808a2e587a
27 changed files with 73 additions and 34 deletions

View file

@ -652,7 +652,7 @@ Windows_MSBuild_RelWithDebInfo:
script: script:
- scripts/find_missing_merge_requests.py --project_id=$CI_PROJECT_ID --ignored_mrs_path=$CI_PROJECT_DIR/.resubmitted_merge_requests.txt - scripts/find_missing_merge_requests.py --project_id=$CI_PROJECT_ID --ignored_mrs_path=$CI_PROJECT_DIR/.resubmitted_merge_requests.txt
flatpak: .flatpak:
image: 'docker.io/bilelmoussaoui/flatpak-github-actions' image: 'docker.io/bilelmoussaoui/flatpak-github-actions'
stage: build stage: build
script: script:
@ -670,4 +670,4 @@ flatpak:
- "openmw.flatpak" - "openmw.flatpak"
# When CCache doesn't exist (e.g. first build on a fork), build takes more than 1h, which is the default for forks. # When CCache doesn't exist (e.g. first build on a fork), build takes more than 1h, which is the default for forks.
# Flatpak Builds compile all dependencies aswell so need more time. Build results of libraries are cached # Flatpak Builds compile all dependencies aswell so need more time. Build results of libraries are cached
timeout: 4h timeout: 4h

View file

@ -5,6 +5,7 @@
Bug #5057: Weapon swing sound plays at same pitch whether it hits or misses Bug #5057: Weapon swing sound plays at same pitch whether it hits or misses
Bug #5129: Stuttering animation on Centurion Archer Bug #5129: Stuttering animation on Centurion Archer
Bug #5977: Fatigueless NPCs' corpse underwater changes animation on game load Bug #5977: Fatigueless NPCs' corpse underwater changes animation on game load
Feature #6945: Support S3TC-compressed and BGR/BGRA NiPixelData
0.48.0 0.48.0
------ ------

View file

@ -4,6 +4,7 @@
#include "importscri.hpp" #include "importscri.hpp"
#include <components/esm3/loadscpt.hpp> #include <components/esm3/loadscpt.hpp>
#include <components/esm/esmcommon.hpp>
namespace ESM namespace ESM
{ {

View file

@ -48,6 +48,7 @@
#include <components/vfs/manager.hpp> #include <components/vfs/manager.hpp>
#include <components/widgets/tags.hpp> #include <components/widgets/tags.hpp>
#include <components/widgets/widgets.hpp>
#include <components/misc/resourcehelpers.hpp> #include <components/misc/resourcehelpers.hpp>
#include <components/misc/frameratelimiter.hpp> #include <components/misc/frameratelimiter.hpp>

View file

@ -1,5 +1,7 @@
#include "recastmesh.hpp" #include "recastmesh.hpp"
#include <algorithm>
#include <components/sceneutil/recastmesh.hpp> #include <components/sceneutil/recastmesh.hpp>
#include <components/resource/resourcesystem.hpp> #include <components/resource/resourcesystem.hpp>
#include <components/resource/scenemanager.hpp> #include <components/resource/scenemanager.hpp>
@ -12,6 +14,7 @@
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
namespace MWRender namespace MWRender
{ {
RecastMesh::RecastMesh(const osg::ref_ptr<osg::Group>& root, bool enabled) RecastMesh::RecastMesh(const osg::ref_ptr<osg::Group>& root, bool enabled)

View file

@ -3,6 +3,7 @@
#include <LinearMath/btTransform.h> #include <LinearMath/btTransform.h>
#include <BulletCollision/CollisionShapes/btCollisionShape.h> #include <BulletCollision/CollisionShapes/btCollisionShape.h>
#include <BulletCollision/Gimpact/btBoxCollision.h>
inline bool operator==(const btAABB& lhs, const btAABB& rhs) inline bool operator==(const btAABB& lhs, const btAABB& rhs)
{ {

View file

@ -4,7 +4,6 @@
#include "parser.hpp" #include "parser.hpp"
#include "scriptparser.hpp" #include "scriptparser.hpp"
#include "locals.hpp" #include "locals.hpp"
#include "literals.hpp"
namespace Compiler namespace Compiler
{ {

View file

@ -3,7 +3,6 @@
#include "cellref.hpp" #include "cellref.hpp"
#include "components/esm/defs.hpp" #include "components/esm/defs.hpp"
#include "effectlist.hpp"
#include <string> #include <string>
#include <vector> #include <vector>

View file

@ -3,7 +3,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <stdint.h> #include <cstdint>
namespace ESM namespace ESM
{ {

View file

@ -4,7 +4,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "components/esm/esmcommon.hpp"
#include "components/esm/defs.hpp" #include "components/esm/defs.hpp"
namespace ESM namespace ESM

View file

@ -5,7 +5,6 @@
#include <vector> #include <vector>
#include "components/esm/defs.hpp" #include "components/esm/defs.hpp"
#include "components/esm/esmcommon.hpp"
namespace ESM namespace ESM
{ {

View file

@ -5,7 +5,6 @@
#include <vector> #include <vector>
#include "components/esm/defs.hpp" #include "components/esm/defs.hpp"
#include "components/esm/esmcommon.hpp"
namespace ESM namespace ESM
{ {

View file

@ -18,8 +18,6 @@
#include <components/misc/strings/format.hpp> #include <components/misc/strings/format.hpp>
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
#include "pass.hpp"
namespace fx namespace fx
{ {
namespace Types namespace Types

View file

@ -11,7 +11,6 @@
#include <components/misc/strings/format.hpp> #include <components/misc/strings/format.hpp>
#include "technique.hpp"
#include "types.hpp" #include "types.hpp"
namespace Gui namespace Gui

View file

@ -3,6 +3,7 @@
#include <sol/sol.hpp> #include <sol/sol.hpp>
#include <MyGUI_Types.h> #include <MyGUI_Types.h>
#include <MyGUI_Colour.h>
#include <osg/Vec2> #include <osg/Vec2>
#include <components/lua/luastate.hpp> #include <components/lua/luastate.hpp>

View file

@ -1,6 +1,8 @@
#ifndef OPENMW_COMPONENTS_MISC_BUDGETMEASUREMENT_H #ifndef OPENMW_COMPONENTS_MISC_BUDGETMEASUREMENT_H
#define OPENMW_COMPONENTS_MISC_BUDGETMEASUREMENT_H #define OPENMW_COMPONENTS_MISC_BUDGETMEASUREMENT_H
#include <array>
#include <cstddef>
namespace Misc namespace Misc
{ {

View file

@ -24,10 +24,9 @@
#ifndef OPENMW_COMPONENTS_NIF_DATA_HPP #ifndef OPENMW_COMPONENTS_NIF_DATA_HPP
#define OPENMW_COMPONENTS_NIF_DATA_HPP #define OPENMW_COMPONENTS_NIF_DATA_HPP
#include "base.hpp"
#include "nifkey.hpp" #include "nifkey.hpp"
#include "niftypes.hpp" // Transformation #include "niftypes.hpp" // Transformation
#include "recordptr.hpp"
namespace Nif namespace Nif
{ {
@ -115,10 +114,11 @@ struct NiPixelData : public Record
NIPXFMT_RGBA8, NIPXFMT_RGBA8,
NIPXFMT_PAL8, NIPXFMT_PAL8,
NIPXFMT_PALA8, NIPXFMT_PALA8,
NIPXFMT_BGR8,
NIPXFMT_BGRA8,
NIPXFMT_DXT1, NIPXFMT_DXT1,
NIPXFMT_DXT3, NIPXFMT_DXT3,
NIPXFMT_DXT5, NIPXFMT_DXT5
NIPXFMT_DXT5_ALT
}; };
Format fmt{NIPXFMT_RGB8}; Format fmt{NIPXFMT_RGB8};

View file

@ -1,13 +1,24 @@
#ifndef OPENMW_COMPONENTS_NIF_PHYSICS_HPP #ifndef OPENMW_COMPONENTS_NIF_PHYSICS_HPP
#define OPENMW_COMPONENTS_NIF_PHYSICS_HPP #define OPENMW_COMPONENTS_NIF_PHYSICS_HPP
#include "base.hpp" #include "record.hpp"
#include "recordptr.hpp"
#include <osg/Vec3f>
#include <osg/Vec4f>
#include <osg/Quat>
#include <cstdint>
#include <vector>
// This header contains certain record definitions // This header contains certain record definitions
// specific to Bethesda implementation of Havok physics // specific to Bethesda implementation of Havok physics
namespace Nif namespace Nif
{ {
class NIFStream;
class NIFFile;
/// Non-record data types /// Non-record data types
struct bhkWorldObjCInfoProperty struct bhkWorldObjCInfoProperty

View file

@ -1480,17 +1480,39 @@ namespace NifOsg
{ {
osg::ref_ptr<osg::Image> image (new osg::Image); osg::ref_ptr<osg::Image> image (new osg::Image);
// Pixel row alignment, defining it to be consistent with OSG DDS plugin
int packing = 1;
GLenum pixelformat = 0; GLenum pixelformat = 0;
switch (pixelData->fmt) switch (pixelData->fmt)
{ {
case Nif::NiPixelData::NIPXFMT_RGB8: case Nif::NiPixelData::NIPXFMT_RGB8:
case Nif::NiPixelData::NIPXFMT_PAL8:
pixelformat = GL_RGB; pixelformat = GL_RGB;
break; break;
case Nif::NiPixelData::NIPXFMT_RGBA8: case Nif::NiPixelData::NIPXFMT_RGBA8:
case Nif::NiPixelData::NIPXFMT_PALA8:
pixelformat = GL_RGBA; pixelformat = GL_RGBA;
break; break;
case Nif::NiPixelData::NIPXFMT_PAL8:
case Nif::NiPixelData::NIPXFMT_PALA8:
pixelformat = GL_RED; // Each color is defined by a byte.
break;
case Nif::NiPixelData::NIPXFMT_BGR8:
pixelformat = GL_BGR;
break;
case Nif::NiPixelData::NIPXFMT_BGRA8:
pixelformat = GL_BGRA;
break;
case Nif::NiPixelData::NIPXFMT_DXT1:
pixelformat = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
packing = 2;
break;
case Nif::NiPixelData::NIPXFMT_DXT3:
pixelformat = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
packing = 4;
break;
case Nif::NiPixelData::NIPXFMT_DXT5:
pixelformat = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
packing = 4;
break;
default: default:
Log(Debug::Info) << "Unhandled internal pixel format " << pixelData->fmt << " in " << mFilename; Log(Debug::Info) << "Unhandled internal pixel format " << pixelData->fmt << " in " << mFilename;
return nullptr; return nullptr;
@ -1507,7 +1529,7 @@ namespace NifOsg
{ {
const Nif::NiPixelData::Mipmap& mip = pixelData->mipmaps[i]; const Nif::NiPixelData::Mipmap& mip = pixelData->mipmaps[i];
size_t mipSize = mip.height * mip.width * pixelData->bpp / 8; size_t mipSize = osg::Image::computeImageSizeInBytes(mip.width, mip.height, 1, pixelformat, GL_UNSIGNED_BYTE, packing);
if (mipSize + mip.dataOffset > pixelData->data.size()) if (mipSize + mip.dataOffset > pixelData->data.size())
{ {
Log(Debug::Info) << "Internal texture's mipmap data out of bounds, ignoring texture"; Log(Debug::Info) << "Internal texture's mipmap data out of bounds, ignoring texture";
@ -1534,10 +1556,15 @@ namespace NifOsg
{ {
case Nif::NiPixelData::NIPXFMT_RGB8: case Nif::NiPixelData::NIPXFMT_RGB8:
case Nif::NiPixelData::NIPXFMT_RGBA8: case Nif::NiPixelData::NIPXFMT_RGBA8:
case Nif::NiPixelData::NIPXFMT_BGR8:
case Nif::NiPixelData::NIPXFMT_BGRA8:
case Nif::NiPixelData::NIPXFMT_DXT1:
case Nif::NiPixelData::NIPXFMT_DXT3:
case Nif::NiPixelData::NIPXFMT_DXT5:
{ {
unsigned char* data = new unsigned char[pixels.size()]; unsigned char* data = new unsigned char[pixels.size()];
memcpy(data, pixels.data(), pixels.size()); memcpy(data, pixels.data(), pixels.size());
image->setImage(width, height, 1, pixelformat, pixelformat, GL_UNSIGNED_BYTE, data, osg::Image::USE_NEW_DELETE); image->setImage(width, height, 1, pixelformat, pixelformat, GL_UNSIGNED_BYTE, data, osg::Image::USE_NEW_DELETE, packing);
break; break;
} }
case Nif::NiPixelData::NIPXFMT_PAL8: case Nif::NiPixelData::NIPXFMT_PAL8:
@ -1548,6 +1575,7 @@ namespace NifOsg
Log(Debug::Info) << "Palettized texture in " << mFilename << " is invalid, ignoring"; Log(Debug::Info) << "Palettized texture in " << mFilename << " is invalid, ignoring";
return nullptr; return nullptr;
} }
pixelformat = pixelData->fmt == Nif::NiPixelData::NIPXFMT_PAL8 ? GL_RGB : GL_RGBA;
// We're going to convert the indices that pixel data contains // We're going to convert the indices that pixel data contains
// into real colors using the palette. // into real colors using the palette.
const auto& palette = pixelData->palette->colors; const auto& palette = pixelData->palette->colors;
@ -1559,7 +1587,9 @@ namespace NifOsg
memcpy(pixel, &palette[index], sizeof(unsigned char) * numChannels); memcpy(pixel, &palette[index], sizeof(unsigned char) * numChannels);
pixel += numChannels; pixel += numChannels;
} }
image->setImage(width, height, 1, pixelformat, pixelformat, GL_UNSIGNED_BYTE, data, osg::Image::USE_NEW_DELETE); for (unsigned int& offset : mipmapVector)
offset *= numChannels;
image->setImage(width, height, 1, pixelformat, pixelformat, GL_UNSIGNED_BYTE, data, osg::Image::USE_NEW_DELETE, packing);
break; break;
} }
default: default:

View file

@ -8,8 +8,6 @@
#include <osg/ref_ptr> #include <osg/ref_ptr>
#include <osg/Referenced> #include <osg/Referenced>
#include "controller.hpp"
namespace osg namespace osg
{ {
class Node; class Node;

View file

@ -21,6 +21,8 @@
#include <components/debug/debuglog.hpp> #include <components/debug/debuglog.hpp>
#include <components/nifosg/nifloader.hpp> #include <components/nifosg/nifloader.hpp>
#include <components/nifosg/controller.hpp>
#include <components/nif/niffile.hpp> #include <components/nif/niffile.hpp>
#include <components/misc/pathhelpers.hpp> #include <components/misc/pathhelpers.hpp>

View file

@ -6,9 +6,9 @@
#include <osg/ref_ptr> #include <osg/ref_ptr>
#include <osgAnimation/UpdateMatrixTransform> #include <osgAnimation/UpdateMatrixTransform>
#include <components/sceneutil/controller.hpp> #include "nodecallback.hpp"
#include <components/sceneutil/nodecallback.hpp> #include "keyframe.hpp"
#include <components/sceneutil/keyframe.hpp>
#include <components/resource/animation.hpp> #include <components/resource/animation.hpp>
namespace SceneUtil namespace SceneUtil

View file

@ -10,9 +10,10 @@
#include <memory> #include <memory>
#include <array> #include <array>
#include <components/stereo/types.hpp>
#include <components/shader/shadermanager.hpp> #include <components/shader/shadermanager.hpp>
#include "types.hpp"
namespace osg namespace osg
{ {
class FrameBufferObject; class FrameBufferObject;

View file

@ -3,8 +3,6 @@
#include <osg/StateSet> #include <osg/StateSet>
#include "defs.hpp"
namespace osg namespace osg
{ {
class Texture2D; class Texture2D;

View file

@ -1,9 +1,7 @@
#ifndef COMPONENTS_TERRAIN_VIEW_H #ifndef COMPONENTS_TERRAIN_VIEW_H
#define COMPONENTS_TERRAIN_VIEW_H #define COMPONENTS_TERRAIN_VIEW_H
#include <osg/ref_ptr>
#include <osg/Referenced> #include <osg/Referenced>
#include <osg/Vec3f>
namespace Terrain namespace Terrain
{ {

View file

@ -10,7 +10,6 @@
#include <components/sceneutil/nodecallback.hpp> #include <components/sceneutil/nodecallback.hpp>
#include "defs.hpp"
#include "cellborder.hpp" #include "cellborder.hpp"
namespace osg namespace osg

View file

@ -1,10 +1,10 @@
#ifndef OPENMW_WIDGETS_WRAPPER_H #ifndef OPENMW_WIDGETS_WRAPPER_H
#define OPENMW_WIDGETS_WRAPPER_H #define OPENMW_WIDGETS_WRAPPER_H
#include "widgets.hpp"
#include <components/settings/settings.hpp> #include <components/settings/settings.hpp>
#include <algorithm>
namespace Gui namespace Gui
{ {
template<class T> template<class T>