mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-11-30 04:24:11 +01:00
[dxvk] Use new fullscreen shaders for mip gen operations
This commit is contained in:
parent
e91efb6dc2
commit
8889d6402e
@ -1733,7 +1733,7 @@ namespace dxvk {
|
|||||||
0, sizeof(pushConstants),
|
0, sizeof(pushConstants),
|
||||||
&pushConstants);
|
&pushConstants);
|
||||||
|
|
||||||
m_cmd->cmdDraw(1, passExtent.depth, 0, 0);
|
m_cmd->cmdDraw(3, passExtent.depth, 0, 0);
|
||||||
m_cmd->cmdEndRenderPass();
|
m_cmd->cmdEndRenderPass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ namespace dxvk {
|
|||||||
m_metaClearObjects (new DxvkMetaClearObjects (vkd)),
|
m_metaClearObjects (new DxvkMetaClearObjects (vkd)),
|
||||||
m_metaCopyObjects (new DxvkMetaCopyObjects (this)),
|
m_metaCopyObjects (new DxvkMetaCopyObjects (this)),
|
||||||
m_metaResolveObjects(new DxvkMetaResolveObjects (this)),
|
m_metaResolveObjects(new DxvkMetaResolveObjects (this)),
|
||||||
m_metaMipGenObjects (new DxvkMetaMipGenObjects (vkd)),
|
m_metaMipGenObjects (new DxvkMetaMipGenObjects (this)),
|
||||||
m_metaPackObjects (new DxvkMetaPackObjects (vkd)),
|
m_metaPackObjects (new DxvkMetaPackObjects (vkd)),
|
||||||
m_unboundResources (this),
|
m_unboundResources (this),
|
||||||
m_submissionQueue (this) {
|
m_submissionQueue (this) {
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
|
#include "dxvk_device.h"
|
||||||
#include "dxvk_meta_mipgen.h"
|
#include "dxvk_meta_mipgen.h"
|
||||||
|
|
||||||
#include <dxvk_mipgen_vert.h>
|
#include <dxvk_fullscreen_geom.h>
|
||||||
#include <dxvk_mipgen_geom.h>
|
#include <dxvk_fullscreen_vert.h>
|
||||||
|
#include <dxvk_fullscreen_layer_vert.h>
|
||||||
|
|
||||||
#include <dxvk_mipgen_frag_1d.h>
|
#include <dxvk_mipgen_frag_1d.h>
|
||||||
#include <dxvk_mipgen_frag_2d.h>
|
#include <dxvk_mipgen_frag_2d.h>
|
||||||
#include <dxvk_mipgen_frag_3d.h>
|
#include <dxvk_mipgen_frag_3d.h>
|
||||||
@ -184,15 +187,18 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DxvkMetaMipGenObjects::DxvkMetaMipGenObjects(const Rc<vk::DeviceFn>& vkd)
|
DxvkMetaMipGenObjects::DxvkMetaMipGenObjects(const DxvkDevice* device)
|
||||||
: m_vkd (vkd),
|
: m_vkd (device->vkd()),
|
||||||
m_sampler (createSampler()),
|
m_sampler (createSampler()),
|
||||||
m_shaderVert (createShaderModule(dxvk_mipgen_vert)),
|
|
||||||
m_shaderGeom (createShaderModule(dxvk_mipgen_geom)),
|
|
||||||
m_shaderFrag1D(createShaderModule(dxvk_mipgen_frag_1d)),
|
m_shaderFrag1D(createShaderModule(dxvk_mipgen_frag_1d)),
|
||||||
m_shaderFrag2D(createShaderModule(dxvk_mipgen_frag_2d)),
|
m_shaderFrag2D(createShaderModule(dxvk_mipgen_frag_2d)),
|
||||||
m_shaderFrag3D(createShaderModule(dxvk_mipgen_frag_3d)) {
|
m_shaderFrag3D(createShaderModule(dxvk_mipgen_frag_3d)) {
|
||||||
|
if (device->extensions().extShaderViewportIndexLayer) {
|
||||||
|
m_shaderVert = createShaderModule(dxvk_fullscreen_layer_vert);
|
||||||
|
} else {
|
||||||
|
m_shaderVert = createShaderModule(dxvk_fullscreen_vert);
|
||||||
|
m_shaderGeom = createShaderModule(dxvk_fullscreen_geom);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -398,8 +404,9 @@ namespace dxvk {
|
|||||||
VkPipelineLayout pipelineLayout,
|
VkPipelineLayout pipelineLayout,
|
||||||
VkRenderPass renderPass) const {
|
VkRenderPass renderPass) const {
|
||||||
std::array<VkPipelineShaderStageCreateInfo, 3> stages;
|
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.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||||
vsStage.pNext = nullptr;
|
vsStage.pNext = nullptr;
|
||||||
vsStage.flags = 0;
|
vsStage.flags = 0;
|
||||||
@ -408,7 +415,8 @@ namespace dxvk {
|
|||||||
vsStage.pName = "main";
|
vsStage.pName = "main";
|
||||||
vsStage.pSpecializationInfo = nullptr;
|
vsStage.pSpecializationInfo = nullptr;
|
||||||
|
|
||||||
VkPipelineShaderStageCreateInfo& gsStage = stages[1];
|
if (m_shaderGeom) {
|
||||||
|
VkPipelineShaderStageCreateInfo& gsStage = stages[stageCount++];
|
||||||
gsStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
gsStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||||
gsStage.pNext = nullptr;
|
gsStage.pNext = nullptr;
|
||||||
gsStage.flags = 0;
|
gsStage.flags = 0;
|
||||||
@ -416,8 +424,9 @@ namespace dxvk {
|
|||||||
gsStage.module = m_shaderGeom;
|
gsStage.module = m_shaderGeom;
|
||||||
gsStage.pName = "main";
|
gsStage.pName = "main";
|
||||||
gsStage.pSpecializationInfo = nullptr;
|
gsStage.pSpecializationInfo = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
VkPipelineShaderStageCreateInfo& psStage = stages[2];
|
VkPipelineShaderStageCreateInfo& psStage = stages[stageCount++];
|
||||||
psStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
psStage.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||||
psStage.pNext = nullptr;
|
psStage.pNext = nullptr;
|
||||||
psStage.flags = 0;
|
psStage.flags = 0;
|
||||||
@ -458,7 +467,7 @@ namespace dxvk {
|
|||||||
iaState.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
|
iaState.sType = VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO;
|
||||||
iaState.pNext = nullptr;
|
iaState.pNext = nullptr;
|
||||||
iaState.flags = 0;
|
iaState.flags = 0;
|
||||||
iaState.topology = VK_PRIMITIVE_TOPOLOGY_POINT_LIST;
|
iaState.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||||
iaState.primitiveRestartEnable = VK_FALSE;
|
iaState.primitiveRestartEnable = VK_FALSE;
|
||||||
|
|
||||||
VkPipelineViewportStateCreateInfo vpState;
|
VkPipelineViewportStateCreateInfo vpState;
|
||||||
@ -525,7 +534,7 @@ namespace dxvk {
|
|||||||
info.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
|
info.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
|
||||||
info.pNext = nullptr;
|
info.pNext = nullptr;
|
||||||
info.flags = 0;
|
info.flags = 0;
|
||||||
info.stageCount = stages.size();
|
info.stageCount = stageCount;
|
||||||
info.pStages = stages.data();
|
info.pStages = stages.data();
|
||||||
info.pVertexInputState = &viState;
|
info.pVertexInputState = &viState;
|
||||||
info.pInputAssemblyState = &iaState;
|
info.pInputAssemblyState = &iaState;
|
||||||
|
@ -165,7 +165,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DxvkMetaMipGenObjects(const Rc<vk::DeviceFn>& vkd);
|
DxvkMetaMipGenObjects(const DxvkDevice* device);
|
||||||
~DxvkMetaMipGenObjects();
|
~DxvkMetaMipGenObjects();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -185,11 +185,11 @@ namespace dxvk {
|
|||||||
|
|
||||||
VkSampler m_sampler;
|
VkSampler m_sampler;
|
||||||
|
|
||||||
VkShaderModule m_shaderVert;
|
VkShaderModule m_shaderVert = VK_NULL_HANDLE;
|
||||||
VkShaderModule m_shaderGeom;
|
VkShaderModule m_shaderGeom = VK_NULL_HANDLE;
|
||||||
VkShaderModule m_shaderFrag1D;
|
VkShaderModule m_shaderFrag1D = VK_NULL_HANDLE;
|
||||||
VkShaderModule m_shaderFrag2D;
|
VkShaderModule m_shaderFrag2D = VK_NULL_HANDLE;
|
||||||
VkShaderModule m_shaderFrag3D;
|
VkShaderModule m_shaderFrag3D = VK_NULL_HANDLE;
|
||||||
|
|
||||||
std::mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
|
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
layout(set = 0, binding = 0)
|
layout(set = 0, binding = 0)
|
||||||
uniform sampler1DArray s_texture;
|
uniform sampler1DArray s_texture;
|
||||||
|
|
||||||
layout(location = 0) in vec3 i_pos;
|
layout(location = 0) in vec2 i_pos;
|
||||||
layout(location = 0) out vec4 o_color;
|
layout(location = 0) out vec4 o_color;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
o_color = texture(s_texture, i_pos.xz);
|
o_color = texture(s_texture, vec2(i_pos.x, gl_Layer));
|
||||||
}
|
}
|
@ -3,9 +3,9 @@
|
|||||||
layout(set = 0, binding = 0)
|
layout(set = 0, binding = 0)
|
||||||
uniform sampler2DArray s_texture;
|
uniform sampler2DArray s_texture;
|
||||||
|
|
||||||
layout(location = 0) in vec3 i_pos;
|
layout(location = 0) in vec2 i_pos;
|
||||||
layout(location = 0) out vec4 o_color;
|
layout(location = 0) out vec4 o_color;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
o_color = texture(s_texture, i_pos);
|
o_color = texture(s_texture, vec3(i_pos, gl_Layer));
|
||||||
}
|
}
|
@ -3,7 +3,7 @@
|
|||||||
layout(set = 0, binding = 0)
|
layout(set = 0, binding = 0)
|
||||||
uniform sampler3D s_texture;
|
uniform sampler3D s_texture;
|
||||||
|
|
||||||
layout(location = 0) in vec3 i_pos;
|
layout(location = 0) in vec2 i_pos;
|
||||||
layout(location = 0) out vec4 o_color;
|
layout(location = 0) out vec4 o_color;
|
||||||
|
|
||||||
layout(push_constant)
|
layout(push_constant)
|
||||||
@ -12,6 +12,6 @@ uniform push_block {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
o_color = texture(s_texture, vec3(i_pos.xy,
|
o_color = texture(s_texture, vec3(i_pos,
|
||||||
(i_pos.z + 0.5f) / float(p_layer_count)));
|
(float(gl_Layer) + 0.5f) / float(p_layer_count)));
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user