Skip to content

Commit 6d9f59b

Browse files
Update to Cubism 5 SDK for Native R5 beta2
1 parent ee9dd40 commit 6d9f59b

File tree

61 files changed

+8695
-2019
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+8695
-2019
lines changed

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,33 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77

8+
## [5-r.5-beta.2] - 2025-10-30
9+
10+
### Added
11+
12+
* Add support for Blend modes and Offscreen rendering.
13+
* In `5-r.5-beta.2`, the D3D9, D3D11 and Metal renderers have also been added.
14+
* Add `GetMocVersionFromBuffer()`function.
15+
* Support for retrieving MOC version from unsupported new MOC3 files.
16+
17+
### Changed
18+
19+
* Rename CubismOffscreenSurface_D3D9 class to CubismRenderTarget_D3D9.
20+
* Rename CubismOffscreenSurface_D3D11 class to CubismRenderTarget_D3D11.
21+
* Rename CubismOffscreenSurface_Metal class to CubismRenderTarget_Metal.
22+
* Change to the implementation now enables support for multiple devices instead of a single one.
23+
* In Metal, the `CubismRenderingInstanceSingleton_Metal` class has been removed.
24+
25+
### Fixed
26+
27+
* Fix by removing unnecessary comments and unused structs.
28+
* Fix the application crashing when shader files could not be loaded.
29+
* Fix warnings occurs during build on OpenGL-Android.
30+
* Fix D3D11 anisotropic filtering not working correctly.
31+
* Fix to correct pixel alignment for all shaders on D3D9.
32+
* Fix incorrect mask type selection on OpenGL, selecting `MaskTypeMaskedInvertedPremultipliedAlpha` instead of `MaskTypeMaskedPremultipliedAlpha`.
33+
34+
835
## [5-r.5-beta.1] - 2025-08-26
936

1037
### Added
@@ -490,6 +517,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
490517
* Fix invalid expressions of `CubismCdiJson`.
491518

492519

520+
[5-r.5-beta.2]: https://github.com/Live2D/CubismNativeFramework/compare/5-r.5-beta.1...5-r.5-beta.2
493521
[5-r.5-beta.1]: https://github.com/Live2D/CubismNativeFramework/compare/5-r.4.1...5-r.5-beta.1
494522
[5-r.4.1]: https://github.com/Live2D/CubismNativeFramework/compare/5-r.4...5-r.4.1
495523
[5-r.4]: https://github.com/Live2D/CubismNativeFramework/compare/5-r.3...5-r.4

NOTICE.ja.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,17 @@
44

55
# お知らせ
66

7-
## [制限事項] Cubism 5 SDK for Native R5 beta1 の動作環境について (2025-08-26)
7+
## [制限事項] Cubism 5 SDK for Native R5 beta2 の動作環境について (2025-10-30 更新)
88

9-
Cubism 5 SDK for Native R5 beta1 は、以下のプラットフォームにてビルド動作確認をしております。
9+
Cubism 5 SDK for Native R5 beta2 について、Vulkan環境は**ビルドができません**ので、あらかじめご了承ください。
10+
Vulkan環境は今後のアップデートにてCubism 5.3新機能も含め対応を予定しています。
11+
その他の環境については対応しております。
1012

11-
- OpenGL
12-
- Windows
13-
- macOS
14-
- iOS
15-
- Android
16-
17-
それ以外の環境では**ビルドができません**ので、あらかじめご了承ください。
18-
ビルド未対応のレンダラ及びプラットフォームの動作については Cubism 5 SDK for Native R5 beta2 以降の対応を予定しています。
13+
## [注意事項] Cubism 5 SDK for Native R5 beta2 Metal環境のパフォーマンスについて (2025-10-30)
1914

15+
Cubism 5 SDK for Native R5 beta2 Metal環境にてモデルを描画した際、iOS 26、iPadOS 26 及び macOS 26 環境においてパフォーマンスが劣化する場合がございます。
16+
本件はコマンドエンコーダー( `MTLRenderCommandEncoder` 及び `MTLBlitCommandEncoder` )のオーバーヘッドによるものと考えておりますが、
17+
今後のアップデートにてFrameworkの改修や、最新のMetalバージョンへ移行することも含めて調査し、対応を検討してまいります。
2018

