mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-21 22:54:16 +01:00
[dxvk] Remove workaround for non-dynamic depth clip
Kind of pointless and everyone supports the required EDS3 subset anyway.
This commit is contained in:
parent
65373792d2
commit
ea4cb84d8a
@ -48,9 +48,7 @@ namespace dxvk {
|
|||||||
// Retrieve actual pipeline handle on first use. This
|
// Retrieve actual pipeline handle on first use. This
|
||||||
// may wait for an ongoing compile job to finish, or
|
// may wait for an ongoing compile job to finish, or
|
||||||
// compile the pipeline immediately on the calling thread.
|
// compile the pipeline immediately on the calling thread.
|
||||||
m_libraryHandle = m_library->acquirePipelineHandle(
|
m_libraryHandle = m_library->acquirePipelineHandle().handle;
|
||||||
DxvkShaderPipelineLibraryCompileArgs()).handle;
|
|
||||||
|
|
||||||
return m_libraryHandle;
|
return m_libraryHandle;
|
||||||
} else {
|
} else {
|
||||||
// Slow path for compute shaders that do use spec constants
|
// Slow path for compute shaders that do use spec constants
|
||||||
|
@ -1112,6 +1112,7 @@ namespace dxvk {
|
|||||||
if (doCreateBasePipeline)
|
if (doCreateBasePipeline)
|
||||||
baseHandle = this->getBasePipeline(state);
|
baseHandle = this->getBasePipeline(state);
|
||||||
|
|
||||||
|
// Fast-linking may fail in some situations
|
||||||
if (!baseHandle)
|
if (!baseHandle)
|
||||||
fastHandle = this->getOptimizedPipeline(state);
|
fastHandle = this->getOptimizedPipeline(state);
|
||||||
|
|
||||||
@ -1149,6 +1150,13 @@ namespace dxvk {
|
|||||||
|| (state.rs.lineMode() != VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT && isLineRendering))
|
|| (state.rs.lineMode() != VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT && isLineRendering))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Depth clip is assumed to be enabled. If the driver does not
|
||||||
|
// support dynamic depth clip, we'd have to late-compile anyway
|
||||||
|
// unless the pipeline is used multiple times.
|
||||||
|
if (!m_device->features().extExtendedDynamicState3.extendedDynamicState3DepthClipEnable
|
||||||
|
&& !state.rs.depthClipEnable())
|
||||||
|
return false;
|
||||||
|
|
||||||
if (m_shaders.tcs != nullptr) {
|
if (m_shaders.tcs != nullptr) {
|
||||||
// If tessellation shaders are present, the input patch
|
// If tessellation shaders are present, the input patch
|
||||||
// vertex count must match the shader's definition.
|
// vertex count must match the shader's definition.
|
||||||
@ -1220,9 +1228,6 @@ namespace dxvk {
|
|||||||
key.viLibrary = m_manager->createVertexInputLibrary(viState);
|
key.viLibrary = m_manager->createVertexInputLibrary(viState);
|
||||||
key.foLibrary = m_manager->createFragmentOutputLibrary(foState);
|
key.foLibrary = m_manager->createFragmentOutputLibrary(foState);
|
||||||
|
|
||||||
if (!m_device->features().extExtendedDynamicState3.extendedDynamicState3DepthClipEnable)
|
|
||||||
key.args.depthClipEnable = state.rs.depthClipEnable();
|
|
||||||
|
|
||||||
auto entry = m_basePipelines.find(key);
|
auto entry = m_basePipelines.find(key);
|
||||||
if (entry != m_basePipelines.end())
|
if (entry != m_basePipelines.end())
|
||||||
return entry->second;
|
return entry->second;
|
||||||
@ -1237,8 +1242,8 @@ namespace dxvk {
|
|||||||
const DxvkGraphicsPipelineBaseInstanceKey& key) const {
|
const DxvkGraphicsPipelineBaseInstanceKey& key) const {
|
||||||
auto vk = m_device->vkd();
|
auto vk = m_device->vkd();
|
||||||
|
|
||||||
DxvkShaderPipelineLibraryHandle vs = m_vsLibrary->acquirePipelineHandle(key.args);
|
DxvkShaderPipelineLibraryHandle vs = m_vsLibrary->acquirePipelineHandle();
|
||||||
DxvkShaderPipelineLibraryHandle fs = m_fsLibrary->acquirePipelineHandle(key.args);
|
DxvkShaderPipelineLibraryHandle fs = m_fsLibrary->acquirePipelineHandle();
|
||||||
|
|
||||||
std::array<VkPipeline, 4> libraries = {{
|
std::array<VkPipeline, 4> libraries = {{
|
||||||
key.viLibrary->getHandle(), vs.handle, fs.handle,
|
key.viLibrary->getHandle(), vs.handle, fs.handle,
|
||||||
|
@ -381,19 +381,16 @@ namespace dxvk {
|
|||||||
struct DxvkGraphicsPipelineBaseInstanceKey {
|
struct DxvkGraphicsPipelineBaseInstanceKey {
|
||||||
const DxvkGraphicsPipelineVertexInputLibrary* viLibrary = nullptr;
|
const DxvkGraphicsPipelineVertexInputLibrary* viLibrary = nullptr;
|
||||||
const DxvkGraphicsPipelineFragmentOutputLibrary* foLibrary = nullptr;
|
const DxvkGraphicsPipelineFragmentOutputLibrary* foLibrary = nullptr;
|
||||||
DxvkShaderPipelineLibraryCompileArgs args;
|
|
||||||
|
|
||||||
bool eq(const DxvkGraphicsPipelineBaseInstanceKey& other) const {
|
bool eq(const DxvkGraphicsPipelineBaseInstanceKey& other) const {
|
||||||
return viLibrary == other.viLibrary
|
return viLibrary == other.viLibrary
|
||||||
&& foLibrary == other.foLibrary
|
&& foLibrary == other.foLibrary;
|
||||||
&& args == other.args;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t hash() const {
|
size_t hash() const {
|
||||||
DxvkHashState hash;
|
DxvkHashState hash;
|
||||||
hash.add(size_t(viLibrary));
|
hash.add(size_t(viLibrary));
|
||||||
hash.add(size_t(foLibrary));
|
hash.add(size_t(foLibrary));
|
||||||
hash.add(args.hash());
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1022,7 +1022,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
DxvkShaderPipelineLibrary::~DxvkShaderPipelineLibrary() {
|
DxvkShaderPipelineLibrary::~DxvkShaderPipelineLibrary() {
|
||||||
this->destroyShaderPipelinesLocked();
|
this->destroyShaderPipelineLocked();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1042,22 +1042,17 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DxvkShaderPipelineLibraryHandle DxvkShaderPipelineLibrary::acquirePipelineHandle(
|
DxvkShaderPipelineLibraryHandle DxvkShaderPipelineLibrary::acquirePipelineHandle() {
|
||||||
const DxvkShaderPipelineLibraryCompileArgs& args) {
|
|
||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
|
|
||||||
if (m_device->mustTrackPipelineLifetime())
|
if (m_device->mustTrackPipelineLifetime())
|
||||||
m_useCount += 1;
|
m_useCount += 1;
|
||||||
|
|
||||||
DxvkShaderPipelineLibraryHandle& pipeline = (m_shaders.vs && !args.depthClipEnable)
|
if (m_pipeline.handle)
|
||||||
? m_pipelineNoDepthClip
|
return m_pipeline;
|
||||||
: m_pipeline;
|
|
||||||
|
|
||||||
if (pipeline.handle)
|
m_pipeline = compileShaderPipelineLocked();
|
||||||
return pipeline;
|
return m_pipeline;
|
||||||
|
|
||||||
pipeline = compileShaderPipelineLocked(args);
|
|
||||||
return pipeline;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1066,7 +1061,7 @@ namespace dxvk {
|
|||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
|
|
||||||
if (!(--m_useCount))
|
if (!(--m_useCount))
|
||||||
this->destroyShaderPipelinesLocked();
|
this->destroyShaderPipelineLocked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1079,8 +1074,7 @@ namespace dxvk {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Compile the pipeline with default args
|
// Compile the pipeline with default args
|
||||||
DxvkShaderPipelineLibraryHandle pipeline = compileShaderPipelineLocked(
|
DxvkShaderPipelineLibraryHandle pipeline = compileShaderPipelineLocked();
|
||||||
DxvkShaderPipelineLibraryCompileArgs());
|
|
||||||
|
|
||||||
// On 32-bit, destroy the pipeline immediately in order to
|
// On 32-bit, destroy the pipeline immediately in order to
|
||||||
// save memory. We should hit the driver's disk cache once
|
// save memory. We should hit the driver's disk cache once
|
||||||
@ -1097,19 +1091,16 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkShaderPipelineLibrary::destroyShaderPipelinesLocked() {
|
void DxvkShaderPipelineLibrary::destroyShaderPipelineLocked() {
|
||||||
auto vk = m_device->vkd();
|
auto vk = m_device->vkd();
|
||||||
|
|
||||||
vk->vkDestroyPipeline(vk->device(), m_pipeline.handle, nullptr);
|
vk->vkDestroyPipeline(vk->device(), m_pipeline.handle, nullptr);
|
||||||
vk->vkDestroyPipeline(vk->device(), m_pipelineNoDepthClip.handle, nullptr);
|
|
||||||
|
|
||||||
m_pipeline.handle = VK_NULL_HANDLE;
|
m_pipeline.handle = VK_NULL_HANDLE;
|
||||||
m_pipelineNoDepthClip.handle = VK_NULL_HANDLE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DxvkShaderPipelineLibraryHandle DxvkShaderPipelineLibrary::compileShaderPipelineLocked(
|
DxvkShaderPipelineLibraryHandle DxvkShaderPipelineLibrary::compileShaderPipelineLocked() {
|
||||||
const DxvkShaderPipelineLibraryCompileArgs& args) {
|
|
||||||
this->notifyLibraryCompile();
|
this->notifyLibraryCompile();
|
||||||
|
|
||||||
// If this is not the first time we're compiling the pipeline,
|
// If this is not the first time we're compiling the pipeline,
|
||||||
@ -1117,13 +1108,11 @@ namespace dxvk {
|
|||||||
// so that we don't have to decompress our SPIR-V shader again.
|
// so that we don't have to decompress our SPIR-V shader again.
|
||||||
DxvkShaderPipelineLibraryHandle pipeline = { VK_NULL_HANDLE, 0 };
|
DxvkShaderPipelineLibraryHandle pipeline = { VK_NULL_HANDLE, 0 };
|
||||||
|
|
||||||
if (m_compiledOnce && canUsePipelineCacheControl()) {
|
if (m_compiledOnce && canUsePipelineCacheControl())
|
||||||
pipeline = this->compileShaderPipeline(args,
|
pipeline = this->compileShaderPipeline(VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT);
|
||||||
VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pipeline.handle)
|
if (!pipeline.handle)
|
||||||
pipeline = this->compileShaderPipeline(args, 0);
|
pipeline = this->compileShaderPipeline(0);
|
||||||
|
|
||||||
// Well that didn't work
|
// Well that didn't work
|
||||||
if (!pipeline.handle)
|
if (!pipeline.handle)
|
||||||
@ -1145,7 +1134,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
DxvkShaderPipelineLibraryHandle DxvkShaderPipelineLibrary::compileShaderPipeline(
|
DxvkShaderPipelineLibraryHandle DxvkShaderPipelineLibrary::compileShaderPipeline(
|
||||||
const DxvkShaderPipelineLibraryCompileArgs& args,
|
|
||||||
VkPipelineCreateFlags flags) {
|
VkPipelineCreateFlags flags) {
|
||||||
DxvkShaderStageInfo stageInfo(m_device);
|
DxvkShaderStageInfo stageInfo(m_device);
|
||||||
VkShaderStageFlags stageMask = getShaderStages();
|
VkShaderStageFlags stageMask = getShaderStages();
|
||||||
@ -1181,7 +1169,7 @@ namespace dxvk {
|
|||||||
VkPipeline pipeline = VK_NULL_HANDLE;
|
VkPipeline pipeline = VK_NULL_HANDLE;
|
||||||
|
|
||||||
if (stageMask & VK_SHADER_STAGE_VERTEX_BIT)
|
if (stageMask & VK_SHADER_STAGE_VERTEX_BIT)
|
||||||
pipeline = compileVertexShaderPipeline(args, stageInfo, flags);
|
pipeline = compileVertexShaderPipeline(stageInfo, flags);
|
||||||
else if (stageMask & VK_SHADER_STAGE_FRAGMENT_BIT)
|
else if (stageMask & VK_SHADER_STAGE_FRAGMENT_BIT)
|
||||||
pipeline = compileFragmentShaderPipeline(stageInfo, flags);
|
pipeline = compileFragmentShaderPipeline(stageInfo, flags);
|
||||||
else if (stageMask & VK_SHADER_STAGE_COMPUTE_BIT)
|
else if (stageMask & VK_SHADER_STAGE_COMPUTE_BIT)
|
||||||
@ -1193,7 +1181,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
|
|
||||||
VkPipeline DxvkShaderPipelineLibrary::compileVertexShaderPipeline(
|
VkPipeline DxvkShaderPipelineLibrary::compileVertexShaderPipeline(
|
||||||
const DxvkShaderPipelineLibraryCompileArgs& args,
|
|
||||||
const DxvkShaderStageInfo& stageInfo,
|
const DxvkShaderStageInfo& stageInfo,
|
||||||
VkPipelineCreateFlags flags) {
|
VkPipelineCreateFlags flags) {
|
||||||
auto vk = m_device->vkd();
|
auto vk = m_device->vkd();
|
||||||
@ -1240,10 +1227,10 @@ namespace dxvk {
|
|||||||
// Only use the fixed depth clip state if we can't make it dynamic
|
// Only use the fixed depth clip state if we can't make it dynamic
|
||||||
if (!m_device->features().extExtendedDynamicState3.extendedDynamicState3DepthClipEnable) {
|
if (!m_device->features().extExtendedDynamicState3.extendedDynamicState3DepthClipEnable) {
|
||||||
rsDepthClipInfo.pNext = std::exchange(rsInfo.pNext, &rsDepthClipInfo);
|
rsDepthClipInfo.pNext = std::exchange(rsInfo.pNext, &rsDepthClipInfo);
|
||||||
rsDepthClipInfo.depthClipEnable = args.depthClipEnable;
|
rsDepthClipInfo.depthClipEnable = VK_TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rsInfo.depthClampEnable = !args.depthClipEnable;
|
rsInfo.depthClampEnable = VK_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only the view mask is used as input, and since we do not use MultiView, it is always 0
|
// Only the view mask is used as input, and since we do not use MultiView, it is always 0
|
||||||
|
@ -368,26 +368,6 @@ namespace dxvk {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Shader pipeline library compile args
|
|
||||||
*/
|
|
||||||
struct DxvkShaderPipelineLibraryCompileArgs {
|
|
||||||
VkBool32 depthClipEnable = VK_TRUE;
|
|
||||||
|
|
||||||
bool operator == (const DxvkShaderPipelineLibraryCompileArgs& other) const {
|
|
||||||
return depthClipEnable == other.depthClipEnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator != (const DxvkShaderPipelineLibraryCompileArgs& other) const {
|
|
||||||
return !this->operator == (other);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t hash() const {
|
|
||||||
return size_t(depthClipEnable);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Shader set
|
* \brief Shader set
|
||||||
*
|
*
|
||||||
@ -532,11 +512,9 @@ namespace dxvk {
|
|||||||
* Either returns an already compiled pipeline library object, or
|
* Either returns an already compiled pipeline library object, or
|
||||||
* performs the compilation step if that has not happened yet.
|
* performs the compilation step if that has not happened yet.
|
||||||
* Increments the use count by one.
|
* Increments the use count by one.
|
||||||
* \param [in] args Compile arguments
|
|
||||||
* \returns Vulkan pipeline handle
|
* \returns Vulkan pipeline handle
|
||||||
*/
|
*/
|
||||||
DxvkShaderPipelineLibraryHandle acquirePipelineHandle(
|
DxvkShaderPipelineLibraryHandle acquirePipelineHandle();
|
||||||
const DxvkShaderPipelineLibraryCompileArgs& args);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Releases pipeline
|
* \brief Releases pipeline
|
||||||
@ -564,25 +542,21 @@ namespace dxvk {
|
|||||||
const DxvkBindingLayoutObjects* m_layout;
|
const DxvkBindingLayoutObjects* m_layout;
|
||||||
|
|
||||||
dxvk::mutex m_mutex;
|
dxvk::mutex m_mutex;
|
||||||
DxvkShaderPipelineLibraryHandle m_pipeline = { VK_NULL_HANDLE, 0 };
|
DxvkShaderPipelineLibraryHandle m_pipeline = { VK_NULL_HANDLE, 0 };
|
||||||
DxvkShaderPipelineLibraryHandle m_pipelineNoDepthClip = { VK_NULL_HANDLE, 0 };
|
uint32_t m_useCount = 0u;
|
||||||
uint32_t m_useCount = 0u;
|
bool m_compiledOnce = false;
|
||||||
bool m_compiledOnce = false;
|
|
||||||
|
|
||||||
dxvk::mutex m_identifierMutex;
|
dxvk::mutex m_identifierMutex;
|
||||||
DxvkShaderIdentifierSet m_identifiers;
|
DxvkShaderIdentifierSet m_identifiers;
|
||||||
|
|
||||||
void destroyShaderPipelinesLocked();
|
void destroyShaderPipelineLocked();
|
||||||
|
|
||||||
DxvkShaderPipelineLibraryHandle compileShaderPipelineLocked(
|
DxvkShaderPipelineLibraryHandle compileShaderPipelineLocked();
|
||||||
const DxvkShaderPipelineLibraryCompileArgs& args);
|
|
||||||
|
|
||||||
DxvkShaderPipelineLibraryHandle compileShaderPipeline(
|
DxvkShaderPipelineLibraryHandle compileShaderPipeline(
|
||||||
const DxvkShaderPipelineLibraryCompileArgs& args,
|
|
||||||
VkPipelineCreateFlags flags);
|
VkPipelineCreateFlags flags);
|
||||||
|
|
||||||
VkPipeline compileVertexShaderPipeline(
|
VkPipeline compileVertexShaderPipeline(
|
||||||
const DxvkShaderPipelineLibraryCompileArgs& args,
|
|
||||||
const DxvkShaderStageInfo& stageInfo,
|
const DxvkShaderStageInfo& stageInfo,
|
||||||
VkPipelineCreateFlags flags);
|
VkPipelineCreateFlags flags);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user