summaryrefslogtreecommitdiffstats
path: root/tools/render-test
diff options
context:
space:
mode:
Diffstat (limited to 'tools/render-test')
-rw-r--r--tools/render-test/render-test-main.cpp20
-rw-r--r--tools/render-test/shader-input-layout.cpp26
-rw-r--r--tools/render-test/shader-input-layout.h6
-rw-r--r--tools/render-test/shader-renderer-util.cpp4
4 files changed, 29 insertions, 27 deletions
diff --git a/tools/render-test/render-test-main.cpp b/tools/render-test/render-test-main.cpp
index 7c65da5e7..3f26f6d9b 100644
--- a/tools/render-test/render-test-main.cpp
+++ b/tools/render-test/render-test-main.cpp
@@ -539,9 +539,9 @@ SlangResult RenderTestApp::initialize(
// fixed/known set of attributes.
//
const InputElementDesc inputElements[] = {
- { "A", 0, Format::RGB_Float32, offsetof(Vertex, position) },
- { "A", 1, Format::RGB_Float32, offsetof(Vertex, color) },
- { "A", 2, Format::RG_Float32, offsetof(Vertex, uv) },
+ { "A", 0, Format::R32G32B32_FLOAT, offsetof(Vertex, position) },
+ { "A", 1, Format::R32G32B32_FLOAT, offsetof(Vertex, color) },
+ { "A", 2, Format::R32G32_FLOAT, offsetof(Vertex, uv) },
};
ComPtr<IInputLayout> inputLayout;
@@ -600,7 +600,7 @@ void RenderTestApp::_initializeRenderPass()
depthBufferDesc.size.height = gWindowHeight;
depthBufferDesc.size.depth = 1;
depthBufferDesc.numMipLevels = 1;
- depthBufferDesc.format = Format::D_Float32;
+ depthBufferDesc.format = Format::D32_FLOAT;
depthBufferDesc.defaultState = ResourceState::DepthWrite;
depthBufferDesc.allowedStates = ResourceState::DepthWrite;
@@ -613,14 +613,14 @@ void RenderTestApp::_initializeRenderPass()
colorBufferDesc.size.height = gWindowHeight;
colorBufferDesc.size.depth = 1;
colorBufferDesc.numMipLevels = 1;
- colorBufferDesc.format = Format::RGBA_Unorm_UInt8;
+ colorBufferDesc.format = Format::R8G8B8A8_UNORM;
colorBufferDesc.defaultState = ResourceState::RenderTarget;
colorBufferDesc.allowedStates = ResourceState::RenderTarget;
m_colorBuffer = m_device->createTextureResource(colorBufferDesc, nullptr);
gfx::IResourceView::Desc colorBufferViewDesc;
memset(&colorBufferViewDesc, 0, sizeof(colorBufferViewDesc));
- colorBufferViewDesc.format = gfx::Format::RGBA_Unorm_UInt8;
+ colorBufferViewDesc.format = gfx::Format::R8G8B8A8_UNORM;
colorBufferViewDesc.renderTarget.shape = gfx::IResource::Type::Texture2D;
colorBufferViewDesc.type = gfx::IResourceView::Type::RenderTarget;
ComPtr<gfx::IResourceView> rtv =
@@ -628,14 +628,14 @@ void RenderTestApp::_initializeRenderPass()
gfx::IResourceView::Desc depthBufferViewDesc;
memset(&depthBufferViewDesc, 0, sizeof(depthBufferViewDesc));
- depthBufferViewDesc.format = gfx::Format::D_Float32;
+ depthBufferViewDesc.format = gfx::Format::D32_FLOAT;
depthBufferViewDesc.renderTarget.shape = gfx::IResource::Type::Texture2D;
depthBufferViewDesc.type = gfx::IResourceView::Type::DepthStencil;
ComPtr<gfx::IResourceView> dsv =
m_device->createTextureView(depthBufferResource.get(), depthBufferViewDesc);
- IFramebufferLayout::AttachmentLayout colorAttachment = {gfx::Format::RGBA_Unorm_UInt8, 1};
- IFramebufferLayout::AttachmentLayout depthAttachment = {gfx::Format::D_Float32, 1};
+ IFramebufferLayout::AttachmentLayout colorAttachment = {gfx::Format::R8G8B8A8_UNORM, 1};
+ IFramebufferLayout::AttachmentLayout depthAttachment = {gfx::Format::D32_FLOAT, 1};
gfx::IFramebufferLayout::Desc framebufferLayoutDesc;
framebufferLayoutDesc.renderTargetCount = 1;
framebufferLayoutDesc.renderTargets = &colorAttachment;
@@ -703,7 +703,7 @@ void RenderTestApp::_initializeAccelerationStructure()
geomDesc.content.triangles.indexFormat = Format::Unknown;
geomDesc.content.triangles.vertexCount = kVertexCount;
geomDesc.content.triangles.vertexData = vertexBuffer->getDeviceAddress();
- geomDesc.content.triangles.vertexFormat = Format::RGB_Float32;
+ geomDesc.content.triangles.vertexFormat = Format::R32G32B32_FLOAT;
geomDesc.content.triangles.vertexStride = sizeof(Vertex);
geomDesc.content.triangles.transform3x4 = transformBuffer->getDeviceAddress();
accelerationStructureBuildInputs.geometryDescs = &geomDesc;
diff --git a/tools/render-test/shader-input-layout.cpp b/tools/render-test/shader-input-layout.cpp
index 7e6d290c8..7aef0025f 100644
--- a/tools/render-test/shader-input-layout.cpp
+++ b/tools/render-test/shader-input-layout.cpp
@@ -19,7 +19,7 @@ namespace renderer_test
Format _getFormatFromName(const UnownedStringSlice& slice)
{
-#define SLANG_FORMAT_CASE(name, size) if (slice == #name) return Format::name; else
+#define SLANG_FORMAT_CASE(name, blockSizeInBytes, pixelsPerBlock) if (slice == #name) return Format::name; else
GFX_FORMAT(SLANG_FORMAT_CASE)
return Format::Unknown;
@@ -1091,19 +1091,19 @@ namespace renderer_test
void generateTextureData(TextureData& output, const InputTextureDesc& desc)
{
- const gfx::FormatInfo formatInfo = gfxGetFormatInfo(desc.format);
-
+ gfx::FormatInfo formatInfo;
+ gfxGetFormatInfo(desc.format, &formatInfo);
switch (desc.format)
{
- case Format::RGBA_Unorm_UInt8:
+ case Format::R8G8B8A8_UNORM:
{
generateTextureDataRGB8(output, desc);
break;
}
- case Format::R_Float16:
- case Format::RG_Float16:
- case Format::RGBA_Float16:
+ case Format::R16_FLOAT:
+ case Format::R16G16_FLOAT:
+ case Format::R16G16B16A16_FLOAT:
{
TextureData work;
generateTextureDataRGB8(work, desc);
@@ -1176,11 +1176,11 @@ namespace renderer_test
}
break;
}
- case Format::R_Float32:
- case Format::RG_Float32:
- case Format::RGB_Float32:
- case Format::RGBA_Float32:
- case Format::D_Float32:
+ case Format::R32_FLOAT:
+ case Format::R32G32_FLOAT:
+ case Format::R32G32B32_FLOAT:
+ case Format::R32G32B32A32_FLOAT:
+ case Format::D32_FLOAT:
{
TextureData work;
generateTextureDataRGB8(work, desc);
@@ -1285,7 +1285,7 @@ namespace renderer_test
if (arrLen == 0)
arrLen = 1;
- output.init(Format::RGBA_Unorm_UInt8);
+ output.init(Format::R8G8B8A8_UNORM);
//List<List<unsigned int>>& dataBuffer = output.dataBuffer;
int arraySize = arrLen;
diff --git a/tools/render-test/shader-input-layout.h b/tools/render-test/shader-input-layout.h
index fe835a7f1..78d545114 100644
--- a/tools/render-test/shader-input-layout.h
+++ b/tools/render-test/shader-input-layout.h
@@ -41,7 +41,7 @@ struct InputTextureDesc
int size = 4;
int mipMapCount = 0; ///< 0 means the maximum number of mips will be bound
- Format format = Format::RGBA_Unorm_UInt8;
+ Format format = Format::R8G8B8A8_UNORM;
InputTextureContent content = InputTextureContent::One;
};
@@ -111,7 +111,9 @@ struct TextureData
{
clearSlices();
- m_formatSize = uint8_t(gfxGetFormatSize(format));
+ FormatInfo formatSizeInfo;
+ gfxGetFormatInfo(format, &formatSizeInfo);
+ m_formatSize = uint8_t(formatSizeInfo.blockSizeInBytes / formatSizeInfo.pixelsPerBlock);
m_format = format;
}
diff --git a/tools/render-test/shader-renderer-util.cpp b/tools/render-test/shader-renderer-util.cpp
index e12a538b3..bbc000594 100644
--- a/tools/render-test/shader-renderer-util.cpp
+++ b/tools/render-test/shader-renderer-util.cpp
@@ -29,8 +29,8 @@ using Slang::Result;
{
ITextureResource::Desc textureResourceDesc = {};
- // Default to RGBA_Unorm_UInt8
- const Format format = (inputDesc.format == Format::Unknown) ? Format::RGBA_Unorm_UInt8 : inputDesc.format;
+ // Default to R8G8B8A8_UNORM
+ const Format format = (inputDesc.format == Format::Unknown) ? Format::R8G8B8A8_UNORM : inputDesc.format;
textureResourceDesc.format = format;
textureResourceDesc.numMipLevels = texData.m_mipLevels;