mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 02:52:10 +01:00
[dxvk] Set non-zero framebuffer size when there are no attachments
This is required for UAV-only rendering and will be required for stream output in the future as well.
This commit is contained in:
parent
7cb7e4a944
commit
9aa73d1148
@ -12,6 +12,7 @@ namespace dxvk {
|
||||
m_vkd (vkd),
|
||||
m_extensions (extensions),
|
||||
m_features (features),
|
||||
m_properties (adapter->deviceProperties()),
|
||||
m_memory (new DxvkMemoryAllocator (adapter, vkd)),
|
||||
m_renderPassPool (new DxvkRenderPassPool (vkd)),
|
||||
m_pipelineCache (new DxvkPipelineCache (vkd)),
|
||||
@ -111,9 +112,16 @@ namespace dxvk {
|
||||
|
||||
Rc<DxvkFramebuffer> DxvkDevice::createFramebuffer(
|
||||
const DxvkRenderTargets& renderTargets) {
|
||||
const DxvkFramebufferSize defaultSize = {
|
||||
m_properties.limits.maxFramebufferWidth,
|
||||
m_properties.limits.maxFramebufferHeight,
|
||||
m_properties.limits.maxFramebufferLayers };
|
||||
|
||||
auto format = renderTargets.renderPassFormat();
|
||||
auto renderPass = m_renderPassPool->getRenderPass(format);
|
||||
return new DxvkFramebuffer(m_vkd, renderPass, renderTargets);
|
||||
|
||||
return new DxvkFramebuffer(m_vkd,
|
||||
renderPass, renderTargets, defaultSize);
|
||||
}
|
||||
|
||||
|
||||
|
@ -346,24 +346,25 @@ namespace dxvk {
|
||||
|
||||
private:
|
||||
|
||||
Rc<DxvkAdapter> m_adapter;
|
||||
Rc<vk::DeviceFn> m_vkd;
|
||||
Rc<DxvkDeviceExtensions> m_extensions;
|
||||
VkPhysicalDeviceFeatures m_features;
|
||||
Rc<DxvkAdapter> m_adapter;
|
||||
Rc<vk::DeviceFn> m_vkd;
|
||||
Rc<DxvkDeviceExtensions> m_extensions;
|
||||
VkPhysicalDeviceFeatures m_features;
|
||||
VkPhysicalDeviceProperties m_properties;
|
||||
|
||||
Rc<DxvkMemoryAllocator> m_memory;
|
||||
Rc<DxvkRenderPassPool> m_renderPassPool;
|
||||
Rc<DxvkPipelineCache> m_pipelineCache;
|
||||
Rc<DxvkMetaClearObjects> m_metaClearObjects;
|
||||
Rc<DxvkMemoryAllocator> m_memory;
|
||||
Rc<DxvkRenderPassPool> m_renderPassPool;
|
||||
Rc<DxvkPipelineCache> m_pipelineCache;
|
||||
Rc<DxvkMetaClearObjects> m_metaClearObjects;
|
||||
|
||||
DxvkUnboundResources m_unboundResources;
|
||||
DxvkUnboundResources m_unboundResources;
|
||||
|
||||
sync::Spinlock m_statLock;
|
||||
DxvkStatCounters m_statCounters;
|
||||
sync::Spinlock m_statLock;
|
||||
DxvkStatCounters m_statCounters;
|
||||
|
||||
std::mutex m_submissionLock;
|
||||
DxvkDeviceQueue m_graphicsQueue;
|
||||
DxvkDeviceQueue m_presentQueue;
|
||||
std::mutex m_submissionLock;
|
||||
DxvkDeviceQueue m_graphicsQueue;
|
||||
DxvkDeviceQueue m_presentQueue;
|
||||
|
||||
DxvkRecycler<DxvkCommandList, 16> m_recycledCommandLists;
|
||||
DxvkRecycler<DxvkStagingBuffer, 4> m_recycledStagingBuffers;
|
||||
|
@ -48,7 +48,8 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
DxvkFramebufferSize DxvkRenderTargets::getImageSize() const {
|
||||
DxvkFramebufferSize DxvkRenderTargets::getImageSize(
|
||||
const DxvkFramebufferSize& defaultSize) const {
|
||||
if (m_depthTarget.view != nullptr)
|
||||
return this->renderTargetSize(m_depthTarget.view);
|
||||
|
||||
@ -57,7 +58,7 @@ namespace dxvk {
|
||||
return this->renderTargetSize(m_colorTargets.at(i).view);
|
||||
}
|
||||
|
||||
return DxvkFramebufferSize { 0, 0, 0 };
|
||||
return defaultSize;
|
||||
}
|
||||
|
||||
|
||||
@ -95,11 +96,12 @@ namespace dxvk {
|
||||
DxvkFramebuffer::DxvkFramebuffer(
|
||||
const Rc<vk::DeviceFn>& vkd,
|
||||
const Rc<DxvkRenderPass>& renderPass,
|
||||
const DxvkRenderTargets& renderTargets)
|
||||
const DxvkRenderTargets& renderTargets,
|
||||
const DxvkFramebufferSize& defaultSize)
|
||||
: m_vkd (vkd),
|
||||
m_renderPass (renderPass),
|
||||
m_renderTargets (renderTargets),
|
||||
m_framebufferSize (renderTargets.getImageSize()) {
|
||||
m_framebufferSize (renderTargets.getImageSize(defaultSize)) {
|
||||
std::array<VkImageView, MaxNumRenderTargets + 1> views;
|
||||
uint32_t viewCount = renderTargets.getAttachments(views.data());
|
||||
|
||||
|
@ -104,11 +104,14 @@ namespace dxvk {
|
||||
/**
|
||||
* \brief Framebuffer size
|
||||
*
|
||||
* The width, height and layers
|
||||
* of the attached render targets.
|
||||
* The width, height and layer count of the
|
||||
* attached render targets.
|
||||
* \param [in] defaultSize Size to use when
|
||||
* there are no framebuffer attachments.
|
||||
* \returns Framebuffer size
|
||||
*/
|
||||
DxvkFramebufferSize getImageSize() const;
|
||||
DxvkFramebufferSize getImageSize(
|
||||
const DxvkFramebufferSize& defaultSize) const;
|
||||
|
||||
/**
|
||||
* \brief Checks whether any attachments are defined
|
||||
@ -152,7 +155,8 @@ namespace dxvk {
|
||||
DxvkFramebuffer(
|
||||
const Rc<vk::DeviceFn>& vkd,
|
||||
const Rc<DxvkRenderPass>& renderPass,
|
||||
const DxvkRenderTargets& renderTargets);
|
||||
const DxvkRenderTargets& renderTargets,
|
||||
const DxvkFramebufferSize& defaultSize);
|
||||
~DxvkFramebuffer();
|
||||
|
||||
/**
|
||||
|
@ -189,7 +189,8 @@ namespace dxvk {
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);
|
||||
|
||||
m_framebuffers.at(i) = new DxvkFramebuffer(
|
||||
m_vkd, m_renderPass, renderTargets);
|
||||
m_vkd, m_renderPass, renderTargets,
|
||||
DxvkFramebufferSize());
|
||||
|
||||
m_semaphoreSet.at(i).acquireSync = m_device->createSemaphore();
|
||||
m_semaphoreSet.at(i).presentSync = m_device->createSemaphore();
|
||||
|
@ -22,6 +22,8 @@ struct Color {
|
||||
uint8_t r, g, b, a;
|
||||
};
|
||||
|
||||
bool m_report = false;
|
||||
|
||||
const std::string g_vertexShaderCode =
|
||||
"Buffer<float4> buf : register(t0);\n"
|
||||
"struct vs_out {\n"
|
||||
@ -311,7 +313,7 @@ public:
|
||||
|
||||
m_context->OMSetRenderTargets(0, nullptr, nullptr);
|
||||
|
||||
m_swapChain->Present(0, 0);
|
||||
m_swapChain->Present(1, 0);
|
||||
|
||||
// Test query results
|
||||
while (true) {
|
||||
@ -332,6 +334,24 @@ public:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Swap chain stuff
|
||||
uint32_t frameId = m_frameId++;
|
||||
|
||||
if (frameId == 300) {
|
||||
m_report = true;
|
||||
std::cout << "fullscreen begin" << std::endl;
|
||||
m_swapChain->SetFullscreenState(TRUE, nullptr);
|
||||
std::cout << "fullscreen end" << std::endl;
|
||||
m_report = false;
|
||||
} else if (frameId == 600) {
|
||||
m_report = true;
|
||||
std::cout << "restore begin" << std::endl;
|
||||
m_swapChain->SetFullscreenState(FALSE, nullptr);
|
||||
std::cout << "restore end" << std::endl;
|
||||
m_report = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -388,6 +408,8 @@ private:
|
||||
|
||||
D3D_FEATURE_LEVEL m_featureLevel;
|
||||
|
||||
uint32_t m_frameId = 0;
|
||||
|
||||
};
|
||||
|
||||
LRESULT CALLBACK WindowProc(HWND hWnd,
|
||||
@ -446,6 +468,13 @@ int WINAPI WinMain(HINSTANCE hInstance,
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
if (m_report) {
|
||||
std::cout << "hwnd: " << hWnd << std::endl;
|
||||
std::cout << "msg: " << message << std::endl;
|
||||
std::cout << "wp: " << wParam << std::endl;
|
||||
std::cout << "lp: " << lParam << std::endl;
|
||||
}
|
||||
|
||||
switch (message) {
|
||||
case WM_CLOSE:
|
||||
PostQuitMessage(0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user