/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return true;
}
+uint32_t TestGlAbstraction::GetShaderLanguageVersion()
+{
+ return mShaderLanguageVersion;
+}
+
std::string TestGlAbstraction::GetShaderVersionPrefix()
{
return std::string("");
#define TEST_GL_ABSTRACTION_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
bool IsBlendEquationSupported(DevelBlendEquation::Type blendEquation) override;
+ uint32_t GetShaderLanguageVersion();
+
std::string GetShaderVersionPrefix();
std::string GetVertexShaderPrefix();
TraceCallStack mViewportTrace;
// Shaders & Uniforms
+ uint32_t mShaderLanguageVersion{320u};
+
GLuint mLastShaderIdUsed;
GLuint mLastProgramIdUsed{0u};
GLuint mLastUniformIdUsed;
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
END_TEST;
}
+int UtcDaliShaderGetShaderLanguageVersion(void)
+{
+ TestApplication application;
+
+ tet_infoline("Test get shader language version");
+
+ auto originalShaderVersion = application.GetGlAbstraction().GetShaderLanguageVersion();
+
+ try
+ {
+ uint32_t expectVersion = 100;
+ application.GetGlAbstraction().mShaderLanguageVersion = expectVersion;
+
+ DALI_TEST_EQUALS(Dali::Shader::GetShaderLanguageVersion(), expectVersion, TEST_LOCATION);
+
+ expectVersion = 200;
+ application.GetGlAbstraction().mShaderLanguageVersion = expectVersion;
+
+ DALI_TEST_EQUALS(Dali::Shader::GetShaderLanguageVersion(), expectVersion, TEST_LOCATION);
+ }
+ catch(...)
+ {
+ DALI_TEST_CHECK(false);
+ }
+
+ application.GetGlAbstraction().mShaderLanguageVersion = originalShaderVersion;
+
+ END_TEST;
+}
+
int UtcDaliShaderAnimatedProperty02(void)
{
TestApplication application;
std::string hintSet = "MODIFIES_GEOMETRY";
Property::Map map;
- map["vertex"] = VertexSource;
- map["fragment"] = FragmentSource;
+ map["vertex"] = VertexSource;
+ map["fragment"] = FragmentSource;
map["renderPassTag"] = 0;
- map["hints"] = hintSet;
+ map["hints"] = hintSet;
Shader shader = Shader::New(map);
std::string hintSet = "MODIFIES_GEOMETRY";
Property::Map map;
- map["vertex"] = VertexSource;
- map["fragment"] = FragmentSource;
+ map["vertex"] = VertexSource;
+ map["fragment"] = FragmentSource;
map["renderPassTag"] = 0;
- map["hints"] = Shader::Hint::Value::MODIFIES_GEOMETRY;
+ map["hints"] = Shader::Hint::Value::MODIFIES_GEOMETRY;
Shader shader = Shader::New(map);
std::string hintSet = "MODIFIES_GEOMETRY";
Property::Map map[2];
- map[0]["vertex"] = VertexSource;
- map[0]["fragment"] = FragmentSource;
+ map[0]["vertex"] = VertexSource;
+ map[0]["fragment"] = FragmentSource;
map[0]["renderPassTag"] = 0;
- map[0]["hints"] = hintSet;
+ map[0]["hints"] = hintSet;
- map[1]["vertex"] = VertexSource2;
- map[1]["fragment"] = FragmentSource2;
+ map[1]["vertex"] = VertexSource2;
+ map[1]["fragment"] = FragmentSource2;
map[1]["renderPassTag"] = 1;
- map[1]["hints"] = hintSet;
+ map[1]["hints"] = hintSet;
Property::Array array;
array.PushBack(map[0]);
std::string hintSet = "MODIFIES_GEOMETRY";
Property::Map map[2];
- map[0]["vertex"] = VertexSource;
- map[0]["fragment"] = FragmentSource;
+ map[0]["vertex"] = VertexSource;
+ map[0]["fragment"] = FragmentSource;
map[0]["renderPassTag"] = 0;
- map[0]["hints"] = hintSet;
+ map[0]["hints"] = hintSet;
- map[1]["vertex"] = VertexSource2;
- map[1]["fragment"] = FragmentSource2;
+ map[1]["vertex"] = VertexSource2;
+ map[1]["fragment"] = FragmentSource2;
map[1]["renderPassTag"] = 1;
- map[1]["hints"] = hintSet;
+ map[1]["hints"] = hintSet;
Property::Array array;
array.PushBack(map[0]);
virtual bool IsBlendEquationSupported(DevelBlendEquation::Type blendEquation) = 0;
/**
+ * Returns shading language version.
+ * @Return shading language version.
+ */
+ virtual uint32_t GetShaderLanguageVersion() = 0;
+
+ /**
* Returns shader prefix of shading language version.
* @Return shader prefix of shading language version.
*/
return mCore->GetGlAbstraction().IsBlendEquationSupported(blendEquation);
}
+uint32_t ThreadLocalStorage::GetShaderLanguageVersion()
+{
+ return mCore->GetGlAbstraction().GetShaderLanguageVersion();
+}
+
std::string ThreadLocalStorage::GetShaderVersionPrefix()
{
return mCore->GetGlAbstraction().GetShaderVersionPrefix();
#define DALI_INTERNAL_THREAD_LOCAL_STORAGE_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @brief Returns shader prefix of shading language version.
*/
+ uint32_t GetShaderLanguageVersion();
+
+ /**
+ * @brief Returns shader prefix of shading language version.
+ */
std::string GetShaderVersionPrefix();
/**
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
}
+uint32_t Shader::GetShaderLanguageVersion()
+{
+ Dali::Internal::ThreadLocalStorage& tls = Dali::Internal::ThreadLocalStorage::Get();
+ return tls.GetShaderLanguageVersion();
+}
+
std::string Shader::GetShaderVersionPrefix()
{
Dali::Internal::ThreadLocalStorage& tls = Dali::Internal::ThreadLocalStorage::Get();
#define DALI_INTERNAL_SHADER_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
~Shader() override;
private: // unimplemented methods
- Shader() = delete;
- Shader(const Shader&) = delete;
+ Shader() = delete;
+ Shader(const Shader&) = delete;
Shader& operator=(const Shader&) = delete;
private:
public:
/**
+ * @copydoc Dali::Shader::GetShaderLanguageVersion()
+ */
+ static uint32_t GetShaderLanguageVersion();
+
+ /**
* @copydoc Dali::Shader::GetShaderVersionPrefix()
*/
static std::string GetShaderVersionPrefix();
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
}
+uint32_t Shader::GetShaderLanguageVersion()
+{
+ return Dali::Internal::Shader::GetShaderLanguageVersion();
+}
+
std::string Shader::GetShaderVersionPrefix()
{
return Dali::Internal::Shader::GetShaderVersionPrefix();
#define DALI_SHADER_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Shader& operator=(Shader&& rhs);
/**
+ * @brief Get the number of shading language version.
+ * @note This can potentially block until GL has been initialized
+ * when the first time any DALi application is launched in the system.
+ * @SINCE_2_3.10
+ * @return shader languange versoin as integer.
+ */
+ static uint32_t GetShaderLanguageVersion();
+
+ /**
* @brief Get shader preprocessor of shading language version.
* @note This can potentially block until GL has been initialized
* when the first time any DALi application is launched in the system.