2119
---
2220

NOTICE.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,17 @@
44

55
# Notices
66

7-
## [Restrictions] Operating Environment for Cubism 5 SDK for Native R5 beta1 (2025-08-26)
7+
## [Restrictions] Operating Environment for Cubism 5 SDK for Native R5 beta2 (Updated 2025-10-30)
88

9-
Cubism 5 SDK for Native R5 beta1 has been tested for build operation on the following platforms:
9+
Please be aware that the Cubism 5 SDK for Native R5 beta2 does not support builds in Vulkan environments.
10+
Support for Vulkan, including new features of Cubism 5.3, is planned for future updates.
11+
Other environments are supported.
1012

11-
- OpenGL
12-
- Windows
13-
- macOS
14-
- iOS
15-
- Android
16-
17-
Please note that **building is not supported** on other environments.
18-
We plan to support the functionality of unsupported renderers and platforms in Cubism 5 SDK for Native R5 beta2 and later.
13+
## [Cautions] Performance of Cubism 5 SDK for Native R5 beta2 in Metal Environments (2025-10-30)
1914

15+
When rendering models in the Metal environment of Cubism 5 SDK for Native R5 beta2, performance may degrade in iOS 26, iPadOS 26, and macOS 26 environments.
16+
This issue is believed to be caused by overhead from the command encoders (`MTLRenderCommandEncoder` and `MTLBlitCommandEncoder`).
17+
We will investigate and consider addressing this issue in future updates, including modifications to the Framework and migration to the latest Metal version.
2018

2119
---
2220

src/Effect/CubismEyeBlink.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ CubismEyeBlink::~CubismEyeBlink()
5252

5353
csmFloat32 CubismEyeBlink::DetermineNextBlinkingTiming() const
5454
{
55-
const csmFloat32 r = static_cast<csmFloat32>(rand()) / RAND_MAX;
55+
const csmFloat32 r = static_cast<csmFloat32>(rand()) / static_cast<csmFloat32>(RAND_MAX);
5656

5757
return _userTimeSeconds + (r * (2.0f * _blinkingIntervalSeconds - 1.0f));
5858
}

src/Model/CubismMoc.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,25 @@ Core::csmMocVersion CubismMoc::GetMocVersion()
9696
return _mocVersion;
9797
}
9898

