trace.EnableLogging(false);
}
+void TestGraphicsController::SetResourceBindingHints(const std::vector<Graphics::SceneResourceBinding>& resourceBindings)
+{
+ mCallStack.PushCall("SetResourceBindingHints", "");
+}
+
void TestGraphicsController::SubmitCommandBuffers(const Graphics::SubmitInfo& submitInfo)
{
TraceCallStack::NamedParams namedParams;
return mGraphicsSyncImpl;
}
+ void SetResourceBindingHints(const std::vector<Graphics::SceneResourceBinding>& resourceBindings) override;
+
void SubmitCommandBuffers(const Graphics::SubmitInfo& submitInfo) override;
/**
*/
virtual ~Controller() = default;
+ /**
+ * @brief Sets resource binding hints for the scene
+ *
+ * Backend may choose to allocate memory for the resources.
+ */
+ virtual void SetResourceBindingHints(const std::vector<SceneResourceBinding>& resourceBindings) = 0;
+
/**
* @brief Submits array of command buffers
*
struct TextureResourceBindingInfo;
struct SamplerResourceBindingInfo;
-struct CommandBufferResourceBinding
+struct SceneResourceBinding
{
ResourceType type; ///< Type of resource
{
CommandBufferUsageFlags usage;
- std::vector<CommandBufferResourceBinding>* resourceBindings{nullptr}; ///< Sets resource binding hints
- const RenderPass* renderPass{nullptr};
- const RenderTarget* renderTarget{nullptr};
- auto& SetUsage(CommandBufferUsageFlags flags)
+ const RenderPass* renderPass{nullptr};
+ const RenderTarget* renderTarget{nullptr};
+ auto& SetUsage(CommandBufferUsageFlags flags)
{
usage = flags;
return *this;
template<class P, template<typename> typename U>
DefaultDeleter(const U<P>& deleter)
{
- deleteFunction = [](T* object)
- { U<P>()(static_cast<P*>(object)); };
+ deleteFunction = [](T* object) { U<P>()(static_cast<P*>(object)); };
}
/**
{
}
-void RenderAlgorithms::ResetCommandBuffer(std::vector<Graphics::CommandBufferResourceBinding>* resourceBindings)
+void RenderAlgorithms::ResetCommandBuffer()
{
// Reset main command buffer
if(!mGraphicsCommandBuffer)
}
Graphics::CommandBufferBeginInfo info;
- info.resourceBindings = resourceBindings; // set resource bindings, currently only programs
- info.usage = 0 | Graphics::CommandBufferUsageFlagBits::ONE_TIME_SUBMIT;
+ info.usage = 0 | Graphics::CommandBufferUsageFlagBits::ONE_TIME_SUBMIT;
mGraphicsCommandBuffer->Begin(info);
}
Graphics::RenderTarget* renderTarget);
/**
- * Resets main command buffer (per scene)
- *
- * @param[in] bindings list of resource bindings (optional, can be null)
+ * Resets main command buffer
*/
- void ResetCommandBuffer(std::vector<Graphics::CommandBufferResourceBinding>* bindings);
+ void ResetCommandBuffer();
/**
- * Submits main command buffer (per scene)
+ * Submits main command buffer
*/
void SubmitCommandBuffer();
{
mImpl->graphicsController.EnableDepthStencilBuffer(*sceneObject->GetSurfaceRenderTarget(), sceneNeedsDepthBuffer, sceneNeedsStencilBuffer);
}
- // Fill resource binding for the command buffer
- std::vector<Graphics::CommandBufferResourceBinding> commandBufferResourceBindings;
+ // Fill resource binding for the scene
+ std::vector<Graphics::SceneResourceBinding> sceneResourceBindings;
if(!programUsageCount.empty())
{
- commandBufferResourceBindings.resize(programUsageCount.size());
- auto iter = commandBufferResourceBindings.begin();
+ sceneResourceBindings.resize(programUsageCount.size());
+ auto iter = sceneResourceBindings.begin();
for(auto& item : programUsageCount)
{
iter->type = Graphics::ResourceType::PROGRAM;
++iter;
}
}
+ mImpl->graphicsController.SetResourceBindingHints(sceneResourceBindings);
// Reset main algorithms command buffer
- mImpl->renderAlgorithms.ResetCommandBuffer(commandBufferResourceBindings.empty() ? nullptr : &commandBufferResourceBindings);
+ mImpl->renderAlgorithms.ResetCommandBuffer();
auto mainCommandBuffer = mImpl->renderAlgorithms.GetMainCommandBuffer();