#define DALI_SHADER_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 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.
class DALI_CORE_API Shader : public Handle
{
public:
-
/**
* @brief Hints for rendering.
* @SINCE_1_1.45
*/
enum Value
{
- NONE = 0x00, ///< No hints @SINCE_1_1.45
- OUTPUT_IS_TRANSPARENT = 0x01, ///< Might generate transparent alpha from opaque inputs @SINCE_1_1.45
- MODIFIES_GEOMETRY = 0x02, ///< Might change position of vertices, this option disables any culling optimizations @SINCE_1_1.45
+ NONE = 0x00, ///< No hints @SINCE_1_1.45
+ OUTPUT_IS_TRANSPARENT = 0x01, ///< Might generate transparent alpha from opaque inputs @SINCE_1_1.45
+ MODIFIES_GEOMETRY = 0x02, ///< Might change position of vertices, this option disables any culling optimizations @SINCE_1_1.45
};
};
* @param[in] hints Hints to define the geometry of the rendered object
* @return A handle to a shader effect
*/
- static Shader New( const std::string& vertexShader,
- const std::string& fragmentShader,
- Hint::Value hints = Hint::NONE );
+ static Shader New(std::string_view vertexShader,
+ std::string_view fragmentShader,
+ Hint::Value hints = Hint::NONE);
/**
* @brief Default constructor, creates an empty handle.
* @SINCE_1_1.43
* @param[in] handle A handle to a Shader object
*/
- Shader( const Shader& handle );
+ Shader(const Shader& handle);
/**
* @brief Downcasts to a shader handle.
* @param[in] handle Handle to an object
* @return Shader handle or an uninitialized handle
*/
- static Shader DownCast( BaseHandle handle );
+ static Shader DownCast(BaseHandle handle);
/**
* @brief Assignment operator, changes this handle to point at the same object.
* @param[in] handle Handle to an object
* @return Reference to the assigned object
*/
- Shader& operator=( const Shader& handle );
+ Shader& operator=(const Shader& handle);
/**
* @brief Move constructor.
* @SINCE_1_9.22
* @param[in] rhs A reference to the moved handle
*/
- Shader( Shader&& rhs );
+ Shader(Shader&& rhs) noexcept;
/**
* @brief Move assignment operator.
* @param[in] rhs A reference to the moved handle
* @return A reference to this
*/
- Shader& operator=( Shader&& rhs );
+ Shader& operator=(Shader&& rhs) noexcept;
-public:
+ /**
+ * @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.
+ * @SINCE_1_9.36
+ * @return shader preprocessor string.
+ */
+ static std::string GetShaderVersionPrefix();
/**
+ * @brief Get vertex shader preprocessor that includes 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_1_9.36
+ * @return Vertex shader preprocessor string.
+ */
+ static std::string GetVertexShaderPrefix();
+
+ /**
+ * @brief Get fragment shader preprocessor that includes 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_1_9.36
+ * @return Fragment shader preprocessor string.
+ */
+ static std::string GetFragmentShaderPrefix();
+
+public:
+ /**
* @brief This constructor is used by Dali New() methods.
* @note Not intended for application developers.
* @SINCE_1_1.43
* @param[in] effect A pointer to a newly allocated Dali resource.
*/
- explicit DALI_INTERNAL Shader( Internal::Shader* effect );
+ explicit DALI_INTERNAL Shader(Internal::Shader* effect);
};
/**