99+
Core::csmMocVersion CubismMoc::GetMocVersionFromBuffer(const csmByte* mocBytes, csmSizeInt size)
100+
{
101+
if (mocBytes == nullptr || size == 0)
102+
{
103+
CubismLogError("Invalid mocBytes or size.");
104+
return 0;
105+
}
106+
void* alignedBuffer = CSM_MALLOC_ALLIGNED(size, Core::csmAlignofMoc);
107+
if (alignedBuffer == nullptr)
108+
{
109+
CubismLogError("Failed to allocate aligned memory.");
110+
return 0;
111+
}
112+
memcpy(alignedBuffer, mocBytes, size);
113+
const Core::csmMocVersion version = Core::csmGetMocVersion(alignedBuffer, size);
114+
CSM_FREE_ALLIGNED(alignedBuffer);
115+
return version;
116+
}
117+
99118
csmBool CubismMoc::HasMocConsistency(void* address, const csmUint32 size)
100119
{
101120
csmInt32 isConsistent = Core::csmHasMocConsistency(address, size);

src/Model/CubismMoc.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ class CubismMoc
6565
*/
6666
Core::csmMocVersion GetMocVersion();
6767

68+
/**
69+
* Returns the version of the unload MOC file.
70+
*
71+
* @param mocBytes Buffer containing the loaded MOC file
72+
* @param size Size of the buffer in bytes
73+
*
74+
* @return Version
75+
*/
76+
static Core::csmMocVersion GetMocVersionFromBuffer(const csmByte* mocBytes, csmSizeInt size);
77+
6878
/**
6979
* Checks the consistency of the MOC file.
7080
*

src/Model/CubismModel.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -762,10 +762,7 @@ const csmInt32* CubismModel::GetOffscreenOwnerIndices() const
762762
const CubismIdHandle CubismModel::GetOffscreenOwnerId(csmUint32 offscreenIndex) const
763763
{
764764
const csmUint32 ownerIndex = GetOffscreenOwnerIndices()[offscreenIndex];
765-
766-
return CubismFramework::GetIdManager()->GetId(Core::csmGetPartIds(_model)[ownerIndex]);
767-
768-
return NULL;
765+
return CubismFramework::GetIdManager()->GetId(Core::csmGetPartIds(_model)[ownerIndex]);
769766
}
770767

771768
csmInt32 CubismModel::GetDrawableCount() const

src/Model/CubismUserModel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,11 @@ CubismModel* CubismUserModel::GetModel() const
279279
return _model;
280280
}
281281

282+
Core::csmMocVersion CubismUserModel::GetMocVersionFromBuffer(const csmByte* buffer, csmSizeInt size)
283+
{
284+
return CubismMoc::GetMocVersionFromBuffer(buffer, size);
285+
}
286+
282287
void CubismUserModel::CreateRenderer(csmUint32 width, csmUint32 height, csmInt32 maskBufferCount)
283288
{
284289
if (_renderer)

src/Model/CubismUserModel.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,16 @@ class CubismUserModel
192192
*/
193193
CubismModel* GetModel() const;
194194

195+
/**
196+
* Returns the version of the unload MOC file.
197+
*
198+
* @param buffer Buffer where the MOC3 file is loaded
199+
* @param size Number of bytes in the buffer
200+
*
201+
* @return Version
202+
*/
203+
static Core::csmMocVersion GetMocVersionFromBuffer(const csmByte* buffer, csmSizeInt size);
204+
195205
/**
196206
* Returns the renderer.
197207
*

src/Rendering/CubismRenderer.hpp

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class CubismModel;
2020
namespace Live2D { namespace Cubism { namespace Framework { namespace Rendering {
2121

2222
/**
23-
* @brief モデル描画を処理するレンダラ<br>
23+
* @brief モデル描画を処理するレンダラ
2424
* サブクラスに環境依存の描画命令を記述する
2525
*/
2626
class CubismRenderer
@@ -45,6 +45,7 @@ class CubismRenderer
4545
CubismBlendMode_Additive = 1, ///< 加算
4646
CubismBlendMode_Multiplicative = 2, ///< 乗算
4747
CubismBlendMode_Mask = 3, ///< マスク
48+
CubismBlendMode_Copy = 4, ///< コピー
4849
};
4950

5051
/**
@@ -88,43 +89,6 @@ class CubismRenderer
8889

8990
};
9091

91-
/**
92-
* @brief エイリアスの描画対象のソート結果を管理するための構造体
93-
*/
94-
struct CubismDrawableSortItem
95-
{
96-
/**
97-
* @brief コンストラクタ
98-
*/
99-
CubismDrawableSortItem()
100-
: ObjectIndex(0)
101-
, ObjectType(0)
102-
, RenderOrder(0)
103-
{
104-
}
105-
106-
/**
107-
* @brief コンストラクタ
108-
*/
109-
CubismDrawableSortItem(csmInt32 objectIndex, csmInt32 objectType, csmInt32 renderOrder)
110-
: ObjectIndex(objectIndex)
111-
, ObjectType(objectType)
112-
, RenderOrder(renderOrder)
113-
{
114-
}
115-
116-
/**
117-
* @brief デストラクタ
118-
*/
119-
virtual ~CubismDrawableSortItem()
120-
{
121-
}
122-
123-
csmInt32 ObjectIndex;
124-
csmInt32 ObjectType;
125-
csmInt32 RenderOrder;
126-
};
127-
12892
/**
12993
* @brief レンダラのインスタンスを生成して取得する
13094
*

0 commit comments

Comments
 (0)