Replace CreateTexture2D with D3D12Texture wrapper
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "XCEngine/RHI/D3D12/D3D12RootSignature.h"
|
||||
#include "XCEngine/RHI/D3D12/D3D12PipelineState.h"
|
||||
#include "XCEngine/RHI/D3D12/D3D12Buffer.h"
|
||||
#include "XCEngine/RHI/D3D12/D3D12Texture.h"
|
||||
#include "XCEngine/RHI/D3D12/D3D12Screenshot.h"
|
||||
#include "XCEngine/Debug/Logger.h"
|
||||
#include "XCEngine/Debug/ConsoleLogSink.h"
|
||||
@@ -77,6 +78,7 @@ XCEngine::RHI::D3D12Shader gPixelShader;
|
||||
// Buffer objects
|
||||
XCEngine::RHI::D3D12Buffer gConstantBuffer; // matrices
|
||||
XCEngine::RHI::D3D12Buffer gMaterialBuffer; // material data
|
||||
XCEngine::RHI::D3D12Texture gTexture; // earth texture
|
||||
|
||||
// 同步对象
|
||||
XCEngine::RHI::D3D12Fence gFence;
|
||||
@@ -828,8 +830,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
|
||||
int imageWidth, imageHeight, imageChannel;
|
||||
stbi_uc* pixels = stbi_load("Res/Image/earth_d.jpg", &imageWidth, &imageHeight, &imageChannel, 4);
|
||||
Log("[DEBUG] Texture loaded: width=%d, height=%d, channels=%d, pixels=%p\n", imageWidth, imageHeight, imageChannel, pixels);
|
||||
ID3D12Resource* texture = CreateTexture2D(gCommandList.GetCommandList(), pixels,
|
||||
imageWidth * imageHeight * imageChannel, imageWidth, imageHeight, DXGI_FORMAT_R8G8B8A8_UNORM);
|
||||
gTexture.InitializeFromData(gDevice.GetDevice(), gCommandList.GetCommandList(), pixels,
|
||||
imageWidth, imageHeight, DXGI_FORMAT_R8G8B8A8_UNORM);
|
||||
ID3D12Resource* texture = gTexture.GetResource();
|
||||
delete[] pixels;
|
||||
ID3D12Device* d3dDevice = gDevice.GetDevice();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user