Skip to content

Commit

Permalink
Release v2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
webermm committed Jul 4, 2024
1 parent 989ced7 commit 7861761
Show file tree
Hide file tree
Showing 44 changed files with 23,826 additions and 63 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ If a copy of the MPL was not distributed with this file, You can obtain one at h
-->

## [2.2.0] Ramses 28.2 update
* **File version number has changed. Files saved with RaCo 2.2.0 cannot be opened by previous versions.**
* **Export now supports Ramses feature levels up to 2. Scenes exported with feature level 2 can't be opened with Ramses before v2.2.0.**

### Changes
* Updated Ramses from v28.0.0 to v28.2.0.
* Scenes exported with feature level 2 can be merged in Ramses. The `ramses-viewer` is now able to load and merge several exported files.
* Starting at feature level 2 uniform buffers objects with predefined semantics are supported as specified in the documentation.


## [2.1.0] Render View, Python Console, Performance Table, Misc Improvements and Bugfixes
* **File version number has changed. Files saved with RaCo 2.1.0 cannot be opened by previous versions.**

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cmake_minimum_required(VERSION 3.19)

SET(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo")

project(RaCoOS VERSION 2.1.0)
project(RaCoOS VERSION 2.2.0)

SET(RACO_RELEASE_DIRECTORY ${CMAKE_BINARY_DIR}/release)

Expand Down
1 change: 0 additions & 1 deletion EditorApp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ set_target_properties(RaCoEditor PROPERTIES OUTPUT_NAME "RamsesComposer" RUNTIME
set(RACO_RELEASE_ROOT_FILES
${CMAKE_SOURCE_DIR}/README.md
${CMAKE_SOURCE_DIR}/CHANGELOG.md
${CMAKE_SOURCE_DIR}/third_party/ramses-logic/tools/migrate/migrate_to_v1_0.py
)

create_folder_structure("${RACO_RELEASE_ROOT_FILES}" ${RACO_RELEASE_DIRECTORY} RaCoPrepareReleaseFolder)
Expand Down
3 changes: 3 additions & 0 deletions HeadlessApp/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ set_tests_properties(RaCoHeadless_load_no_such_file PROPERTIES WILL_FAIL True)
add_racocommand_test(RaCoHeadless_load_future_version "${CMAKE_CURRENT_BINARY_DIR}" "-p" "${CMAKE_SOURCE_DIR}/resources/future-version.rca")
set_tests_properties(RaCoHeadless_load_future_version PROPERTIES WILL_FAIL True)

add_racocommand_test(RaCoHeadless_load_future_feature_level "${CMAKE_CURRENT_BINARY_DIR}" "-p" "${CMAKE_SOURCE_DIR}/resources/future-feature-level.rca")
set_tests_properties(RaCoHeadless_load_future_feature_level PROPERTIES WILL_FAIL True)

add_racocommand_test(RaCoHeadless_load_no_json "${CMAKE_CURRENT_BINARY_DIR}" "-p" "${CMAKE_SOURCE_DIR}/resources/no-json.rca")
set_tests_properties(RaCoHeadless_load_no_json PROPERTIES WILL_FAIL True)

Expand Down
11 changes: 9 additions & 2 deletions PyAPITests/pyt_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,15 @@ def test_load_raco_2x_feature_levels(self):
raco.load(self.cwd() + "/../resources/empty-raco-2x-fl1.rca", raco.maxFeatureLevel())
self.assertEqual(raco.projectFeatureLevel(), raco.maxFeatureLevel())

# TODO check that feature level downgrade is not possible:
# currently can't be tested since max feature level is 1
raco.load(self.cwd() + "/../resources/empty-raco-2x-fl2.rca")
self.assertEqual(raco.projectFeatureLevel(), 2)

# Feature level downgrade fails:
with self.assertRaises(RuntimeError):
raco.load(self.cwd() + "/../resources/empty-raco-2x-fl2.rca", 1)

raco.load(self.cwd() + "/../resources/empty-raco-2x-fl2.rca", raco.maxFeatureLevel())
self.assertEqual(raco.projectFeatureLevel(), raco.maxFeatureLevel())

def test_save_check_object_id(self):
objectInitID = self.findObjectByType("ProjectSettings").objectID()
Expand Down
6 changes: 6 additions & 0 deletions components/libApplication/src/RaCoApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ void RaCoApplication::switchActiveRaCoProject(const QString& file, std::function
activeProject_ = RaCoProject::createNew(this, createDefaultScene, newFeatureLevel);
} else {
auto fileFeatureLevel = RaCoProject::preloadFeatureLevel(file, featureLevel);

// We run into this case when there is a feature level upgrade without a file version upgrade:
if (fileFeatureLevel < ramses_base::BaseEngineBackend::minFeatureLevel || fileFeatureLevel > ramses_base::BaseEngineBackend::maxFeatureLevel) {
throw std::runtime_error(fmt::format("Project feature level {} outside valid range ({} ... {})", fileFeatureLevel, static_cast<int>(ramses_base::BaseEngineBackend::minFeatureLevel), static_cast<int>(ramses_base::BaseEngineBackend::maxFeatureLevel)));
}

engine_->setFeatureLevel(static_cast<ramses::EFeatureLevel>(fileFeatureLevel));
activeProject_ = RaCoProject::loadFromFile(file, this, loadContext, false, featureLevel, generateNewObjectIDs);
}
Expand Down
6 changes: 6 additions & 0 deletions components/libApplication/src/RaCoProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,12 @@ std::unique_ptr<RaCoProject> RaCoProject::loadFromFile(const QString& filename,
auto absPath = utils::u8path(info.path).normalizedAbsolutePath(p.currentFolder());
p.addExternalProjectMapping(id, absPath.string(), info.name);
}

// We run into this case when there is a feature level upgrade without a file version upgrade:
if (p.featureLevel() < ramses_base::BaseEngineBackend::minFeatureLevel || p.featureLevel() > ramses_base::BaseEngineBackend::maxFeatureLevel) {
throw std::runtime_error(fmt::format("Project feature level {} outside valid range ({} ... {})", p.featureLevel(), static_cast<int>(ramses_base::BaseEngineBackend::minFeatureLevel), static_cast<int>(ramses_base::BaseEngineBackend::maxFeatureLevel)));
}

if (featureLevel != -1) {
if (featureLevel >= p.featureLevel() && featureLevel <= static_cast<int>(ramses_base::BaseEngineBackend::maxFeatureLevel)) {
p.setFeatureLevel(featureLevel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ SceneAdaptor::SceneAdaptor(ramses::RamsesClient* client, ramses::sceneId_t id, P
: client_{client},
project_(project),
scene_{ramsesScene(id, client_)},
logicEngine_{ramses_base::BaseEngineBackend::UniqueLogicEngine(scene_->createLogicEngine(), [this](ramses::LogicEngine* logicEngine) { scene_->destroy(*logicEngine); })},
logicEngine_{ramses_base::BaseEngineBackend::UniqueLogicEngine(scene_->createLogicEngine("LogicEngine_" + project->projectName()), [this](ramses::LogicEngine* logicEngine) { scene_->destroy(*logicEngine); })},
subscription_{dispatcher->registerOnObjectsLifeCycle([this](SEditorObject obj) { createAdaptor(obj); }, [this](SEditorObject obj) { removeAdaptor(obj); })},
childrenSubscription_(dispatcher->registerOnPropertyChange("children", [this](core::ValueHandle handle) {
adaptorStatusDirty_ = true;
Expand Down
3 changes: 0 additions & 3 deletions components/libRamsesBase/src/ramses_adaptor/SceneBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ bool SceneBackend::discardRamsesMessage(std::string_view message) {
if (message.find("has no outgoing links! Node should be deleted or properly linked!") != std::string::npos) {
return true;
}
if (message.find("rendergroup does not contain any meshes") != std::string::npos) {
return true;
}
if (message.find("Unused [uniform]") != std::string::npos ||
message.find("Unused [in]") != std::string::npos ||
message.find("Unused [out]") != std::string::npos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ const ramses::EFeatureLevel BaseEngineBackend::minFeatureLevel = ramses::EFeatur
// - feature level downgrade tests
// - python api: in pyt_general.py -> test_load_raco_2x_feature_levels

const ramses::EFeatureLevel BaseEngineBackend::maxFeatureLevel = ramses::EFeatureLevel::EFeatureLevel_01;
const ramses::EFeatureLevel BaseEngineBackend::maxFeatureLevel = ramses::EFeatureLevel::EFeatureLevel_02;

const std::string BaseEngineBackend::featureLevelDescriptions =
R"(1 - Ramses v28.0.0
2 - Ramses v28.2.0
- scene merging
)";


Expand Down
37 changes: 30 additions & 7 deletions components/libRamsesBase/src/ramses_base/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,11 @@ std::map<std::string, ramses::EEffectUniformSemantic> defaultUniformSemantics =
{"uViewMatrix", ramses::EEffectUniformSemantic::ViewMatrix},
{"uNormalMatrix", ramses::EEffectUniformSemantic::NormalMatrix},
{"uCameraPosition", ramses::EEffectUniformSemantic::CameraWorldPosition},
{"uResolution", ramses::EEffectUniformSemantic::DisplayBufferResolution}};
{"uResolution", ramses::EEffectUniformSemantic::DisplayBufferResolution},

{"uModelBlock", ramses::EEffectUniformSemantic::ModelBlock},
{"uCameraBlock", ramses::EEffectUniformSemantic::CameraBlock},
{"uModelCameraBlock", ramses::EEffectUniformSemantic::ModelCameraBlock}};

static std::map<ramses::EDataType, core::EnginePrimitive> shaderTypeMap = {
{ramses::EDataType::Bool, core::EnginePrimitive::Bool},
Expand Down Expand Up @@ -209,7 +213,9 @@ std::unique_ptr<ramses::EffectDescription> createEffectDescription(const std::st
description->setGeometryShader(geometryShader.c_str());

for (auto item : defaultUniformSemantics) {
description->setUniformSemantic(item.first.c_str(), item.second);
if (!description->setUniformSemantic(item.first.c_str(), item.second)) {
LOG_ERROR(log_system::RAMSES_BACKEND, "Error setting uniform semantic for '{}' to '{}'", item.first.c_str(), item.second);
}
}
return description;
}
Expand Down Expand Up @@ -331,19 +337,36 @@ bool parseShaderText(ramses::Scene &scene, const std::string &vertexShader, cons
bool success = false;
if (effect) {
uint32_t numUniforms = effect->getUniformInputCount();
std::vector<std::string> exclusions;
for (uint32_t i{0}; i < numUniforms; i++) {
ramses::UniformInput uniform = effect->getUniformInput(i).value();
if (uniform.getSemantics() == ramses::EEffectUniformSemantic::Invalid) {
if (shaderTypeMap.find(uniform.getDataType()) != shaderTypeMap.end()) {
auto engineType = shaderTypeMap[uniform.getDataType()];
buildUniformRecursive(std::string(uniform.getName()), outUniforms, engineType, uniform.getElementCount(), outError);
} else {
// mat4 uniforms are needed for skinning: they will be set directly by the LogicEngine
} else if (uniform.getDataType() == ramses::EDataType::UniformBuffer) {
outError += fmt::format("Uniform '{}' has type uniform buffer which currently can't be exported.", uniform.getName());
} else if (uniform.getDataType() != ramses::EDataType::Matrix44F) {
// mat4 uniforms are needed for skinning: they will be set directly by the LogicEngine
// so we don't need to expose but they shouldn't generate errors either:
if (uniform.getDataType() != ramses::EDataType::Matrix44F) {
outError += std::string(uniform.getName()) + " has unsupported type";
}
outError += std::string(uniform.getName()) + " has unsupported type";
}
} else {
// For struct uniforms with UBO semantics the struct itself will have invalid semantics
// but the struct members in struct.member notation will have normal semantics.
// In order to remove those we need to build an exclusion list and remove them explicitly below.
exclusions.emplace_back(uniform.getName());
}
}

// This will remove struct members of uniforms with UBO semantics
for (auto excludedUniform : exclusions) {
auto it = std::find_if(outUniforms.begin(), outUniforms.end(),
[excludedUniform](auto interface) {
return interface.name == excludedUniform;
});
if (it != outUniforms.end()) {
outUniforms.erase(it);
}
}

Expand Down
5 changes: 4 additions & 1 deletion datamodel/libCore/include/core/ProjectMigration.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,12 @@ namespace raco::serialization {
* - RenderBuffer and RenderBufferMS height and width
* - BlitPass sourceX, sourceY, destinationX, destinationY, width, height
* - BaseCamera::viewport width, height, offsetX, offsetY
* 2006: New Ramses feature level 2, but no RaCo data model changes.
* - Increase the file version to avoid problems when trying to load feature level 2
* scenes with RaCo <v2.2.
*/

constexpr int RAMSES_PROJECT_FILE_VERSION = 2005;
constexpr int RAMSES_PROJECT_FILE_VERSION = 2006;

void migrateProject(ProjectDeserializationInfoIR& deserializedIR, serialization::proxy::ProxyObjectFactory& factory);

Expand Down
12 changes: 6 additions & 6 deletions datamodel/libCore/tests/migrationTestData/version-current.rca
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"externalProjects": {
},
"featureLevel": 1,
"fileVersion": 2005,
"featureLevel": 2,
"fileVersion": 2006,
"instances": [
{
"properties": {
Expand Down Expand Up @@ -645,7 +645,7 @@
"scriptSubdirectory": "scripts",
"shaderSubdirectory": "shaders"
},
"featureLevel": 1,
"featureLevel": 2,
"objectID": "71454add-eb56-4288-9057-825539914bed",
"objectName": "test-offscreen-tex-uniform-migration-material",
"pythonOnSaveScript": "",
Expand Down Expand Up @@ -2325,7 +2325,7 @@
"objectID": "9c2eeeea-cef0-42a5-9815-d32d38ccfd60",
"objectName": "Timer",
"outputs": {
"ticker_us": "2332962042566"
"ticker_us": "264615360540"
}
},
"typeName": "Timer"
Expand Down Expand Up @@ -2594,12 +2594,12 @@
],
"racoVersion": [
2,
0,
1,
0
],
"ramsesVersion": [
28,
0,
2,
0
],
"structPropMap": {
Expand Down
2 changes: 2 additions & 0 deletions datamodel/libUserTypes/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ raco_package_add_test_resources(
scripts/types-scalar.lua
shaders/basic.vert
shaders/basic.frag
shaders/ubo.vert
shaders/ubo.frag
shaders/uniform-array.vert
shaders/uniform-array.frag
shaders/include/main_mat_adapter_test.frag
Expand Down
14 changes: 12 additions & 2 deletions datamodel/libUserTypes/tests/Material_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ TEST_F(MaterialTest, errorEmptyGeometryShader) {

commandInterface.set(geometryUriHandle, shaderEmptyFile);
ASSERT_TRUE(commandInterface.errors().hasError(material));
ASSERT_EQ(commandInterface.errors().getError(material).message(), "[GLSL Compiler] geometry shader Shader Parsing Error:\nERROR: #version: geometry shaders require es profile with version 310 or non-es profile with version 150 or above\nERROR: 0:1: '' : array size must be a positive integer\nERROR: 0:1: '' : compilation terminated \nINTERNAL ERROR: Unable to parse built-ins\nERROR: 1 compilation errors. No code generated.\n\n\n");
ASSERT_EQ(commandInterface.errors().getError(material).message(), "[GLSL Compiler] geometry shader Shader Parsing Error:\nERROR: #version: geometry shaders require es profile with version 310 or non-es profile with version 150 or above\nERROR: 1 compilation errors. No code generated.\n\n\n");
commandInterface.set(geometryUriHandle, shaderWhitespaceOnlyFile);
ASSERT_TRUE(commandInterface.errors().hasError(material));
ASSERT_EQ(commandInterface.errors().getError(material).message(), "[GLSL Compiler] geometry shader Shader Parsing Error:\nERROR: #version: geometry shaders require es profile with version 310 or non-es profile with version 150 or above\nERROR: 0:1: '' : array size must be a positive integer\nERROR: 0:1: '' : compilation terminated \nINTERNAL ERROR: Unable to parse built-ins\nERROR: 1 compilation errors. No code generated.\n\n\n");
ASSERT_EQ(commandInterface.errors().getError(material).message(), "[GLSL Compiler] geometry shader Shader Parsing Error:\nERROR: #version: geometry shaders require es profile with version 310 or non-es profile with version 150 or above\nERROR: 1 compilation errors. No code generated.\n\n\n");
}

TEST_F(MaterialTest, shaderDefines) {
Expand Down Expand Up @@ -242,3 +242,13 @@ TEST_F(MaterialTest, shaderFileWatcherTest) {
verifyFileWatcher(file);
}
}

TEST_F(MaterialTest, ubo_uniform) {
auto mat = create_material("material", "shaders/ubo.vert", "shaders/ubo.frag");

ASSERT_FALSE(commandInterface.errors().hasError({mat}));
ASSERT_FALSE(commandInterface.errors().hasError({mat, &user_types::Material::uriVertex_}));
ASSERT_FALSE(commandInterface.errors().hasError({mat, &user_types::Material::uriFragment_}));
}


41 changes: 33 additions & 8 deletions doc/basics/conventions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,44 @@ There are few special semantic uniforms (i.e. uniforms which can't be explicitly

| Ramses Enumeration | Type | Uniform name in custom GLSL shaders |
| -----------------------------------|---------|:-------------:|
| ```MODEL_MATRIX``` | `MAT44` | u_MMatrix / uWorldMatrix |
| ```MODEL_VIEW_MATRIX``` | `MAT44` | u_MVMatrix / uWorldViewMatrix |
| ```MODEL_VIEW_PROJECTION_MATRIX``` | `MAT44` | u_MVPMatrix / uWorldViewProjectionMatrix |
| ```PROJECTION_MATRIX``` | `MAT44` | u_PMatrix / uProjectionMatrix |
| ```VIEW_MATRIX``` | `MAT44` | u_VMatrix / uViewMatrix |
| ```NORMAL_MATRIX``` | `MAT44` | u_NMatrix / uNormalMatrix |
| ```CAMERA_WORLD_POSITION``` | `VEC3` | u_CameraWorldPosition / uCameraPosition |
| ```RESOLUTION``` | `VEC2` | u_resolution / uResolution |
| ```ModelMatrix``` | `MAT44` | u_MMatrix / uWorldMatrix |
| ```ModelViewMatrix``` | `MAT44` | u_MVMatrix / uWorldViewMatrix |
| ```ModelViewProjectionMatrix``` | `MAT44` | u_MVPMatrix / uWorldViewProjectionMatrix |
| ```ProjectionMatrix``` | `MAT44` | u_PMatrix / uProjectionMatrix |
| ```ViewMatrix``` | `MAT44` | u_VMatrix / uViewMatrix |
| ```NormalMatrix``` | `MAT44` | u_NMatrix / uNormalMatrix |
| ```CameraWorldPosition``` | `VEC3` | u_CameraWorldPosition / uCameraPosition |
| ```DisplayBufferResolution``` | `VEC2` | u_resolution / uResolution |
| ```ModelBlock``` | UBO (see below) | uModelBlock |
| ```CameraBlock``` | UBO (see below) | uCameraBlock |
| ```ModelCameraBlock``` | UBO (see below) | uModelCameraBlock |

If any of these uniforms are found in a shader, they will not show up in the Property view of MeshNodes and Materials, but they will receive their value from Ramses.

In addition the `u_jointMat` uniform of private materials of MeshNodes will be set by Skin objects referencing the MeshNode. It has to be an array of type `VEC4` of the same length as the number of joints nodes in the Skin object.

Starting at feature level 2 semantics for uniform buffers objects is supported as specified in the table above. The data layout of the UBO types is given by the shader code below. Note that the order of the declarations in the structs matters.

```
layout(std140, binding = 0) uniform ModelBlock_t {
mat4 modelMat;
} uModelBlock;
layout(std140, binding = 1) uniform CameraBlock_t
{
mat4 projMat;
mat4 viewMat;
vec3 camPos;
} uCameraBlock;
layout(std140, binding = 2) uniform CameraModelBlock_t
{
mat4 mvpMat;
mat4 mvMat;
mat4 normalMat;
} uModelCameraBlock;
```

## Shader Includes
Ramses Composer supports `#include` directives in shaders. The path must be relative to current source file. Shaders with `#include` directive are preprocessed by Ramses Composer and then sent to Ramses. Shader errors show locations in preprocessed file. Shader tooltips show preprocessor errors.

Expand Down
Loading

0 comments on commit 7861761

Please sign in to comment.