|
@@ -12,19 +12,11 @@ namespace BansheeEngine
|
|
|
* @{
|
|
* @{
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * Technique represents a specific implementation of a shader. Contains a number of passes that will be executed when
|
|
|
|
|
- * rendering objects using this technique.
|
|
|
|
|
- *
|
|
|
|
|
- * @note
|
|
|
|
|
- * Normally you want to have a separate technique for every render system and renderer your application supports.
|
|
|
|
|
- * For example, if you are supporting DirectX11 and OpenGL you will want to have two techniques, one using HLSL based
|
|
|
|
|
- * GPU programs, other using GLSL. Those techniques should try to mirror each others end results.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Base class that is used for implementing both sim and core versions of Technique. */
|
|
|
class BS_CORE_EXPORT TechniqueBase
|
|
class BS_CORE_EXPORT TechniqueBase
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
|
- TechniqueBase(const StringID& renderAPI, const StringID& renderer);
|
|
|
|
|
|
|
+ TechniqueBase(const StringID& renderAPI, const StringID& renderer, const Vector<StringID>& tags);
|
|
|
virtual ~TechniqueBase() { }
|
|
virtual ~TechniqueBase() { }
|
|
|
|
|
|
|
|
/** Checks if this technique is supported based on current render and other systems. */
|
|
/** Checks if this technique is supported based on current render and other systems. */
|
|
@@ -36,6 +28,7 @@ namespace BansheeEngine
|
|
|
protected:
|
|
protected:
|
|
|
StringID mRenderAPI;
|
|
StringID mRenderAPI;
|
|
|
StringID mRenderer;
|
|
StringID mRenderer;
|
|
|
|
|
+ Vector<StringID> mTags;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
template<bool Core> struct TPassType { };
|
|
template<bool Core> struct TPassType { };
|
|
@@ -46,11 +39,7 @@ namespace BansheeEngine
|
|
|
template<> struct TTechniqueType < false > { typedef Technique Type; };
|
|
template<> struct TTechniqueType < false > { typedef Technique Type; };
|
|
|
template<> struct TTechniqueType < true > { typedef TechniqueCore Type; };
|
|
template<> struct TTechniqueType < true > { typedef TechniqueCore Type; };
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @copydoc TechniqueBase
|
|
|
|
|
- *
|
|
|
|
|
- * @note Templated version that is used for implementing both sim and core versions of Technique.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Templated class that is used for implementing both sim and core versions of Technique. */
|
|
|
template<bool Core>
|
|
template<bool Core>
|
|
|
class BS_CORE_EXPORT TTechnique : public TechniqueBase
|
|
class BS_CORE_EXPORT TTechnique : public TechniqueBase
|
|
|
{
|
|
{
|
|
@@ -58,7 +47,8 @@ namespace BansheeEngine
|
|
|
typedef typename TPassType<Core>::Type PassType;
|
|
typedef typename TPassType<Core>::Type PassType;
|
|
|
|
|
|
|
|
TTechnique();
|
|
TTechnique();
|
|
|
- TTechnique(const StringID& renderAPI, const StringID& renderer, const Vector<SPtr<PassType>>& passes);
|
|
|
|
|
|
|
+ TTechnique(const StringID& renderAPI, const StringID& renderer, const Vector<StringID>& tags,
|
|
|
|
|
+ const Vector<SPtr<PassType>>& passes);
|
|
|
virtual ~TTechnique() { }
|
|
virtual ~TTechnique() { }
|
|
|
|
|
|
|
|
/** Returns a pass with the specified index. */
|
|
/** Returns a pass with the specified index. */
|
|
@@ -77,18 +67,20 @@ namespace BansheeEngine
|
|
|
* @{
|
|
* @{
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * @copydoc TechniqueBase
|
|
|
|
|
- *
|
|
|
|
|
- * @note Core thread.
|
|
|
|
|
- */
|
|
|
|
|
|
|
+ /** Core thread version of Technique. */
|
|
|
class BS_CORE_EXPORT TechniqueCore : public CoreObjectCore, public TTechnique<true>
|
|
class BS_CORE_EXPORT TechniqueCore : public CoreObjectCore, public TTechnique<true>
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
|
- TechniqueCore(const StringID& renderAPI, const StringID& renderer, const Vector<SPtr<PassCore>>& passes);
|
|
|
|
|
|
|
+ TechniqueCore(const StringID& renderAPI, const StringID& renderer, const Vector<StringID>& tags,
|
|
|
|
|
+ const Vector<SPtr<PassCore>>& passes);
|
|
|
|
|
+
|
|
|
|
|
+ /** @copydoc Technique::create(const StringID&, const StringID&, const Vector<SPtr<Pass>>&) */
|
|
|
|
|
+ static SPtr<TechniqueCore> create(const StringID& renderAPI, const StringID& renderer,
|
|
|
|
|
+ const Vector<SPtr<PassCore>>& passes);
|
|
|
|
|
|
|
|
- /** Creates a new technique. */
|
|
|
|
|
- static SPtr<TechniqueCore> create(const StringID& renderAPI, const StringID& renderer, const Vector<SPtr<PassCore>>& passes);
|
|
|
|
|
|
|
+ /** @copydoc Technique::create(const StringID&, const StringID&, const Vector<StringID>&, const Vector<SPtr<Pass>>&) */
|
|
|
|
|
+ static SPtr<TechniqueCore> create(const StringID& renderAPI, const StringID& renderer, const Vector<StringID>& tags,
|
|
|
|
|
+ const Vector<SPtr<PassCore>>& passes);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** @} */
|
|
/** @} */
|
|
@@ -97,21 +89,51 @@ namespace BansheeEngine
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @copydoc TechniqueBase
|
|
|
|
|
|
|
+ * Technique is a set of shading passes bindable to the GPU pipeline. Each technique can also have a set of properties
|
|
|
|
|
+ * that help the engine to determine which technique should be used under which circumstances (if more than one
|
|
|
|
|
+ * technique is available).
|
|
|
*
|
|
*
|
|
|
- * @note Sim thread.
|
|
|
|
|
|
|
+ * @note
|
|
|
|
|
+ * Normally you want to have a separate technique for every render system and renderer your application supports.
|
|
|
|
|
+ * For example, if you are supporting DirectX11 and OpenGL you will want to have two techniques, one using HLSL based
|
|
|
|
|
+ * GPU programs, other using GLSL. Those techniques should try to mirror each other's end results.
|
|
|
*/
|
|
*/
|
|
|
class BS_CORE_EXPORT Technique : public IReflectable, public CoreObject, public TTechnique<false>
|
|
class BS_CORE_EXPORT Technique : public IReflectable, public CoreObject, public TTechnique<false>
|
|
|
{
|
|
{
|
|
|
public:
|
|
public:
|
|
|
- Technique(const StringID& renderAPI, const StringID& renderer, const Vector<SPtr<Pass>>& passes);
|
|
|
|
|
|
|
+ Technique(const StringID& renderAPI, const StringID& renderer, const Vector<StringID>& tags,
|
|
|
|
|
+ const Vector<SPtr<Pass>>& passes);
|
|
|
|
|
|
|
|
/** Retrieves an implementation of a technique usable only from the core thread. */
|
|
/** Retrieves an implementation of a technique usable only from the core thread. */
|
|
|
SPtr<TechniqueCore> getCore() const;
|
|
SPtr<TechniqueCore> getCore() const;
|
|
|
|
|
|
|
|
- /** Creates a new technique. */
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Creates a new technique.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param[in] renderAPI Render API the technique supports. Under normal circumstances the engine will not use
|
|
|
|
|
+ * this technique unless this API is enabled.
|
|
|
|
|
+ * @param[in] renderer Renderer the technique supports. Under normal circumstances the engine will not use
|
|
|
|
|
+ * this technique unless this renderer is enabled.
|
|
|
|
|
+ * @param[in] passes A set of passes that define the technique.
|
|
|
|
|
+ * @return Newly creted technique.
|
|
|
|
|
+ */
|
|
|
static SPtr<Technique> create(const StringID& renderAPI, const StringID& renderer, const Vector<SPtr<Pass>>& passes);
|
|
static SPtr<Technique> create(const StringID& renderAPI, const StringID& renderer, const Vector<SPtr<Pass>>& passes);
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Creates a new technique.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param[in] renderAPI Render API the technique supports. Under normal circumstances the engine will not use
|
|
|
|
|
+ * this technique unless this API is enabled.
|
|
|
|
|
+ * @param[in] renderer Renderer the technique supports. Under normal circumstances the engine will not use
|
|
|
|
|
+ * this technique unless this renderer is enabled.
|
|
|
|
|
+ * @param[in] tags An optional set of tags that can be used for further identifying under which
|
|
|
|
|
+ * circumstances should a technique be used.
|
|
|
|
|
+ * @param[in] passes A set of passes that define the technique.
|
|
|
|
|
+ * @return Newly creted technique.
|
|
|
|
|
+ */
|
|
|
|
|
+ static SPtr<Technique> create(const StringID& renderAPI, const StringID& renderer, const Vector<StringID>& tags,
|
|
|
|
|
+ const Vector<SPtr<Pass>>& passes);
|
|
|
|
|
+
|
|
|
protected:
|
|
protected:
|
|
|
/** @copydoc CoreObject::createCore */
|
|
/** @copydoc CoreObject::createCore */
|
|
|
SPtr<CoreObjectCore> createCore() const override;
|
|
SPtr<CoreObjectCore> createCore() const override;
|
|
@@ -133,7 +155,7 @@ namespace BansheeEngine
|
|
|
public:
|
|
public:
|
|
|
friend class TechniqueRTTI;
|
|
friend class TechniqueRTTI;
|
|
|
static RTTITypeBase* getRTTIStatic();
|
|
static RTTITypeBase* getRTTIStatic();
|
|
|
- virtual RTTITypeBase* getRTTI() const override;
|
|
|
|
|
|
|
+ RTTITypeBase* getRTTI() const override;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
/** @} */
|
|
/** @} */
|