mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxvk] Rename DxvkBindingState -> DxvkBindingMask
Preparation for some more binding-related work.
This commit is contained in:
parent
eac86fab15
commit
f42f708f72
@ -9,14 +9,14 @@
|
|||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Binding state
|
* \brief Binding mask
|
||||||
*
|
*
|
||||||
* Used to track which resource slots have a compatible
|
* Used to track which resource slots have a compatible
|
||||||
* binding and which ones don't. This is used to set up
|
* binding and which ones don't. This is used to set up
|
||||||
* binding-related specialization constants in shaders.
|
* binding-related specialization constants in shaders.
|
||||||
* \tparam N Number of binding slots
|
* \tparam N Number of binding slots
|
||||||
*/
|
*/
|
||||||
class DxvkBindingState {
|
class DxvkBindingMask {
|
||||||
constexpr static uint32_t BitCount = 32;
|
constexpr static uint32_t BitCount = 32;
|
||||||
constexpr static uint32_t IntCount = (MaxNumActiveBindings + BitCount - 1) / BitCount;
|
constexpr static uint32_t IntCount = (MaxNumActiveBindings + BitCount - 1) / BitCount;
|
||||||
public:
|
public:
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#include "dxvk_binding.h"
|
#include "dxvk_bind_mask.h"
|
||||||
#include "dxvk_buffer.h"
|
#include "dxvk_buffer.h"
|
||||||
#include "dxvk_descriptor.h"
|
#include "dxvk_descriptor.h"
|
||||||
#include "dxvk_event_tracker.h"
|
#include "dxvk_event_tracker.h"
|
||||||
|
@ -107,7 +107,7 @@ namespace dxvk {
|
|||||||
DxvkSpecConstantData specData;
|
DxvkSpecConstantData specData;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < MaxNumActiveBindings; i++)
|
for (uint32_t i = 0; i < MaxNumActiveBindings; i++)
|
||||||
specData.activeBindings[i] = state.bsBindingState.isBound(i) ? VK_TRUE : VK_FALSE;
|
specData.activeBindings[i] = state.bsBindingMask.isBound(i) ? VK_TRUE : VK_FALSE;
|
||||||
|
|
||||||
VkSpecializationInfo specInfo;
|
VkSpecializationInfo specInfo;
|
||||||
specInfo.mapEntryCount = g_specConstantMap.mapEntryCount();
|
specInfo.mapEntryCount = g_specConstantMap.mapEntryCount();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "dxvk_binding.h"
|
#include "dxvk_bind_mask.h"
|
||||||
#include "dxvk_pipecache.h"
|
#include "dxvk_pipecache.h"
|
||||||
#include "dxvk_pipelayout.h"
|
#include "dxvk_pipelayout.h"
|
||||||
#include "dxvk_resource.h"
|
#include "dxvk_resource.h"
|
||||||
@ -20,7 +20,7 @@ namespace dxvk {
|
|||||||
bool operator == (const DxvkComputePipelineStateInfo& other) const;
|
bool operator == (const DxvkComputePipelineStateInfo& other) const;
|
||||||
bool operator != (const DxvkComputePipelineStateInfo& other) const;
|
bool operator != (const DxvkComputePipelineStateInfo& other) const;
|
||||||
|
|
||||||
DxvkBindingState bsBindingState;
|
DxvkBindingMask bsBindingMask;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1902,7 +1902,7 @@ namespace dxvk {
|
|||||||
if (m_flags.test(DxvkContextFlag::CpDirtyPipeline)) {
|
if (m_flags.test(DxvkContextFlag::CpDirtyPipeline)) {
|
||||||
m_flags.clr(DxvkContextFlag::CpDirtyPipeline);
|
m_flags.clr(DxvkContextFlag::CpDirtyPipeline);
|
||||||
|
|
||||||
m_state.cp.state.bsBindingState.clear();
|
m_state.cp.state.bsBindingMask.clear();
|
||||||
m_state.cp.pipeline = m_pipeMgr->createComputePipeline(m_state.cp.cs.shader);
|
m_state.cp.pipeline = m_pipeMgr->createComputePipeline(m_state.cp.cs.shader);
|
||||||
|
|
||||||
if (m_state.cp.pipeline != nullptr)
|
if (m_state.cp.pipeline != nullptr)
|
||||||
@ -1944,7 +1944,7 @@ namespace dxvk {
|
|||||||
if (m_flags.test(DxvkContextFlag::GpDirtyPipeline)) {
|
if (m_flags.test(DxvkContextFlag::GpDirtyPipeline)) {
|
||||||
m_flags.clr(DxvkContextFlag::GpDirtyPipeline);
|
m_flags.clr(DxvkContextFlag::GpDirtyPipeline);
|
||||||
|
|
||||||
m_state.gp.state.bsBindingState.clear();
|
m_state.gp.state.bsBindingMask.clear();
|
||||||
m_state.gp.pipeline = m_pipeMgr->createGraphicsPipeline(
|
m_state.gp.pipeline = m_pipeMgr->createGraphicsPipeline(
|
||||||
m_state.gp.vs.shader,
|
m_state.gp.vs.shader,
|
||||||
m_state.gp.tcs.shader, m_state.gp.tes.shader,
|
m_state.gp.tcs.shader, m_state.gp.tes.shader,
|
||||||
@ -2003,6 +2003,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
this->updateShaderResources(
|
this->updateShaderResources(
|
||||||
VK_PIPELINE_BIND_POINT_COMPUTE,
|
VK_PIPELINE_BIND_POINT_COMPUTE,
|
||||||
|
m_state.cp.state.bsBindingMask,
|
||||||
m_state.cp.pipeline->layout());
|
m_state.cp.pipeline->layout());
|
||||||
|
|
||||||
m_flags.set(
|
m_flags.set(
|
||||||
@ -2019,7 +2020,6 @@ namespace dxvk {
|
|||||||
if (m_flags.test(DxvkContextFlag::CpDirtyDescriptorSet)) {
|
if (m_flags.test(DxvkContextFlag::CpDirtyDescriptorSet)) {
|
||||||
m_cpSet = this->updateShaderDescriptors(
|
m_cpSet = this->updateShaderDescriptors(
|
||||||
VK_PIPELINE_BIND_POINT_COMPUTE,
|
VK_PIPELINE_BIND_POINT_COMPUTE,
|
||||||
m_state.cp.state.bsBindingState,
|
|
||||||
m_state.cp.pipeline->layout());
|
m_state.cp.pipeline->layout());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2046,6 +2046,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
this->updateShaderResources(
|
this->updateShaderResources(
|
||||||
VK_PIPELINE_BIND_POINT_GRAPHICS,
|
VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||||
|
m_state.gp.state.bsBindingMask,
|
||||||
m_state.gp.pipeline->layout());
|
m_state.gp.pipeline->layout());
|
||||||
|
|
||||||
m_flags.set(
|
m_flags.set(
|
||||||
@ -2062,7 +2063,6 @@ namespace dxvk {
|
|||||||
if (m_flags.test(DxvkContextFlag::GpDirtyDescriptorSet)) {
|
if (m_flags.test(DxvkContextFlag::GpDirtyDescriptorSet)) {
|
||||||
m_gpSet = this->updateShaderDescriptors(
|
m_gpSet = this->updateShaderDescriptors(
|
||||||
VK_PIPELINE_BIND_POINT_GRAPHICS,
|
VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||||
m_state.gp.state.bsBindingState,
|
|
||||||
m_state.gp.pipeline->layout());
|
m_state.gp.pipeline->layout());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2080,12 +2080,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
void DxvkContext::updateShaderResources(
|
void DxvkContext::updateShaderResources(
|
||||||
VkPipelineBindPoint bindPoint,
|
VkPipelineBindPoint bindPoint,
|
||||||
|
DxvkBindingMask& bindMask,
|
||||||
const DxvkPipelineLayout* layout) {
|
const DxvkPipelineLayout* layout) {
|
||||||
DxvkBindingState& bindingState =
|
|
||||||
bindPoint == VK_PIPELINE_BIND_POINT_GRAPHICS
|
|
||||||
? m_state.gp.state.bsBindingState
|
|
||||||
: m_state.cp.state.bsBindingState;
|
|
||||||
|
|
||||||
bool updatePipelineState = false;
|
bool updatePipelineState = false;
|
||||||
|
|
||||||
DxvkAttachment depthAttachment;
|
DxvkAttachment depthAttachment;
|
||||||
@ -2100,7 +2096,7 @@ namespace dxvk {
|
|||||||
switch (binding.type) {
|
switch (binding.type) {
|
||||||
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
case VK_DESCRIPTOR_TYPE_SAMPLER:
|
||||||
if (res.sampler != nullptr) {
|
if (res.sampler != nullptr) {
|
||||||
updatePipelineState |= bindingState.setBound(i);
|
updatePipelineState |= bindMask.setBound(i);
|
||||||
|
|
||||||
m_descInfos[i].image.sampler = res.sampler->handle();
|
m_descInfos[i].image.sampler = res.sampler->handle();
|
||||||
m_descInfos[i].image.imageView = VK_NULL_HANDLE;
|
m_descInfos[i].image.imageView = VK_NULL_HANDLE;
|
||||||
@ -2108,14 +2104,14 @@ namespace dxvk {
|
|||||||
|
|
||||||
m_cmd->trackResource(res.sampler);
|
m_cmd->trackResource(res.sampler);
|
||||||
} else {
|
} else {
|
||||||
updatePipelineState |= bindingState.setUnbound(i);
|
updatePipelineState |= bindMask.setUnbound(i);
|
||||||
m_descInfos[i].image = m_device->dummySamplerDescriptor();
|
m_descInfos[i].image = m_device->dummySamplerDescriptor();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
|
case VK_DESCRIPTOR_TYPE_STORAGE_IMAGE:
|
||||||
if (res.imageView != nullptr && res.imageView->handle(binding.view) != VK_NULL_HANDLE) {
|
if (res.imageView != nullptr && res.imageView->handle(binding.view) != VK_NULL_HANDLE) {
|
||||||
updatePipelineState |= bindingState.setBound(i);
|
updatePipelineState |= bindMask.setBound(i);
|
||||||
|
|
||||||
m_descInfos[i].image.sampler = VK_NULL_HANDLE;
|
m_descInfos[i].image.sampler = VK_NULL_HANDLE;
|
||||||
m_descInfos[i].image.imageView = res.imageView->handle(binding.view);
|
m_descInfos[i].image.imageView = res.imageView->handle(binding.view);
|
||||||
@ -2128,14 +2124,14 @@ namespace dxvk {
|
|||||||
m_cmd->trackResource(res.imageView);
|
m_cmd->trackResource(res.imageView);
|
||||||
m_cmd->trackResource(res.imageView->image());
|
m_cmd->trackResource(res.imageView->image());
|
||||||
} else {
|
} else {
|
||||||
updatePipelineState |= bindingState.setUnbound(i);
|
updatePipelineState |= bindMask.setUnbound(i);
|
||||||
m_descInfos[i].image = m_device->dummyImageViewDescriptor(binding.view);
|
m_descInfos[i].image = m_device->dummyImageViewDescriptor(binding.view);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
|
case VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER:
|
||||||
if (res.bufferView != nullptr) {
|
if (res.bufferView != nullptr) {
|
||||||
updatePipelineState |= bindingState.setBound(i);
|
updatePipelineState |= bindMask.setBound(i);
|
||||||
|
|
||||||
res.bufferView->updateView();
|
res.bufferView->updateView();
|
||||||
m_descInfos[i].texelBuffer = res.bufferView->handle();
|
m_descInfos[i].texelBuffer = res.bufferView->handle();
|
||||||
@ -2143,14 +2139,14 @@ namespace dxvk {
|
|||||||
m_cmd->trackResource(res.bufferView->viewResource());
|
m_cmd->trackResource(res.bufferView->viewResource());
|
||||||
m_cmd->trackResource(res.bufferView->bufferResource());
|
m_cmd->trackResource(res.bufferView->bufferResource());
|
||||||
} else {
|
} else {
|
||||||
updatePipelineState |= bindingState.setUnbound(i);
|
updatePipelineState |= bindMask.setUnbound(i);
|
||||||
m_descInfos[i].texelBuffer = m_device->dummyBufferViewDescriptor();
|
m_descInfos[i].texelBuffer = m_device->dummyBufferViewDescriptor();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER:
|
||||||
if (res.bufferSlice.defined()) {
|
if (res.bufferSlice.defined()) {
|
||||||
updatePipelineState |= bindingState.setBound(i);
|
updatePipelineState |= bindMask.setBound(i);
|
||||||
|
|
||||||
auto physicalSlice = res.bufferSlice.physicalSlice();
|
auto physicalSlice = res.bufferSlice.physicalSlice();
|
||||||
m_descInfos[i].buffer.buffer = physicalSlice.handle();
|
m_descInfos[i].buffer.buffer = physicalSlice.handle();
|
||||||
@ -2159,14 +2155,14 @@ namespace dxvk {
|
|||||||
|
|
||||||
m_cmd->trackResource(physicalSlice.resource());
|
m_cmd->trackResource(physicalSlice.resource());
|
||||||
} else {
|
} else {
|
||||||
updatePipelineState |= bindingState.setUnbound(i);
|
updatePipelineState |= bindMask.setUnbound(i);
|
||||||
m_descInfos[i].buffer = m_device->dummyBufferDescriptor();
|
m_descInfos[i].buffer = m_device->dummyBufferDescriptor();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
case VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC:
|
||||||
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
|
case VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC:
|
||||||
if (res.bufferSlice.defined()) {
|
if (res.bufferSlice.defined()) {
|
||||||
updatePipelineState |= bindingState.setBound(i);
|
updatePipelineState |= bindMask.setBound(i);
|
||||||
|
|
||||||
auto physicalSlice = res.bufferSlice.physicalSlice();
|
auto physicalSlice = res.bufferSlice.physicalSlice();
|
||||||
m_descInfos[i].buffer.buffer = physicalSlice.handle();
|
m_descInfos[i].buffer.buffer = physicalSlice.handle();
|
||||||
@ -2175,7 +2171,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
m_cmd->trackResource(physicalSlice.resource());
|
m_cmd->trackResource(physicalSlice.resource());
|
||||||
} else {
|
} else {
|
||||||
updatePipelineState |= bindingState.setUnbound(i);
|
updatePipelineState |= bindMask.setUnbound(i);
|
||||||
m_descInfos[i].buffer = m_device->dummyBufferDescriptor();
|
m_descInfos[i].buffer = m_device->dummyBufferDescriptor();
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
@ -2194,7 +2190,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
VkDescriptorSet DxvkContext::updateShaderDescriptors(
|
VkDescriptorSet DxvkContext::updateShaderDescriptors(
|
||||||
VkPipelineBindPoint bindPoint,
|
VkPipelineBindPoint bindPoint,
|
||||||
const DxvkBindingState& bindingState,
|
|
||||||
const DxvkPipelineLayout* layout) {
|
const DxvkPipelineLayout* layout) {
|
||||||
VkDescriptorSet descriptorSet = VK_NULL_HANDLE;
|
VkDescriptorSet descriptorSet = VK_NULL_HANDLE;
|
||||||
|
|
||||||
@ -2411,7 +2406,7 @@ namespace dxvk {
|
|||||||
bool requiresBarrier = false;
|
bool requiresBarrier = false;
|
||||||
|
|
||||||
for (uint32_t i = 0; i < layout->bindingCount() && !requiresBarrier; i++) {
|
for (uint32_t i = 0; i < layout->bindingCount() && !requiresBarrier; i++) {
|
||||||
if (m_state.cp.state.bsBindingState.isBound(i)) {
|
if (m_state.cp.state.bsBindingMask.isBound(i)) {
|
||||||
const DxvkDescriptorSlot binding = layout->binding(i);
|
const DxvkDescriptorSlot binding = layout->binding(i);
|
||||||
const DxvkShaderResourceSlot& slot = m_rc[binding.slot];
|
const DxvkShaderResourceSlot& slot = m_rc[binding.slot];
|
||||||
|
|
||||||
@ -2464,7 +2459,7 @@ namespace dxvk {
|
|||||||
auto layout = m_state.cp.pipeline->layout();
|
auto layout = m_state.cp.pipeline->layout();
|
||||||
|
|
||||||
for (uint32_t i = 0; i < layout->bindingCount(); i++) {
|
for (uint32_t i = 0; i < layout->bindingCount(); i++) {
|
||||||
if (m_state.cp.state.bsBindingState.isBound(i)) {
|
if (m_state.cp.state.bsBindingMask.isBound(i)) {
|
||||||
const DxvkDescriptorSlot binding = layout->binding(i);
|
const DxvkDescriptorSlot binding = layout->binding(i);
|
||||||
const DxvkShaderResourceSlot& slot = m_rc[binding.slot];
|
const DxvkShaderResourceSlot& slot = m_rc[binding.slot];
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "dxvk_barrier.h"
|
#include "dxvk_barrier.h"
|
||||||
#include "dxvk_binding.h"
|
#include "dxvk_bind_mask.h"
|
||||||
#include "dxvk_cmdlist.h"
|
#include "dxvk_cmdlist.h"
|
||||||
#include "dxvk_context_state.h"
|
#include "dxvk_context_state.h"
|
||||||
#include "dxvk_data.h"
|
#include "dxvk_data.h"
|
||||||
@ -701,11 +701,11 @@ namespace dxvk {
|
|||||||
|
|
||||||
void updateShaderResources(
|
void updateShaderResources(
|
||||||
VkPipelineBindPoint bindPoint,
|
VkPipelineBindPoint bindPoint,
|
||||||
|
DxvkBindingMask& bindMask,
|
||||||
const DxvkPipelineLayout* layout);
|
const DxvkPipelineLayout* layout);
|
||||||
|
|
||||||
VkDescriptorSet updateShaderDescriptors(
|
VkDescriptorSet updateShaderDescriptors(
|
||||||
VkPipelineBindPoint bindPoint,
|
VkPipelineBindPoint bindPoint,
|
||||||
const DxvkBindingState& bindingState,
|
|
||||||
const DxvkPipelineLayout* layout);
|
const DxvkPipelineLayout* layout);
|
||||||
|
|
||||||
void updateShaderDescriptorSetBinding(
|
void updateShaderDescriptorSetBinding(
|
||||||
|
@ -165,7 +165,7 @@ namespace dxvk {
|
|||||||
specData.rasterizerSampleCount = uint32_t(state.msSampleCount);
|
specData.rasterizerSampleCount = uint32_t(state.msSampleCount);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < MaxNumActiveBindings; i++)
|
for (uint32_t i = 0; i < MaxNumActiveBindings; i++)
|
||||||
specData.activeBindings[i] = state.bsBindingState.isBound(i) ? VK_TRUE : VK_FALSE;
|
specData.activeBindings[i] = state.bsBindingMask.isBound(i) ? VK_TRUE : VK_FALSE;
|
||||||
|
|
||||||
VkSpecializationInfo specInfo;
|
VkSpecializationInfo specInfo;
|
||||||
specInfo.mapEntryCount = g_specConstantMap.mapEntryCount();
|
specInfo.mapEntryCount = g_specConstantMap.mapEntryCount();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include "dxvk_binding.h"
|
#include "dxvk_bind_mask.h"
|
||||||
#include "dxvk_constant_state.h"
|
#include "dxvk_constant_state.h"
|
||||||
#include "dxvk_pipecache.h"
|
#include "dxvk_pipecache.h"
|
||||||
#include "dxvk_pipelayout.h"
|
#include "dxvk_pipelayout.h"
|
||||||
@ -34,7 +34,7 @@ namespace dxvk {
|
|||||||
bool operator == (const DxvkGraphicsPipelineStateInfo& other) const;
|
bool operator == (const DxvkGraphicsPipelineStateInfo& other) const;
|
||||||
bool operator != (const DxvkGraphicsPipelineStateInfo& other) const;
|
bool operator != (const DxvkGraphicsPipelineStateInfo& other) const;
|
||||||
|
|
||||||
DxvkBindingState bsBindingState;
|
DxvkBindingMask bsBindingMask;
|
||||||
|
|
||||||
VkPrimitiveTopology iaPrimitiveTopology;
|
VkPrimitiveTopology iaPrimitiveTopology;
|
||||||
VkBool32 iaPrimitiveRestart;
|
VkBool32 iaPrimitiveRestart;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user