mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-04 16:24:29 +01:00
[dxvk] Expose depth bias representation/exact controls
This commit is contained in:
parent
5fbb0dd4ba
commit
4e9853f608
@ -824,6 +824,12 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void cmdSetDepthBias2(
|
||||
const VkDepthBiasInfoEXT *depthBiasInfo) {
|
||||
m_vkd->vkCmdSetDepthBias2EXT(m_cmd.execBuffer, depthBiasInfo);
|
||||
}
|
||||
|
||||
|
||||
void cmdSetDepthBounds(
|
||||
float minDepthBounds,
|
||||
float maxDepthBounds) {
|
||||
|
@ -29,6 +29,27 @@ namespace dxvk {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Depth bias representation
|
||||
*
|
||||
* Stores depth bias representation info.
|
||||
*/
|
||||
struct DxvkDepthBiasRepresentation {
|
||||
VkDepthBiasRepresentationEXT depthBiasRepresentation;
|
||||
VkBool32 depthBiasExact;
|
||||
|
||||
bool operator == (const DxvkDepthBiasRepresentation& other) const {
|
||||
return depthBiasRepresentation == other.depthBiasRepresentation
|
||||
&& depthBiasExact == other.depthBiasExact;
|
||||
}
|
||||
|
||||
bool operator != (const DxvkDepthBiasRepresentation& other) const {
|
||||
return depthBiasRepresentation != other.depthBiasRepresentation
|
||||
|| depthBiasExact != other.depthBiasExact;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Depth bias
|
||||
*
|
||||
|
@ -2442,6 +2442,15 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::setDepthBiasRepresentation(
|
||||
DxvkDepthBiasRepresentation depthBiasRepresentation) {
|
||||
if (m_state.dyn.depthBiasRepresentation != depthBiasRepresentation) {
|
||||
m_state.dyn.depthBiasRepresentation = depthBiasRepresentation;
|
||||
m_flags.set(DxvkContextFlag::GpDirtyDepthBias);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DxvkContext::setDepthBounds(
|
||||
DxvkDepthBounds depthBounds) {
|
||||
if (m_state.dyn.depthBounds != depthBounds) {
|
||||
@ -5784,11 +5793,25 @@ namespace dxvk {
|
||||
DxvkContextFlag::GpDynamicDepthBias)) {
|
||||
m_flags.clr(DxvkContextFlag::GpDirtyDepthBias);
|
||||
|
||||
if (m_device->features().extDepthBiasControl.depthBiasControl) {
|
||||
VkDepthBiasRepresentationInfoEXT depthBiasRepresentation = { VK_STRUCTURE_TYPE_DEPTH_BIAS_REPRESENTATION_INFO_EXT };
|
||||
depthBiasRepresentation.depthBiasRepresentation = m_state.dyn.depthBiasRepresentation.depthBiasRepresentation;
|
||||
depthBiasRepresentation.depthBiasExact = m_state.dyn.depthBiasRepresentation.depthBiasExact;
|
||||
|
||||
VkDepthBiasInfoEXT depthBiasInfo = { VK_STRUCTURE_TYPE_DEPTH_BIAS_INFO_EXT };
|
||||
depthBiasInfo.pNext = &depthBiasRepresentation;
|
||||
depthBiasInfo.depthBiasConstantFactor = m_state.dyn.depthBias.depthBiasConstant;
|
||||
depthBiasInfo.depthBiasClamp = m_state.dyn.depthBias.depthBiasClamp;
|
||||
depthBiasInfo.depthBiasSlopeFactor = m_state.dyn.depthBias.depthBiasSlope;
|
||||
|
||||
m_cmd->cmdSetDepthBias2(&depthBiasInfo);
|
||||
} else {
|
||||
m_cmd->cmdSetDepthBias(
|
||||
m_state.dyn.depthBias.depthBiasConstant,
|
||||
m_state.dyn.depthBias.depthBiasClamp,
|
||||
m_state.dyn.depthBias.depthBiasSlope);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_flags.all(DxvkContextFlag::GpDirtyDepthBounds,
|
||||
DxvkContextFlag::GpDynamicDepthBounds)) {
|
||||
|
@ -1142,6 +1142,14 @@ namespace dxvk {
|
||||
void setDepthBias(
|
||||
DxvkDepthBias depthBias);
|
||||
|
||||
/**
|
||||
* \brief Sets depth bias representation
|
||||
*
|
||||
* \param [in] depthBiasRepresentation Depth bias representation
|
||||
*/
|
||||
void setDepthBiasRepresentation(
|
||||
DxvkDepthBiasRepresentation depthBiasRepresentation);
|
||||
|
||||
/**
|
||||
* \brief Sets depth bounds
|
||||
*
|
||||
|
@ -152,6 +152,7 @@ namespace dxvk {
|
||||
struct DxvkDynamicState {
|
||||
DxvkBlendConstants blendConstants = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
DxvkDepthBias depthBias = { 0.0f, 0.0f, 0.0f };
|
||||
DxvkDepthBiasRepresentation depthBiasRepresentation = { VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORMAT_EXT, false };
|
||||
DxvkDepthBounds depthBounds = { false, 0.0f, 1.0f };
|
||||
uint32_t stencilReference = 0;
|
||||
VkCullModeFlags cullMode = VK_CULL_MODE_BACK_BIT;
|
||||
|
Loading…
Reference in New Issue
Block a user