1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-30 04:24:11 +01:00

[dxvk] Use new fullscreen shaders for meta copy operations

This commit is contained in:
Philip Rebohle 2019-07-18 18:18:39 +02:00
parent 07408bcdcc
commit 792f15680a
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 29 additions and 19 deletions

View File

@ -2838,7 +2838,7 @@ namespace dxvk {
0, sizeof(srcCoordOffset),
&srcCoordOffset);
m_cmd->cmdDraw(1, tgtSubresource.layerCount, 0, 0);
m_cmd->cmdDraw(3, tgtSubresource.layerCount, 0, 0);
m_cmd->cmdEndRenderPass();
m_execBarriers.accessImage(

View File

@ -1,8 +1,10 @@
#include "dxvk_device.h"
#include "dxvk_meta_copy.h"
#include <dxvk_copy_vert.h>
#include <dxvk_copy_geom.h>
#include <dxvk_fullscreen_geom.h>
#include <dxvk_fullscreen_vert.h>
#include <dxvk_fullscreen_layer_vert.h>
#include <dxvk_copy_color_1d.h>
#include <dxvk_copy_color_2d.h>
#include <dxvk_copy_color_ms.h>
@ -126,8 +128,6 @@ namespace dxvk {
DxvkMetaCopyObjects::DxvkMetaCopyObjects(const DxvkDevice* device)
: m_vkd (device->vkd()),
m_sampler (createSampler()),
m_shaderVert (createShaderModule(dxvk_copy_vert)),
m_shaderGeom (createShaderModule(dxvk_copy_geom)),
m_color {
createShaderModule(dxvk_copy_color_1d),
createShaderModule(dxvk_copy_color_2d),
@ -136,6 +136,13 @@ namespace dxvk {
createShaderModule(dxvk_copy_depth_1d),
createShaderModule(dxvk_copy_depth_2d),
createShaderModule(dxvk_copy_depth_ms) } {
if (device->extensions().extShaderViewportIndexLayer) {
m_shaderVert = createShaderModule(dxvk_fullscreen_layer_vert);
} else {
m_shaderVert = createShaderModule(dxvk_fullscreen_vert);
m_shaderGeom = createShaderModule(dxvk_fullscreen_geom);
}
if (device->extensions().extShaderStencilExport) {
m_depthStencil = {
createShaderModule(dxvk_copy_depth_stencil_1d),
@ -393,8 +400,9 @@ namespace dxvk {
auto aspect = imageFormatInfo(key.format)->aspectMask;
std::array<VkPipelineShaderStageCreateInfo, 3> stages;
uint32_t stageCount = 0;
VkPipelineShaderStageCreateInfo& vsStage = stages[0];
VkPipelineShaderStageCreateInfo& vsStage = stages[stageCount++];
vsStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
vsStage.pNext = nullptr;
vsStage.flags = 0;
@ -403,16 +411,18 @@ namespace dxvk {
vsStage.pName = "main";
vsStage.pSpecializationInfo = nullptr;
VkPipelineShaderStageCreateInfo& gsStage = stages[1];
gsStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
gsStage.pNext = nullptr;
gsStage.flags = 0;
gsStage.stage = VK_SHADER_STAGE_GEOMETRY_BIT;
gsStage.module = m_shaderGeom;
gsStage.pName = "main";
gsStage.pSpecializationInfo = nullptr;
if (m_shaderGeom) {
VkPipelineShaderStageCreateInfo& gsStage = stages[stageCount++];
gsStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
gsStage.pNext = nullptr;
gsStage.flags = 0;
gsStage.stage = VK_SHADER_STAGE_GEOMETRY_BIT;
gsStage.module = m_shaderGeom;
gsStage.pName = "main";
gsStage.pSpecializationInfo = nullptr;
}
VkPipelineShaderStageCreateInfo& psStage = stages[2];
VkPipelineShaderStageCreateInfo& psStage = stages[stageCount++];
psStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
psStage.pNext = nullptr;
psStage.flags = 0;
@ -469,7 +479,7 @@ namespace dxvk {
iaState.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
iaState.pNext = nullptr;
iaState.flags = 0;
iaState.topology = VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
iaState.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
iaState.primitiveRestartEnable = VK_FALSE;
VkPipelineViewportStateCreateInfo vpState;
@ -559,7 +569,7 @@ namespace dxvk {
info.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
info.pNext = nullptr;
info.flags = 0;
info.stageCount = stages.size();
info.stageCount = stageCount;
info.pStages = stages.data();
info.pVertexInputState = &viState;
info.pInputAssemblyState = &iaState;

View File

@ -145,8 +145,8 @@ namespace dxvk {
VkSampler m_sampler;
VkShaderModule m_shaderVert;
VkShaderModule m_shaderGeom;
VkShaderModule m_shaderVert = VK_NULL_HANDLE;
VkShaderModule m_shaderGeom = VK_NULL_HANDLE;
FragShaders m_color;
FragShaders m_depth;