Finished first pass BeginRenderPass.
This commit is contained in:
@@ -123,50 +123,51 @@
|
||||
<ClInclude Include="include\Core\JulietInit.h"/>
|
||||
<ClInclude Include="include\Core\Logging\LogManager.h"/>
|
||||
<ClInclude Include="include\Core\Logging\LogTypes.h"/>
|
||||
<ClInclude Include="include\Core\Memory\Allocator.h"/>
|
||||
<ClInclude Include="include\Core\Memory\Utils.h"/>
|
||||
<ClInclude Include="include\Core\Networking\IPAddress.h"/>
|
||||
<ClInclude Include="include\Core\Networking\NetworkPacket.h"/>
|
||||
<ClInclude Include="include\Core\Networking\Socket.h"/>
|
||||
<ClInclude Include="include\Core\Networking\SocketHandle.h"/>
|
||||
<ClInclude Include="include\Core\Networking\TcpListener.h"/>
|
||||
<ClInclude Include="include\Core\Networking\TcpSocket.h"/>
|
||||
<ClInclude Include="include\Core\Thread\Thread.h"/>
|
||||
<ClInclude Include="include\Engine\Class.h"/>
|
||||
<ClInclude Include="include\Engine\Engine.h"/>
|
||||
<ClInclude Include="include\Graphics\Colors.h"/>
|
||||
<ClInclude Include="include\Graphics\Graphics.h"/>
|
||||
<ClInclude Include="include\Graphics\GraphicsConfig.h"/>
|
||||
<ClInclude Include="include\Graphics\RenderPass.h"/>
|
||||
<ClInclude Include="include\Graphics\Texture.h"/>
|
||||
<ClInclude Include="include\Juliet.h"/>
|
||||
<ClInclude Include="include\pch.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Display\DisplayDevice.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Display\Display_Private.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Display\Win32\Win32DisplayEvent.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Display\Win32\Win32Window.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Display\Window.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Event\KeyboardMapping.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Event\Keyboard_Private.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Event\Mouse_Private.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Event\Win32ScanCode.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Event\WindowEvent.h"/>
|
||||
<ClInclude Include="src\Core\Networking\SocketPlatformImpl.h"/>
|
||||
<ClInclude Include="src\Core\HAL\Win32.h"/>
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12Common.h"/>
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12RenderPass.h"/>
|
||||
<ClInclude Include="include\Core\Math\Shape.h" />
|
||||
<ClInclude Include="include\Core\Memory\Allocator.h" />
|
||||
<ClInclude Include="include\Core\Memory\Utils.h" />
|
||||
<ClInclude Include="include\Core\Networking\IPAddress.h" />
|
||||
<ClInclude Include="include\Core\Networking\NetworkPacket.h" />
|
||||
<ClInclude Include="include\Core\Networking\Socket.h" />
|
||||
<ClInclude Include="include\Core\Networking\SocketHandle.h" />
|
||||
<ClInclude Include="include\Core\Networking\TcpListener.h" />
|
||||
<ClInclude Include="include\Core\Networking\TcpSocket.h" />
|
||||
<ClInclude Include="include\Core\Thread\Thread.h" />
|
||||
<ClInclude Include="include\Engine\Class.h" />
|
||||
<ClInclude Include="include\Engine\Engine.h" />
|
||||
<ClInclude Include="include\Graphics\Colors.h" />
|
||||
<ClInclude Include="include\Graphics\Graphics.h" />
|
||||
<ClInclude Include="include\Graphics\GraphicsConfig.h" />
|
||||
<ClInclude Include="include\Graphics\RenderPass.h" />
|
||||
<ClInclude Include="include\Graphics\Texture.h" />
|
||||
<ClInclude Include="include\Juliet.h" />
|
||||
<ClInclude Include="include\pch.h" />
|
||||
<ClInclude Include="src\Core\HAL\Display\DisplayDevice.h" />
|
||||
<ClInclude Include="src\Core\HAL\Display\Display_Private.h" />
|
||||
<ClInclude Include="src\Core\HAL\Display\Win32\Win32DisplayEvent.h" />
|
||||
<ClInclude Include="src\Core\HAL\Display\Win32\Win32Window.h" />
|
||||
<ClInclude Include="src\Core\HAL\Display\Window.h" />
|
||||
<ClInclude Include="src\Core\HAL\Event\KeyboardMapping.h" />
|
||||
<ClInclude Include="src\Core\HAL\Event\Keyboard_Private.h" />
|
||||
<ClInclude Include="src\Core\HAL\Event\Mouse_Private.h" />
|
||||
<ClInclude Include="src\Core\HAL\Event\Win32ScanCode.h" />
|
||||
<ClInclude Include="src\Core\HAL\Event\WindowEvent.h" />
|
||||
<ClInclude Include="src\Core\Networking\SocketPlatformImpl.h" />
|
||||
<ClInclude Include="src\Core\HAL\Win32.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12Common.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12RenderPass.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12Synchronization.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12Texture.h"/>
|
||||
<ClInclude Include="src\Graphics\D3D12\DX12CommandList.h"/>
|
||||
<ClInclude Include="src\Graphics\D3D12\DX12GraphicsDevice.h"/>
|
||||
<ClInclude Include="src\Graphics\D3D12\DX12Includes.h"/>
|
||||
<ClInclude Include="src\Graphics\D3D12\DX12SwapChain.h"/>
|
||||
<ClInclude Include="src\Graphics\D3D12\DX12Utils.h"/>
|
||||
<ClInclude Include="src\Graphics\GraphicsDevice.h"/>
|
||||
<ClInclude Include="src\Graphics\D3D12\D3D12Texture.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\DX12CommandList.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\DX12GraphicsDevice.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\DX12Includes.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\DX12SwapChain.h" />
|
||||
<ClInclude Include="src\Graphics\D3D12\DX12Utils.h" />
|
||||
<ClInclude Include="src\Graphics\GraphicsDevice.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Core\Application\ApplicationManager.cpp"/>
|
||||
<ClCompile Include="src\Core\Common\CoreUtils.cpp"/>
|
||||
<ClCompile Include="src\Core\Application\ApplicationManager.cpp" />
|
||||
<ClCompile Include="src\Core\Common\CoreUtils.cpp" />
|
||||
<ClCompile Include="src\Core\DynLib\Win32\DynamicLibrary.cpp">
|
||||
<RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary>
|
||||
<Optimization>Disabled</Optimization>
|
||||
@@ -221,32 +222,32 @@
|
||||
<MSCVersion>Default</MSCVersion>
|
||||
<AdditionalOptions>--target=amd64-pc-windows-msvc</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Core\HAL\Display\Display.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32DisplayDevice.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32DisplayEvent.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32Window.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Event\Keyboard.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Event\KeyboardMapping.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Event\Mouse.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Event\SystemEvent.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Event\WindowEvent.cpp"/>
|
||||
<ClCompile Include="src\Core\Juliet.cpp"/>
|
||||
<ClCompile Include="src\Core\Logging\LogManager.cpp"/>
|
||||
<ClCompile Include="src\Core\Memory\Allocator.cpp"/>
|
||||
<ClCompile Include="src\Core\Networking\NetworkPacket.cpp"/>
|
||||
<ClCompile Include="src\Core\Networking\Socket.cpp"/>
|
||||
<ClCompile Include="src\Core\Networking\TcpListener.cpp"/>
|
||||
<ClCompile Include="src\Core\Networking\TcpSocket.cpp"/>
|
||||
<ClCompile Include="src\Core\Networking\Win32\Win32SocketPlatformImpl.cpp"/>
|
||||
<ClCompile Include="src\Engine\Engine.cpp"/>
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12Common.cpp"/>
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12RenderPass.cpp"/>
|
||||
<ClCompile Include="src\Core\HAL\Display\Display.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32DisplayDevice.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32DisplayEvent.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Display\Win32\Win32Window.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Event\Keyboard.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Event\KeyboardMapping.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Event\Mouse.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Event\SystemEvent.cpp" />
|
||||
<ClCompile Include="src\Core\HAL\Event\WindowEvent.cpp" />
|
||||
<ClCompile Include="src\Core\Juliet.cpp" />
|
||||
<ClCompile Include="src\Core\Logging\LogManager.cpp" />
|
||||
<ClCompile Include="src\Core\Memory\Allocator.cpp" />
|
||||
<ClCompile Include="src\Core\Networking\NetworkPacket.cpp" />
|
||||
<ClCompile Include="src\Core\Networking\Socket.cpp" />
|
||||
<ClCompile Include="src\Core\Networking\TcpListener.cpp" />
|
||||
<ClCompile Include="src\Core\Networking\TcpSocket.cpp" />
|
||||
<ClCompile Include="src\Core\Networking\Win32\Win32SocketPlatformImpl.cpp" />
|
||||
<ClCompile Include="src\Engine\Engine.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12Common.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12RenderPass.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12Synchronization.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12Texture.cpp"/>
|
||||
<ClCompile Include="src\Graphics\D3D12\DX12CommandList.cpp"/>
|
||||
<ClCompile Include="src\Graphics\D3D12\DX12GraphicsDevice.cpp"/>
|
||||
<ClCompile Include="src\Graphics\D3D12\DX12SwapChain.cpp"/>
|
||||
<ClCompile Include="src\Graphics\D3D12\DX12Utils.cpp"/>
|
||||
<ClCompile Include="src\Graphics\D3D12\D3D12Texture.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\DX12CommandList.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\DX12GraphicsDevice.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\DX12SwapChain.cpp" />
|
||||
<ClCompile Include="src\Graphics\D3D12\DX12Utils.cpp" />
|
||||
<ClCompile Include="src\Graphics\Graphics.cpp">
|
||||
<RuntimeLibrary>MultiThreadedDebugDll</RuntimeLibrary>
|
||||
<Optimization>Disabled</Optimization>
|
||||
@@ -307,8 +308,8 @@
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="include\Core\Thread\Mutex.h"/>
|
||||
<Content Include="src\TODO.txt"/>
|
||||
<Content Include="include\Core\Thread\Mutex.h" />
|
||||
<Content Include="src\TODO.txt" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets"/>
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
||||
12
Juliet/include/Core/Math/Shape.h
Normal file
12
Juliet/include/Core/Math/Shape.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
namespace Juliet
|
||||
{
|
||||
struct Rectangle
|
||||
{
|
||||
int32 X;
|
||||
int32 Y;
|
||||
int32 Width;
|
||||
int32 Height;
|
||||
};
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <core/Common/NonNullPtr.h>
|
||||
#include <Core/Common/NonNullPtr.h>
|
||||
#include <Core/HAL/Display/Display.h>
|
||||
#include <Core/Math/Shape.h>
|
||||
#include <Graphics/GraphicsConfig.h>
|
||||
#include <Graphics/RenderPass.h>
|
||||
#include <Juliet.h>
|
||||
@@ -67,6 +68,16 @@ namespace Juliet
|
||||
Immediate
|
||||
};
|
||||
|
||||
struct GraphicsViewPort
|
||||
{
|
||||
float X;
|
||||
float Y;
|
||||
float Width;
|
||||
float Height;
|
||||
float MinDepth;
|
||||
float MaxDepth;
|
||||
};
|
||||
|
||||
extern JULIET_API GraphicsDevice* CreateGraphicsDevice(GraphicsConfig config);
|
||||
extern JULIET_API void DestroyGraphicsDevice(NonNullPtr<GraphicsDevice> device);
|
||||
|
||||
@@ -86,4 +97,9 @@ namespace Juliet
|
||||
extern JULIET_API RenderPass* BeginRenderPass(NonNullPtr<CommandList> commandList, ColorTargetInfo& colorTargetInfo);
|
||||
extern JULIET_API RenderPass* BeginRenderPass(NonNullPtr<CommandList> commandList,
|
||||
NonNullPtr<const ColorTargetInfo> colorTargetInfos, uint32 colorTargetInfoCount);
|
||||
|
||||
extern JULIET_API void SetGraphicsViewPort(NonNullPtr<RenderPass> renderPass, const GraphicsViewPort& viewPort);
|
||||
extern JULIET_API void SetScissorRect(NonNullPtr<RenderPass> renderPass, const Rectangle& rectangle);
|
||||
extern JULIET_API void SetBlendConstants(NonNullPtr<RenderPass> renderPass, FColor blendConstants);
|
||||
extern JULIET_API void SetStencilReference(NonNullPtr<RenderPass> renderPass, uint8 reference);
|
||||
} // namespace Juliet
|
||||
|
||||
@@ -22,17 +22,23 @@ namespace Juliet
|
||||
|
||||
struct ColorTargetInfo
|
||||
{
|
||||
Texture* Texture;
|
||||
uint32 MipLevel;
|
||||
Texture* TargetTexture;
|
||||
uint32 MipLevel;
|
||||
union
|
||||
{
|
||||
uint32 DepthPlane;
|
||||
uint32 LayerCount;
|
||||
uint32 LayerIndex;
|
||||
};
|
||||
bool CycleTexture; // Whether the texture should be cycled if already bound (and load operation != LOAD)
|
||||
|
||||
Texture* ResolveTexture;
|
||||
uint32 ResolveMipLevel;
|
||||
uint32 ResolveLayerIndex;
|
||||
bool CycleResolveTexture;
|
||||
|
||||
FColor ClearColor;
|
||||
LoadOperation LoadOperation;
|
||||
StoreOperation StoreOperation;
|
||||
bool Cycle; // Whether the texture should be cycled if already bound (and load operation != LOAD)
|
||||
};
|
||||
|
||||
// Opaque Type
|
||||
|
||||
@@ -9,14 +9,14 @@ namespace Juliet::D3D12
|
||||
{
|
||||
void BeginRenderPass(NonNullPtr<CommandList> commandList, NonNullPtr<const ColorTargetInfo> colorTargetInfos, uint32 colorTargetInfoCount)
|
||||
{
|
||||
auto d3d12CommandList = reinterpret_cast<D3D12CommandList*>(commandList.Get());
|
||||
auto* d3d12CommandList = reinterpret_cast<D3D12CommandList*>(commandList.Get());
|
||||
|
||||
uint32 frameBufferWidth = uint32Max;
|
||||
uint32 frameBufferHeight = uint32Max;
|
||||
|
||||
for (uint32 idx = 0; idx < colorTargetInfoCount; ++idx)
|
||||
{
|
||||
auto* container = reinterpret_cast<D3D12TextureContainer*>(colorTargetInfos[idx].Texture);
|
||||
auto* container = reinterpret_cast<D3D12TextureContainer*>(colorTargetInfos[idx].TargetTexture);
|
||||
uint32 width = container->Header.CreateInfo.Width >> colorTargetInfos[idx].MipLevel;
|
||||
uint32 height = container->Header.CreateInfo.Height >> colorTargetInfos[idx].MipLevel;
|
||||
|
||||
@@ -30,11 +30,11 @@ namespace Juliet::D3D12
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE RTVs[GPUDriver::kMaxColorTargetInfo];
|
||||
for (uint32 idx = 0; idx < colorTargetInfoCount; ++idx)
|
||||
{
|
||||
auto* container = reinterpret_cast<D3D12TextureContainer*>(colorTargetInfos[idx].Texture);
|
||||
auto* container = reinterpret_cast<D3D12TextureContainer*>(colorTargetInfos[idx].TargetTexture);
|
||||
D3D12TextureSubresource* subresource = PrepareTextureSubresourceForWrite(
|
||||
d3d12CommandList, container,
|
||||
container->Header.CreateInfo.Type == TextureType::Texture_3D ? 0 : colorTargetInfos[idx].LayerCount,
|
||||
colorTargetInfos[idx].MipLevel, colorTargetInfos[idx].Cycle, D3D12_RESOURCE_STATE_RENDER_TARGET);
|
||||
container->Header.CreateInfo.Type == TextureType::Texture_3D ? 0 : colorTargetInfos[idx].LayerIndex,
|
||||
colorTargetInfos[idx].MipLevel, colorTargetInfos[idx].CycleTexture, D3D12_RESOURCE_STATE_RENDER_TARGET);
|
||||
|
||||
uint32 RTVIndex = container->Header.CreateInfo.Type == TextureType::Texture_3D ? colorTargetInfos[idx].DepthPlane : 0;
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE rtv = subresource->RTVHandles[RTVIndex].CpuHandle;
|
||||
@@ -47,11 +47,64 @@ namespace Juliet::D3D12
|
||||
clearColor[2] = colorTargetInfos[idx].ClearColor.B;
|
||||
clearColor[3] = colorTargetInfos[idx].ClearColor.A;
|
||||
|
||||
ID3D12GraphicsCommandList6_ClearRenderTargetView(d3d12CommandList->GraphicsCommandList.CommandList, rtv, clearColor, 0, nullptr);
|
||||
ID3D12GraphicsCommandList6_ClearRenderTargetView(d3d12CommandList->GraphicsCommandList.CommandList, rtv,
|
||||
clearColor, 0, nullptr);
|
||||
}
|
||||
|
||||
RTVs[idx] = rtv;
|
||||
// d3d12CommandList->ColorTargetSubresources[idx] = subresource;
|
||||
RTVs[idx] = rtv;
|
||||
d3d12CommandList->ColorTargetSubresources[idx] = subresource;
|
||||
|
||||
// TODO: TrackTexture
|
||||
|
||||
if (colorTargetInfos[idx].StoreOperation == StoreOperation::Resolve ||
|
||||
colorTargetInfos[idx].StoreOperation == StoreOperation::ResolveAndStore)
|
||||
{
|
||||
auto resolveContainer = reinterpret_cast<D3D12TextureContainer*>(colorTargetInfos[idx].ResolveTexture);
|
||||
D3D12TextureSubresource* resolveSubresource =
|
||||
PrepareTextureSubresourceForWrite(d3d12CommandList, resolveContainer, colorTargetInfos[idx].ResolveLayerIndex,
|
||||
colorTargetInfos[idx].ResolveMipLevel, colorTargetInfos[idx].CycleResolveTexture,
|
||||
D3D12_RESOURCE_STATE_RESOLVE_DEST);
|
||||
|
||||
d3d12CommandList->ColorResolveSubresources[idx] = resolveSubresource;
|
||||
|
||||
// TODO: TrackTexture Resolve
|
||||
}
|
||||
}
|
||||
|
||||
// TODO DSV
|
||||
|
||||
ID3D12GraphicsCommandList_OMSetRenderTargets(d3d12CommandList->GraphicsCommandList.CommandList,
|
||||
colorTargetInfoCount, RTVs, false, nullptr);
|
||||
|
||||
// Set defaults graphics states
|
||||
GraphicsViewPort defaultViewport;
|
||||
defaultViewport.X = 0.f;
|
||||
defaultViewport.Y = 0.f;
|
||||
defaultViewport.Width = static_cast<float>(frameBufferWidth);
|
||||
defaultViewport.Height = static_cast<float>(frameBufferHeight);
|
||||
defaultViewport.MinDepth = 0.f;
|
||||
defaultViewport.MaxDepth = 1.f;
|
||||
SetViewPort(commandList, defaultViewport);
|
||||
|
||||
Rectangle defaultScissor;
|
||||
defaultScissor.X = 0;
|
||||
defaultScissor.Y = 0;
|
||||
defaultScissor.Width = static_cast<int32>(frameBufferWidth);
|
||||
defaultScissor.Height = static_cast<int32>(frameBufferHeight);
|
||||
SetScissorRect(commandList, defaultScissor);
|
||||
|
||||
SetStencilReference(commandList, 0);
|
||||
|
||||
FColor blendConstants;
|
||||
blendConstants.R = 1.0f;
|
||||
blendConstants.G = 1.0f;
|
||||
blendConstants.B = 1.0f;
|
||||
blendConstants.A = 1.0f;
|
||||
SetBlendConstants(commandList, blendConstants);
|
||||
}
|
||||
|
||||
void EndRenderPass(NonNullPtr<CommandList> commandList)
|
||||
{
|
||||
auto* d3d12CommandList = reinterpret_cast<D3D12CommandList*>(commandList.Get());
|
||||
}
|
||||
} // namespace Juliet::D3D12
|
||||
|
||||
@@ -8,4 +8,5 @@ namespace Juliet::D3D12
|
||||
{
|
||||
extern void BeginRenderPass(NonNullPtr<CommandList> commandList, NonNullPtr<const ColorTargetInfo> colorTargetInfos,
|
||||
uint32 colorTargetInfoCount);
|
||||
}
|
||||
extern void EndRenderPass(NonNullPtr<CommandList> commandList);
|
||||
} // namespace Juliet::D3D12
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <pch.h>
|
||||
|
||||
#include <Core/Common/EnumUtils.h>
|
||||
#include <Graphics/D3D12/D3D12Synchronization.h>
|
||||
#include <Graphics/D3D12/D3D12Texture.h>
|
||||
#include <Graphics/D3D12/DX12CommandList.h>
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#include <Core/Memory/Allocator.h>
|
||||
#include <Graphics/D3D12/DX12CommandList.h>
|
||||
#include <Graphics/D3D12/DX12GraphicsDevice.h>
|
||||
#define IID_PPV_ARGS(ppType) __uuidof(decltype(**(ppType))), reinterpret_cast<void**>(ppType)
|
||||
#define PPV_ARGS(x) IID_PPV_ARGS(&x)
|
||||
|
||||
namespace Juliet::D3D12
|
||||
{
|
||||
namespace
|
||||
@@ -215,4 +214,42 @@ namespace Juliet::D3D12
|
||||
return success;
|
||||
}
|
||||
|
||||
void SetViewPort(NonNullPtr<CommandList> commandList, const GraphicsViewPort& viewPort)
|
||||
{
|
||||
auto* d3d12CommandList = reinterpret_cast<D3D12CommandList*>(commandList.Get());
|
||||
|
||||
D3D12_VIEWPORT d3d12Viewport;
|
||||
d3d12Viewport.TopLeftX = viewPort.X;
|
||||
d3d12Viewport.TopLeftY = viewPort.Y;
|
||||
d3d12Viewport.Width = viewPort.Width;
|
||||
d3d12Viewport.Height = viewPort.Height;
|
||||
d3d12Viewport.MinDepth = viewPort.MinDepth;
|
||||
d3d12Viewport.MaxDepth = viewPort.MaxDepth;
|
||||
ID3D12GraphicsCommandList_RSSetViewports(d3d12CommandList->GraphicsCommandList.CommandList, 1, &d3d12Viewport);
|
||||
}
|
||||
|
||||
void SetScissorRect(NonNullPtr<CommandList> commandList, const Rectangle& rectangle)
|
||||
{
|
||||
auto* d3d12CommandList = reinterpret_cast<D3D12CommandList*>(commandList.Get());
|
||||
D3D12_RECT scissorRect;
|
||||
scissorRect.left = rectangle.X;
|
||||
scissorRect.top = rectangle.Y;
|
||||
scissorRect.right = rectangle.X + rectangle.Width;
|
||||
scissorRect.bottom = rectangle.Y + rectangle.Height;
|
||||
ID3D12GraphicsCommandList_RSSetScissorRects(d3d12CommandList->GraphicsCommandList.CommandList, 1, &scissorRect);
|
||||
}
|
||||
|
||||
void SetBlendConstants(NonNullPtr<CommandList> commandList, FColor blendConstants)
|
||||
{
|
||||
auto* d3d12CommandList = reinterpret_cast<D3D12CommandList*>(commandList.Get());
|
||||
FLOAT blendFactor[4] = { blendConstants.R, blendConstants.G, blendConstants.B, blendConstants.A };
|
||||
ID3D12GraphicsCommandList_OMSetBlendFactor(d3d12CommandList->GraphicsCommandList.CommandList, blendFactor);
|
||||
}
|
||||
|
||||
void SetStencilReference(NonNullPtr<CommandList> commandList, uint8 reference)
|
||||
{
|
||||
auto* d3d12CommandList = reinterpret_cast<D3D12CommandList*>(commandList.Get());
|
||||
ID3D12GraphicsCommandList_OMSetStencilRef(d3d12CommandList->GraphicsCommandList.CommandList, reference);
|
||||
}
|
||||
|
||||
} // namespace Juliet::D3D12
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <Core/Common/EnumUtils.h>
|
||||
#include <Core/Common/NonNullPtr.h>
|
||||
#include <Core/Math/Shape.h>
|
||||
#include <Graphics/D3D12/DX12Includes.h>
|
||||
#include <Graphics/GraphicsDevice.h>
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace Juliet::D3D12
|
||||
// Forward Declare
|
||||
struct D3D12Driver;
|
||||
struct D3D12WindowData;
|
||||
struct D3D12TextureSubresource;
|
||||
|
||||
struct D3D12CommandListBaseData
|
||||
{
|
||||
@@ -46,8 +47,15 @@ namespace Juliet::D3D12
|
||||
D3D12GraphicsCommandListData GraphicsCommandList;
|
||||
D3D12GraphicsCommandListData ComputeCommandList;
|
||||
D3D12CopyCommandListData CopyCommandList;
|
||||
|
||||
D3D12TextureSubresource* ColorTargetSubresources[GPUDriver::kMaxColorTargetInfo];
|
||||
D3D12TextureSubresource* ColorResolveSubresources[GPUDriver::kMaxColorTargetInfo];
|
||||
};
|
||||
|
||||
extern CommandList* AcquireCommandList(NonNullPtr<GPUDriver> driver, QueueType queueType);
|
||||
extern bool SubmitCommandLists(NonNullPtr<GPUDriver> driver);
|
||||
extern void SetViewPort(NonNullPtr<CommandList> commandList, const GraphicsViewPort& viewPort);
|
||||
extern void SetScissorRect(NonNullPtr<CommandList> commandList, const Rectangle& rectangle);
|
||||
extern void SetBlendConstants(NonNullPtr<CommandList> commandList, FColor blendConstants);
|
||||
extern void SetStencilReference(NonNullPtr<CommandList> commandList, uint8 reference);
|
||||
} // namespace Juliet::D3D12
|
||||
|
||||
@@ -552,6 +552,11 @@ namespace Juliet::D3D12
|
||||
|
||||
device->BeginRenderPass = BeginRenderPass;
|
||||
|
||||
device->SetViewPort = SetViewPort;
|
||||
device->SetScissorRect = SetScissorRect;
|
||||
device->SetBlendConstants = SetBlendConstants;
|
||||
device->SetStencilReference = SetStencilReference;
|
||||
|
||||
device->Driver = driver;
|
||||
driver->GraphicsDevice = device;
|
||||
|
||||
|
||||
@@ -130,4 +130,36 @@ namespace Juliet
|
||||
return reinterpret_cast<RenderPass*>(&header->RenderPass);
|
||||
}
|
||||
|
||||
void SetGraphicsViewPort(NonNullPtr<RenderPass> renderPass, const GraphicsViewPort& viewPort)
|
||||
{
|
||||
auto* commandList = reinterpret_cast<GPUPass*>(renderPass.Get())->CommandList;
|
||||
auto* commandListHeader = reinterpret_cast<CommandListHeader*>(commandList);
|
||||
|
||||
commandListHeader->Device->SetViewPort(commandList, viewPort);
|
||||
}
|
||||
|
||||
void SetScissorRect(NonNullPtr<RenderPass> renderPass, const Rectangle& rectangle)
|
||||
{
|
||||
auto* commandList = reinterpret_cast<GPUPass*>(renderPass.Get())->CommandList;
|
||||
auto* commandListHeader = reinterpret_cast<CommandListHeader*>(commandList);
|
||||
|
||||
commandListHeader->Device->SetScissorRect(commandList, rectangle);
|
||||
}
|
||||
|
||||
void SetBlendConstants(NonNullPtr<RenderPass> renderPass, FColor blendConstants)
|
||||
{
|
||||
auto* commandList = reinterpret_cast<GPUPass*>(renderPass.Get())->CommandList;
|
||||
auto* commandListHeader = reinterpret_cast<CommandListHeader*>(commandList);
|
||||
|
||||
commandListHeader->Device->SetBlendConstants(commandList, blendConstants);
|
||||
}
|
||||
|
||||
void SetStencilReference(NonNullPtr<RenderPass> renderPass, uint8 reference)
|
||||
{
|
||||
auto* commandList = reinterpret_cast<GPUPass*>(renderPass.Get())->CommandList;
|
||||
auto* commandListHeader = reinterpret_cast<CommandListHeader*>(commandList);
|
||||
|
||||
commandListHeader->Device->SetStencilReference(commandList, reference);
|
||||
}
|
||||
|
||||
} // namespace Juliet
|
||||
|
||||
@@ -52,6 +52,11 @@ namespace Juliet
|
||||
void (*BeginRenderPass)(NonNullPtr<CommandList> commandList, NonNullPtr<const ColorTargetInfo> colorTargetInfos,
|
||||
uint32 colorTargetInfoCount);
|
||||
|
||||
void (*SetViewPort)(NonNullPtr<CommandList> commandList, const GraphicsViewPort& viewPort);
|
||||
void (*SetScissorRect)(NonNullPtr<CommandList> commandList, const Rectangle& viewPort);
|
||||
void (*SetBlendConstants)(NonNullPtr<CommandList> commandList, FColor blendConstants);
|
||||
void (*SetStencilReference)(NonNullPtr<CommandList> commandList, uint8 reference);
|
||||
|
||||
const char* Name = "Unknown";
|
||||
GPUDriver* Driver = nullptr;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user