1#include "CopyResourceTask.h"
3#include "Rendering/IGraphicsDevice.h"
4#include "Rendering/IContext.h"
5#include "Rendering/ITextures.h"
7#include "Foundation/Logging/Logger.h"
10#include "Platform/Instrumentation.h"
11#include "Renderer/RenderTexture.h"
12#include "Renderer/RenderBuffer.h"
13#include "Services/Time.h"
20void Cogs::Core::CopyResourceTask::apply(RenderTaskContext * renderContext)
22 RenderInstrumentationScope(renderContext->device->getImmediateContext(), SCOPE_RENDERING,
"CopyResourceTask::apply");
24 auto device = renderContext->device;
25 auto deviceContext = device->getImmediateContext();
27 for (
auto & r : input.resources) {
28 if (r.type == RenderResourceType::RenderTexture) {
29 auto inputTexture = r.renderTexure;
30 auto outputTexture = output.get(RenderResourceType::RenderTexture)->renderTexure;
32 if (inputTexture && outputTexture) {
33 deviceContext->copyResource(outputTexture->textureHandle, inputTexture->textureHandle);
35 LOG_ERROR(logger,
"Input/output textures not valid.");
37 }
else if (r.type == RenderResourceType::RenderBuffer) {
38 auto inputBuffer = r.renderBuffer;
39 auto outputBuffer = output.get(RenderResourceType::RenderBuffer)->renderBuffer;
41 if (inputBuffer && outputBuffer) {
42 deviceContext->copyResource(outputBuffer->getHandle(destinationIndex), inputBuffer->getHandle(sourceIndex));
43 outputBuffer->setFrame(destinationIndex, renderContext->context->time->getFrame());
45 LOG_ERROR(logger,
"Input/output buffers not valid.");
Log implementation class.
constexpr Log getLogger(const char(&name)[LEN]) noexcept