mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-07 16:54:14 +01:00
[dxvk] Infer swap chain color space from image views
This commit is contained in:
parent
1d790970d5
commit
d85d07c0ec
@ -434,15 +434,15 @@ namespace dxvk {
|
||||
auto contextObjects = ctx->beginExternalRendering();
|
||||
|
||||
cBlitter->beginPresent(contextObjects,
|
||||
cBackBuffer, cColorSpace, VkRect2D(),
|
||||
cSwapImage, cColorSpace, VkRect2D());
|
||||
cBackBuffer, VkRect2D(),
|
||||
cSwapImage, VkRect2D());
|
||||
|
||||
if (cHud != nullptr) {
|
||||
cHud->update();
|
||||
cHud->render(contextObjects, cBackBuffer, cColorSpace);
|
||||
cHud->render(contextObjects, cBackBuffer);
|
||||
}
|
||||
|
||||
cBlitter->endPresent(contextObjects, cBackBuffer, cColorSpace);
|
||||
cBlitter->endPresent(contextObjects, cBackBuffer);
|
||||
|
||||
// Submit current command list and present
|
||||
ctx->synchronizeWsi(cSync);
|
||||
|
@ -878,17 +878,16 @@ namespace dxvk {
|
||||
auto contextObjects = ctx->beginExternalRendering();
|
||||
|
||||
cBlitter->beginPresent(contextObjects,
|
||||
cDstView, cColorSpace, cDstRect,
|
||||
cSrcView, cColorSpace, cSrcRect);
|
||||
cDstView, cDstRect, cSrcView, cSrcRect);
|
||||
|
||||
if (cHud) {
|
||||
if (!cRepeat)
|
||||
cHud->update();
|
||||
|
||||
cHud->render(contextObjects, cDstView, cColorSpace);
|
||||
cHud->render(contextObjects, cDstView);
|
||||
}
|
||||
|
||||
cBlitter->endPresent(contextObjects, cDstView, cColorSpace);
|
||||
cBlitter->endPresent(contextObjects, cDstView);
|
||||
|
||||
// Submit command list and present
|
||||
ctx->synchronizeWsi(cSync);
|
||||
|
@ -38,10 +38,8 @@ namespace dxvk {
|
||||
void DxvkSwapchainBlitter::beginPresent(
|
||||
const DxvkContextObjects& ctx,
|
||||
const Rc<DxvkImageView>& dstView,
|
||||
VkColorSpaceKHR dstColorSpace,
|
||||
VkRect2D dstRect,
|
||||
const Rc<DxvkImageView>& srcView,
|
||||
VkColorSpaceKHR srcColorSpace,
|
||||
VkRect2D srcRect) {
|
||||
std::unique_lock lock(m_mutex);
|
||||
|
||||
@ -102,17 +100,14 @@ namespace dxvk {
|
||||
|
||||
ctx.cmd->cmdBeginRendering(&renderInfo);
|
||||
|
||||
performDraw(ctx,
|
||||
dstView, dstColorSpace, dstRect,
|
||||
srcView, srcColorSpace, srcRect,
|
||||
VK_FALSE);
|
||||
performDraw(ctx, dstView, dstRect,
|
||||
srcView, srcRect, VK_FALSE);
|
||||
}
|
||||
|
||||
|
||||
void DxvkSwapchainBlitter::endPresent(
|
||||
const DxvkContextObjects& ctx,
|
||||
const Rc<DxvkImageView>& dstView,
|
||||
VkColorSpaceKHR dstColorSpace) {
|
||||
const Rc<DxvkImageView>& dstView) {
|
||||
std::unique_lock lock(m_mutex);
|
||||
|
||||
if (m_cursorView) {
|
||||
@ -120,9 +115,8 @@ namespace dxvk {
|
||||
cursorArea.extent.width = m_cursorImage->info().extent.width;
|
||||
cursorArea.extent.height = m_cursorImage->info().extent.height;
|
||||
|
||||
performDraw(ctx, dstView, dstColorSpace, m_cursorRect,
|
||||
m_cursorView, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, cursorArea,
|
||||
VK_TRUE);
|
||||
performDraw(ctx, dstView, m_cursorRect,
|
||||
m_cursorView, cursorArea, VK_TRUE);
|
||||
}
|
||||
|
||||
ctx.cmd->cmdEndRendering();
|
||||
@ -212,6 +206,7 @@ namespace dxvk {
|
||||
| VK_ACCESS_SHADER_READ_BIT;
|
||||
imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL;
|
||||
imageInfo.layout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
imageInfo.colorSpace = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
|
||||
imageInfo.debugName = "Swapchain cursor";
|
||||
|
||||
m_cursorImage = m_device->createImage(imageInfo, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
|
||||
@ -246,12 +241,13 @@ namespace dxvk {
|
||||
void DxvkSwapchainBlitter::performDraw(
|
||||
const DxvkContextObjects& ctx,
|
||||
const Rc<DxvkImageView>& dstView,
|
||||
VkColorSpaceKHR dstColorSpace,
|
||||
VkRect2D dstRect,
|
||||
const Rc<DxvkImageView>& srcView,
|
||||
VkColorSpaceKHR srcColorSpace,
|
||||
VkRect2D srcRect,
|
||||
VkBool32 enableBlending) {
|
||||
VkColorSpaceKHR dstColorSpace = dstView->image()->info().colorSpace;
|
||||
VkColorSpaceKHR srcColorSpace = srcView->image()->info().colorSpace;
|
||||
|
||||
if (unlikely(m_device->isDebugEnabled())) {
|
||||
ctx.cmd->cmdInsertDebugUtilsLabel(DxvkCmdBuffer::ExecBuffer,
|
||||
vk::makeLabel(0xdcc0f0, "Swapchain blit"));
|
||||
|
@ -93,7 +93,6 @@ namespace dxvk {
|
||||
* The swap chain image will remain bound for rendering.
|
||||
* \param [in] ctx Context objects
|
||||
* \param [in] dstView Swap chain image view
|
||||
* \param [in] dstColorSpace Swap chain color space
|
||||
* \param [in] dstRect Destination rectangle
|
||||
* \param [in] srcView Image to present
|
||||
* \param [in] srcColorSpace Image color space
|
||||
@ -102,10 +101,8 @@ namespace dxvk {
|
||||
void beginPresent(
|
||||
const DxvkContextObjects& ctx,
|
||||
const Rc<DxvkImageView>& dstView,
|
||||
VkColorSpaceKHR dstColorSpace,
|
||||
VkRect2D dstRect,
|
||||
const Rc<DxvkImageView>& srcView,
|
||||
VkColorSpaceKHR srcColorSpace,
|
||||
VkRect2D srcRect);
|
||||
|
||||
/**
|
||||
@ -114,12 +111,10 @@ namespace dxvk {
|
||||
* Finishes rendering and prepares the image for presentation.
|
||||
* \param [in] ctx Context objects
|
||||
* \param [in] dstView Swap chain image view
|
||||
* \param [in] dstColorSpace Swap chain color space
|
||||
*/
|
||||
void endPresent(
|
||||
const DxvkContextObjects& ctx,
|
||||
const Rc<DxvkImageView>& dstView,
|
||||
VkColorSpaceKHR dstColorSpace);
|
||||
const Rc<DxvkImageView>& dstView);
|
||||
|
||||
/**
|
||||
* \brief Sets gamma ramp
|
||||
@ -211,10 +206,8 @@ namespace dxvk {
|
||||
void performDraw(
|
||||
const DxvkContextObjects& ctx,
|
||||
const Rc<DxvkImageView>& dstView,
|
||||
VkColorSpaceKHR dstColorSpace,
|
||||
VkRect2D dstRect,
|
||||
const Rc<DxvkImageView>& srcView,
|
||||
VkColorSpaceKHR srcColorSpace,
|
||||
VkRect2D srcRect,
|
||||
VkBool32 enableBlending);
|
||||
|
||||
|
@ -41,13 +41,12 @@ namespace dxvk::hud {
|
||||
|
||||
void Hud::render(
|
||||
const DxvkContextObjects& ctx,
|
||||
const Rc<DxvkImageView>& dstView,
|
||||
VkColorSpaceKHR dstColorSpace) {
|
||||
auto key = m_renderer.getPipelineKey(dstView, dstColorSpace);
|
||||
const Rc<DxvkImageView>& dstView) {
|
||||
auto key = m_renderer.getPipelineKey(dstView);
|
||||
|
||||
m_renderer.beginFrame(ctx, dstView, dstColorSpace, m_options);
|
||||
m_renderer.beginFrame(ctx, dstView, m_options);
|
||||
m_hudItems.render(ctx, key, m_options, m_renderer);
|
||||
m_renderer.flushDraws(ctx, dstView, dstColorSpace, m_options);
|
||||
m_renderer.flushDraws(ctx, dstView, m_options);
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,12 +35,10 @@ namespace dxvk::hud {
|
||||
* Renders the HUD to the given context.
|
||||
* \param [in] ctx Context objects for rendering
|
||||
* \param [in] dstView Swap chain image view
|
||||
* \param [in] dstColorSpace Color space
|
||||
*/
|
||||
void render(
|
||||
const DxvkContextObjects& ctx,
|
||||
const Rc<DxvkImageView>& dstView,
|
||||
VkColorSpaceKHR dstColorSpace);
|
||||
const Rc<DxvkImageView>& dstView);
|
||||
|
||||
/**
|
||||
* \brief Adds a HUD item if enabled
|
||||
|
@ -57,7 +57,6 @@ namespace dxvk::hud {
|
||||
void HudRenderer::beginFrame(
|
||||
const DxvkContextObjects& ctx,
|
||||
const Rc<DxvkImageView>& dstView,
|
||||
VkColorSpaceKHR dstColorSpace,
|
||||
const HudOptions& options) {
|
||||
if (unlikely(m_device->isDebugEnabled())) {
|
||||
ctx.cmd->cmdInsertDebugUtilsLabel(DxvkCmdBuffer::ExecBuffer,
|
||||
@ -116,7 +115,6 @@ namespace dxvk::hud {
|
||||
void HudRenderer::flushDraws(
|
||||
const DxvkContextObjects& ctx,
|
||||
const Rc<DxvkImageView>& dstView,
|
||||
VkColorSpaceKHR dstColorSpace,
|
||||
const HudOptions& options) {
|
||||
if (m_textDraws.empty())
|
||||
return;
|
||||
@ -192,7 +190,7 @@ namespace dxvk::hud {
|
||||
VkDescriptorBufferInfo textBufferDescriptor = m_textBuffer->getDescriptor(textSizeAligned, drawInfoSize).buffer;
|
||||
VkDescriptorBufferInfo drawBufferDescriptor = m_textBuffer->getDescriptor(drawArgOffset, drawArgWriteSize).buffer;
|
||||
|
||||
drawTextIndirect(ctx, getPipelineKey(dstView, dstColorSpace),
|
||||
drawTextIndirect(ctx, getPipelineKey(dstView),
|
||||
drawBufferDescriptor, textBufferDescriptor,
|
||||
m_textBufferView->handle(), m_textDraws.size());
|
||||
|
||||
@ -261,11 +259,10 @@ namespace dxvk::hud {
|
||||
|
||||
|
||||
HudPipelineKey HudRenderer::getPipelineKey(
|
||||
const Rc<DxvkImageView>& dstView,
|
||||
VkColorSpaceKHR dstColorSpace) const {
|
||||
const Rc<DxvkImageView>& dstView) const {
|
||||
HudPipelineKey key;
|
||||
key.format = dstView->info().format;
|
||||
key.colorSpace = dstColorSpace;
|
||||
key.colorSpace = dstView->image()->info().colorSpace;
|
||||
return key;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,6 @@ namespace dxvk::hud {
|
||||
void beginFrame(
|
||||
const DxvkContextObjects& ctx,
|
||||
const Rc<DxvkImageView>& dstView,
|
||||
VkColorSpaceKHR dstColorSpace,
|
||||
const HudOptions& options);
|
||||
|
||||
void drawText(
|
||||
@ -123,12 +122,10 @@ namespace dxvk::hud {
|
||||
void flushDraws(
|
||||
const DxvkContextObjects& ctx,
|
||||
const Rc<DxvkImageView>& dstView,
|
||||
VkColorSpaceKHR dstColorSpace,
|
||||
const HudOptions& options);
|
||||
|
||||
HudPipelineKey getPipelineKey(
|
||||
const Rc<DxvkImageView>& dstView,
|
||||
VkColorSpaceKHR dstColorSpace) const;
|
||||
const Rc<DxvkImageView>& dstView) const;
|
||||
|
||||
HudSpecConstants getSpecConstants(
|
||||
const HudPipelineKey& key) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user