summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-12-13 09:58:29 -0800
committerGitHub <noreply@github.com>2021-12-13 09:58:29 -0800
commit7c1ca35c96096cb0059f0ef23a799bf5952810c5 (patch)
tree6c130f5906f166a847ae3cde680cdbcd3c6333a0 /tools
parent3359313620cd57b8404f95cfe7b07cce514eff71 (diff)
gfx: Implement `setSamplePositions`. (#2056)
* gfx: Implement remaining resource commands on D3D12. Includes: `textureBarrier`, `copyTexture`, `uploadTextureData`, `copyTextureToBuffer`, and `textureSubresourceBarrier`. * gfx: Implement `CurrentSize` query. * gfx: Implement `setSamplePositions`. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/gfx/d3d12/render-d3d12.cpp13
-rw-r--r--tools/gfx/vulkan/render-vk.cpp14
-rw-r--r--tools/gfx/vulkan/vk-api.h1
3 files changed, 20 insertions, 8 deletions
diff --git a/tools/gfx/d3d12/render-d3d12.cpp b/tools/gfx/d3d12/render-d3d12.cpp
index 68a5b3e50..25caa84a2 100644
--- a/tools/gfx/d3d12/render-d3d12.cpp
+++ b/tools/gfx/d3d12/render-d3d12.cpp
@@ -3036,6 +3036,7 @@ public:
virtual void comFree() override { m_transientHeap.breakStrongReference(); }
public:
ComPtr<ID3D12GraphicsCommandList> m_cmdList;
+ ComPtr<ID3D12GraphicsCommandList1> m_cmdList1;
ComPtr<ID3D12GraphicsCommandList4> m_cmdList4;
BreakableReference<TransientResourceHeapImpl> m_transientHeap;
@@ -3063,6 +3064,7 @@ public:
#if SLANG_GFX_HAS_DXR_SUPPORT
m_cmdList->QueryInterface<ID3D12GraphicsCommandList4>(m_cmdList4.writeRef());
#endif
+ m_cmdList->QueryInterface<ID3D12GraphicsCommandList1>(m_cmdList1.writeRef());
}
class RenderCommandEncoderImpl
@@ -3483,10 +3485,13 @@ public:
uint32_t pixelCount,
const SamplePosition* samplePositions) override
{
- SLANG_UNUSED(samplesPerPixel);
- SLANG_UNUSED(pixelCount);
- SLANG_UNUSED(samplePositions);
- SLANG_UNIMPLEMENTED_X("setSamplePositions");
+ if (m_commandBuffer->m_cmdList1)
+ {
+ m_commandBuffer->m_cmdList1->SetSamplePositions(
+ samplesPerPixel, pixelCount, (D3D12_SAMPLE_POSITION*)samplePositions);
+ return SLANG_OK;
+ }
+ return SLANG_E_NOT_AVAILABLE;
}
virtual SLANG_NO_THROW void SLANG_MCALL drawInstanced(
diff --git a/tools/gfx/vulkan/render-vk.cpp b/tools/gfx/vulkan/render-vk.cpp
index a363fb4a1..654911d4d 100644
--- a/tools/gfx/vulkan/render-vk.cpp
+++ b/tools/gfx/vulkan/render-vk.cpp
@@ -4138,10 +4138,16 @@ public:
uint32_t pixelCount,
const SamplePosition* samplePositions) override
{
- SLANG_UNUSED(samplesPerPixel);
- SLANG_UNUSED(pixelCount);
- SLANG_UNUSED(samplePositions);
- SLANG_UNIMPLEMENTED_X("setSamplePositions");
+ if (m_api->vkCmdSetSampleLocationsEXT)
+ {
+ VkSampleLocationsInfoEXT sampleLocInfo = {};
+ sampleLocInfo.sType = VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT;
+ sampleLocInfo.sampleLocationsCount = samplesPerPixel * pixelCount;
+ sampleLocInfo.sampleLocationsPerPixel = (VkSampleCountFlagBits)samplesPerPixel;
+ m_api->vkCmdSetSampleLocationsEXT(m_vkCommandBuffer, &sampleLocInfo);
+ return SLANG_OK;
+ }
+ return SLANG_E_NOT_AVAILABLE;
}
virtual SLANG_NO_THROW void SLANG_MCALL drawInstanced(
diff --git a/tools/gfx/vulkan/vk-api.h b/tools/gfx/vulkan/vk-api.h
index 9cbff8ee4..bf0a99504 100644
--- a/tools/gfx/vulkan/vk-api.h
+++ b/tools/gfx/vulkan/vk-api.h
@@ -190,6 +190,7 @@ namespace gfx {
x(vkSignalSemaphoreKHR) \
x(vkWaitSemaphores) \
x(vkWaitSemaphoresKHR) \
+ x(vkCmdSetSampleLocationsEXT) \
/* */
#define VK_API_ALL_GLOBAL_PROCS(x) \