mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 00:47:13 +00:00
Implement 3D textures and views creation on D3D12 backend
This change also adds a very simple end2end test to verify that we can create 3D textures and views. But we can't do anything with them (like copy, sampling, rendering, etc) currently. I will implement 3d textures and views creation on other backend in one patch if the simple end2end test is OK. Bug: dawn:547 Change-Id: I1662458de563cc4b47040a8bc3e94d7a8e0109e5 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/39843 Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Yunchao He <yunchao.he@intel.com>
This commit is contained in:
committed by
Commit Bot service account
parent
dd988bca84
commit
04242a063e
@@ -45,6 +45,20 @@ namespace {
|
||||
return device.CreateTexture(&descriptor);
|
||||
}
|
||||
|
||||
wgpu::Texture Create3DTexture(wgpu::Device device,
|
||||
wgpu::Extent3D size,
|
||||
uint32_t mipLevelCount,
|
||||
wgpu::TextureUsage usage) {
|
||||
wgpu::TextureDescriptor descriptor;
|
||||
descriptor.dimension = wgpu::TextureDimension::e3D;
|
||||
descriptor.size = size;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = kDefaultFormat;
|
||||
descriptor.mipLevelCount = mipLevelCount;
|
||||
descriptor.usage = usage;
|
||||
return device.CreateTexture(&descriptor);
|
||||
}
|
||||
|
||||
wgpu::ShaderModule CreateDefaultVertexShaderModule(wgpu::Device device) {
|
||||
return utils::CreateShaderModule(device, utils::SingleShaderStage::Vertex, R"(
|
||||
#version 450
|
||||
@@ -678,3 +692,13 @@ DAWN_INSTANTIATE_TEST(TextureViewTest,
|
||||
OpenGLBackend(),
|
||||
OpenGLESBackend(),
|
||||
VulkanBackend());
|
||||
|
||||
class TextureView3DTest : public DawnTest {};
|
||||
|
||||
// Test that 3D textures and 3D texture views can be created successfully
|
||||
TEST_P(TextureView3DTest, BasicTest) {
|
||||
wgpu::Texture texture = Create3DTexture(device, {4, 4, 4}, 3, wgpu::TextureUsage::Sampled);
|
||||
wgpu::TextureView view = texture.CreateView();
|
||||
}
|
||||
|
||||
DAWN_INSTANTIATE_TEST(TextureView3DTest, D3D12Backend());
|
||||
|
||||
Reference in New Issue
Block a user