mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-25 16:54:15 +01:00
[dxvk/d3d11] Refactored resource binding
Slightly reduces overhead of D3D11 *SetShaderResources methods.
This commit is contained in:
parent
b72f11a0bf
commit
5ef0f31c66
@ -1166,7 +1166,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumBuffers,
|
UINT NumBuffers,
|
||||||
ID3D11Buffer* const* ppConstantBuffers) {
|
ID3D11Buffer* const* ppConstantBuffers) {
|
||||||
this->BindConstantBuffers(
|
this->SetConstantBuffers(
|
||||||
DxbcProgramType::VertexShader,
|
DxbcProgramType::VertexShader,
|
||||||
m_state.vs.constantBuffers,
|
m_state.vs.constantBuffers,
|
||||||
StartSlot, NumBuffers,
|
StartSlot, NumBuffers,
|
||||||
@ -1178,7 +1178,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumViews,
|
UINT NumViews,
|
||||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||||
this->BindShaderResources(
|
this->SetShaderResources(
|
||||||
DxbcProgramType::VertexShader,
|
DxbcProgramType::VertexShader,
|
||||||
m_state.vs.shaderResources,
|
m_state.vs.shaderResources,
|
||||||
StartSlot, NumViews,
|
StartSlot, NumViews,
|
||||||
@ -1190,7 +1190,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumSamplers,
|
UINT NumSamplers,
|
||||||
ID3D11SamplerState* const* ppSamplers) {
|
ID3D11SamplerState* const* ppSamplers) {
|
||||||
this->BindSamplers(
|
this->SetSamplers(
|
||||||
DxbcProgramType::VertexShader,
|
DxbcProgramType::VertexShader,
|
||||||
m_state.vs.samplers,
|
m_state.vs.samplers,
|
||||||
StartSlot, NumSamplers,
|
StartSlot, NumSamplers,
|
||||||
@ -1257,7 +1257,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumViews,
|
UINT NumViews,
|
||||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||||
this->BindShaderResources(
|
this->SetShaderResources(
|
||||||
DxbcProgramType::HullShader,
|
DxbcProgramType::HullShader,
|
||||||
m_state.hs.shaderResources,
|
m_state.hs.shaderResources,
|
||||||
StartSlot, NumViews,
|
StartSlot, NumViews,
|
||||||
@ -1269,7 +1269,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumBuffers,
|
UINT NumBuffers,
|
||||||
ID3D11Buffer* const* ppConstantBuffers) {
|
ID3D11Buffer* const* ppConstantBuffers) {
|
||||||
this->BindConstantBuffers(
|
this->SetConstantBuffers(
|
||||||
DxbcProgramType::HullShader,
|
DxbcProgramType::HullShader,
|
||||||
m_state.hs.constantBuffers,
|
m_state.hs.constantBuffers,
|
||||||
StartSlot, NumBuffers,
|
StartSlot, NumBuffers,
|
||||||
@ -1281,7 +1281,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumSamplers,
|
UINT NumSamplers,
|
||||||
ID3D11SamplerState* const* ppSamplers) {
|
ID3D11SamplerState* const* ppSamplers) {
|
||||||
this->BindSamplers(
|
this->SetSamplers(
|
||||||
DxbcProgramType::HullShader,
|
DxbcProgramType::HullShader,
|
||||||
m_state.hs.samplers,
|
m_state.hs.samplers,
|
||||||
StartSlot, NumSamplers,
|
StartSlot, NumSamplers,
|
||||||
@ -1348,7 +1348,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumViews,
|
UINT NumViews,
|
||||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||||
this->BindShaderResources(
|
this->SetShaderResources(
|
||||||
DxbcProgramType::DomainShader,
|
DxbcProgramType::DomainShader,
|
||||||
m_state.ds.shaderResources,
|
m_state.ds.shaderResources,
|
||||||
StartSlot, NumViews,
|
StartSlot, NumViews,
|
||||||
@ -1360,7 +1360,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumBuffers,
|
UINT NumBuffers,
|
||||||
ID3D11Buffer* const* ppConstantBuffers) {
|
ID3D11Buffer* const* ppConstantBuffers) {
|
||||||
this->BindConstantBuffers(
|
this->SetConstantBuffers(
|
||||||
DxbcProgramType::DomainShader,
|
DxbcProgramType::DomainShader,
|
||||||
m_state.ds.constantBuffers,
|
m_state.ds.constantBuffers,
|
||||||
StartSlot, NumBuffers,
|
StartSlot, NumBuffers,
|
||||||
@ -1372,7 +1372,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumSamplers,
|
UINT NumSamplers,
|
||||||
ID3D11SamplerState* const* ppSamplers) {
|
ID3D11SamplerState* const* ppSamplers) {
|
||||||
this->BindSamplers(
|
this->SetSamplers(
|
||||||
DxbcProgramType::DomainShader,
|
DxbcProgramType::DomainShader,
|
||||||
m_state.ds.samplers,
|
m_state.ds.samplers,
|
||||||
StartSlot, NumSamplers,
|
StartSlot, NumSamplers,
|
||||||
@ -1439,7 +1439,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumBuffers,
|
UINT NumBuffers,
|
||||||
ID3D11Buffer* const* ppConstantBuffers) {
|
ID3D11Buffer* const* ppConstantBuffers) {
|
||||||
this->BindConstantBuffers(
|
this->SetConstantBuffers(
|
||||||
DxbcProgramType::GeometryShader,
|
DxbcProgramType::GeometryShader,
|
||||||
m_state.gs.constantBuffers,
|
m_state.gs.constantBuffers,
|
||||||
StartSlot, NumBuffers,
|
StartSlot, NumBuffers,
|
||||||
@ -1451,7 +1451,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumViews,
|
UINT NumViews,
|
||||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||||
this->BindShaderResources(
|
this->SetShaderResources(
|
||||||
DxbcProgramType::GeometryShader,
|
DxbcProgramType::GeometryShader,
|
||||||
m_state.gs.shaderResources,
|
m_state.gs.shaderResources,
|
||||||
StartSlot, NumViews,
|
StartSlot, NumViews,
|
||||||
@ -1463,7 +1463,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumSamplers,
|
UINT NumSamplers,
|
||||||
ID3D11SamplerState* const* ppSamplers) {
|
ID3D11SamplerState* const* ppSamplers) {
|
||||||
this->BindSamplers(
|
this->SetSamplers(
|
||||||
DxbcProgramType::GeometryShader,
|
DxbcProgramType::GeometryShader,
|
||||||
m_state.gs.samplers,
|
m_state.gs.samplers,
|
||||||
StartSlot, NumSamplers,
|
StartSlot, NumSamplers,
|
||||||
@ -1530,7 +1530,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumBuffers,
|
UINT NumBuffers,
|
||||||
ID3D11Buffer* const* ppConstantBuffers) {
|
ID3D11Buffer* const* ppConstantBuffers) {
|
||||||
this->BindConstantBuffers(
|
this->SetConstantBuffers(
|
||||||
DxbcProgramType::PixelShader,
|
DxbcProgramType::PixelShader,
|
||||||
m_state.ps.constantBuffers,
|
m_state.ps.constantBuffers,
|
||||||
StartSlot, NumBuffers,
|
StartSlot, NumBuffers,
|
||||||
@ -1542,7 +1542,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumViews,
|
UINT NumViews,
|
||||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||||
this->BindShaderResources(
|
this->SetShaderResources(
|
||||||
DxbcProgramType::PixelShader,
|
DxbcProgramType::PixelShader,
|
||||||
m_state.ps.shaderResources,
|
m_state.ps.shaderResources,
|
||||||
StartSlot, NumViews,
|
StartSlot, NumViews,
|
||||||
@ -1554,7 +1554,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumSamplers,
|
UINT NumSamplers,
|
||||||
ID3D11SamplerState* const* ppSamplers) {
|
ID3D11SamplerState* const* ppSamplers) {
|
||||||
this->BindSamplers(
|
this->SetSamplers(
|
||||||
DxbcProgramType::PixelShader,
|
DxbcProgramType::PixelShader,
|
||||||
m_state.ps.samplers,
|
m_state.ps.samplers,
|
||||||
StartSlot, NumSamplers,
|
StartSlot, NumSamplers,
|
||||||
@ -1621,7 +1621,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumBuffers,
|
UINT NumBuffers,
|
||||||
ID3D11Buffer* const* ppConstantBuffers) {
|
ID3D11Buffer* const* ppConstantBuffers) {
|
||||||
this->BindConstantBuffers(
|
this->SetConstantBuffers(
|
||||||
DxbcProgramType::ComputeShader,
|
DxbcProgramType::ComputeShader,
|
||||||
m_state.cs.constantBuffers,
|
m_state.cs.constantBuffers,
|
||||||
StartSlot, NumBuffers,
|
StartSlot, NumBuffers,
|
||||||
@ -1633,7 +1633,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumViews,
|
UINT NumViews,
|
||||||
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
ID3D11ShaderResourceView* const* ppShaderResourceViews) {
|
||||||
this->BindShaderResources(
|
this->SetShaderResources(
|
||||||
DxbcProgramType::ComputeShader,
|
DxbcProgramType::ComputeShader,
|
||||||
m_state.cs.shaderResources,
|
m_state.cs.shaderResources,
|
||||||
StartSlot, NumViews,
|
StartSlot, NumViews,
|
||||||
@ -1645,7 +1645,7 @@ namespace dxvk {
|
|||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumSamplers,
|
UINT NumSamplers,
|
||||||
ID3D11SamplerState* const* ppSamplers) {
|
ID3D11SamplerState* const* ppSamplers) {
|
||||||
this->BindSamplers(
|
this->SetSamplers(
|
||||||
DxbcProgramType::ComputeShader,
|
DxbcProgramType::ComputeShader,
|
||||||
m_state.cs.samplers,
|
m_state.cs.samplers,
|
||||||
StartSlot, NumSamplers,
|
StartSlot, NumSamplers,
|
||||||
@ -1658,7 +1658,7 @@ namespace dxvk {
|
|||||||
UINT NumUAVs,
|
UINT NumUAVs,
|
||||||
ID3D11UnorderedAccessView* const* ppUnorderedAccessViews,
|
ID3D11UnorderedAccessView* const* ppUnorderedAccessViews,
|
||||||
const UINT* pUAVInitialCounts) {
|
const UINT* pUAVInitialCounts) {
|
||||||
this->BindUnorderedAccessViews(
|
this->SetUnorderedAccessViews(
|
||||||
DxbcProgramType::ComputeShader,
|
DxbcProgramType::ComputeShader,
|
||||||
m_state.cs.unorderedAccessViews,
|
m_state.cs.unorderedAccessViews,
|
||||||
StartSlot, NumUAVs,
|
StartSlot, NumUAVs,
|
||||||
@ -1762,7 +1762,7 @@ namespace dxvk {
|
|||||||
// the graphics pipeline even though this code may
|
// the graphics pipeline even though this code may
|
||||||
// suggest that they are limited to the pixel shader.
|
// suggest that they are limited to the pixel shader.
|
||||||
// This behaviour is only required for FL_11_1.
|
// This behaviour is only required for FL_11_1.
|
||||||
BindUnorderedAccessViews(
|
SetUnorderedAccessViews(
|
||||||
DxbcProgramType::PixelShader,
|
DxbcProgramType::PixelShader,
|
||||||
m_state.ps.unorderedAccessViews,
|
m_state.ps.unorderedAccessViews,
|
||||||
UAVStartSlot, NumUAVs,
|
UAVStartSlot, NumUAVs,
|
||||||
@ -2098,7 +2098,61 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void D3D11DeviceContext::BindConstantBuffers(
|
void D3D11DeviceContext::BindConstantBuffer(
|
||||||
|
UINT Slot,
|
||||||
|
D3D11Buffer* pBuffer) {
|
||||||
|
EmitCs([
|
||||||
|
cSlotId = Slot,
|
||||||
|
cBufferSlice = pBuffer != nullptr ? pBuffer->GetBufferSlice() : DxvkBufferSlice()
|
||||||
|
] (DxvkContext* ctx) {
|
||||||
|
ctx->bindResourceBuffer(cSlotId, cBufferSlice);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void D3D11DeviceContext::BindSampler(
|
||||||
|
UINT Slot,
|
||||||
|
D3D11SamplerState* pSampler) {
|
||||||
|
EmitCs([
|
||||||
|
cSlotId = Slot,
|
||||||
|
cSampler = pSampler != nullptr ? pSampler->GetDXVKSampler() : nullptr
|
||||||
|
] (DxvkContext* ctx) {
|
||||||
|
ctx->bindResourceSampler(cSlotId, cSampler);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void D3D11DeviceContext::BindShaderResource(
|
||||||
|
UINT Slot,
|
||||||
|
D3D11ShaderResourceView* pResource) {
|
||||||
|
EmitCs([
|
||||||
|
cSlotId = Slot,
|
||||||
|
cImageView = pResource != nullptr ? pResource->GetImageView() : nullptr,
|
||||||
|
cBufferView = pResource != nullptr ? pResource->GetBufferView() : nullptr
|
||||||
|
] (DxvkContext* ctx) {
|
||||||
|
ctx->bindResourceView(cSlotId, cImageView, cBufferView);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void D3D11DeviceContext::BindUnorderedAccessView(
|
||||||
|
UINT UavSlot,
|
||||||
|
UINT CtrSlot,
|
||||||
|
D3D11UnorderedAccessView* pUav) {
|
||||||
|
EmitCs([
|
||||||
|
cUavSlotId = UavSlot,
|
||||||
|
cCtrSlotId = CtrSlot,
|
||||||
|
cImageView = pUav != nullptr ? pUav->GetImageView() : nullptr,
|
||||||
|
cBufferView = pUav != nullptr ? pUav->GetBufferView() : nullptr,
|
||||||
|
cCounterSlice = pUav != nullptr ? pUav->GetCounterSlice() : DxvkBufferSlice()
|
||||||
|
] (DxvkContext* ctx) {
|
||||||
|
ctx->bindResourceView (cUavSlotId, cImageView, cBufferView);
|
||||||
|
ctx->bindResourceBuffer (cCtrSlotId, cCounterSlice);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void D3D11DeviceContext::SetConstantBuffers(
|
||||||
DxbcProgramType ShaderStage,
|
DxbcProgramType ShaderStage,
|
||||||
D3D11ConstantBufferBindings& Bindings,
|
D3D11ConstantBufferBindings& Bindings,
|
||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
@ -2113,21 +2167,13 @@ namespace dxvk {
|
|||||||
|
|
||||||
if (Bindings[StartSlot + i] != newBuffer) {
|
if (Bindings[StartSlot + i] != newBuffer) {
|
||||||
Bindings[StartSlot + i] = newBuffer;
|
Bindings[StartSlot + i] = newBuffer;
|
||||||
|
BindConstantBuffer(slotId + i, newBuffer);
|
||||||
EmitCs([
|
|
||||||
cSlotId = slotId + i,
|
|
||||||
cSlice = newBuffer != nullptr
|
|
||||||
? newBuffer->GetBufferSlice()
|
|
||||||
: DxvkBufferSlice()
|
|
||||||
] (DxvkContext* ctx) {
|
|
||||||
ctx->bindResourceBuffer(cSlotId, cSlice);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void D3D11DeviceContext::BindSamplers(
|
void D3D11DeviceContext::SetSamplers(
|
||||||
DxbcProgramType ShaderStage,
|
DxbcProgramType ShaderStage,
|
||||||
D3D11SamplerBindings& Bindings,
|
D3D11SamplerBindings& Bindings,
|
||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
@ -2142,21 +2188,13 @@ namespace dxvk {
|
|||||||
|
|
||||||
if (Bindings[StartSlot + i] != sampler) {
|
if (Bindings[StartSlot + i] != sampler) {
|
||||||
Bindings[StartSlot + i] = sampler;
|
Bindings[StartSlot + i] = sampler;
|
||||||
|
BindSampler(slotId + i, sampler);
|
||||||
EmitCs([
|
|
||||||
cSlotId = slotId + i,
|
|
||||||
cSampler = sampler != nullptr
|
|
||||||
? sampler->GetDXVKSampler()
|
|
||||||
: nullptr
|
|
||||||
] (DxvkContext* ctx) {
|
|
||||||
ctx->bindResourceSampler(cSlotId, cSampler);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void D3D11DeviceContext::BindShaderResources(
|
void D3D11DeviceContext::SetShaderResources(
|
||||||
DxbcProgramType ShaderStage,
|
DxbcProgramType ShaderStage,
|
||||||
D3D11ShaderResourceBindings& Bindings,
|
D3D11ShaderResourceBindings& Bindings,
|
||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
@ -2171,34 +2209,13 @@ namespace dxvk {
|
|||||||
|
|
||||||
if (Bindings[StartSlot + i] != resView) {
|
if (Bindings[StartSlot + i] != resView) {
|
||||||
Bindings[StartSlot + i] = resView;
|
Bindings[StartSlot + i] = resView;
|
||||||
|
BindShaderResource(slotId + i, resView);
|
||||||
if (resView != nullptr) {
|
|
||||||
// Figure out what we have to bind based on the resource type
|
|
||||||
if (resView->GetResourceType() == D3D11_RESOURCE_DIMENSION_BUFFER) {
|
|
||||||
EmitCs([cSlotId = slotId + i, cView = resView->GetBufferView()]
|
|
||||||
(DxvkContext* ctx) {
|
|
||||||
ctx->bindResourceTexelBuffer(cSlotId, cView);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
EmitCs([cSlotId = slotId + i, cView = resView->GetImageView()]
|
|
||||||
(DxvkContext* ctx) {
|
|
||||||
ctx->bindResourceImage(cSlotId, cView);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// When unbinding a resource, it doesn't really matter if
|
|
||||||
// the resource type is correct, so we'll just bind a null
|
|
||||||
// image to the given resource slot
|
|
||||||
EmitCs([cSlotId = slotId + i] (DxvkContext* ctx) {
|
|
||||||
ctx->bindResourceImage(cSlotId, nullptr);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void D3D11DeviceContext::BindUnorderedAccessViews(
|
void D3D11DeviceContext::SetUnorderedAccessViews(
|
||||||
DxbcProgramType ShaderStage,
|
DxbcProgramType ShaderStage,
|
||||||
D3D11UnorderedAccessBindings& Bindings,
|
D3D11UnorderedAccessBindings& Bindings,
|
||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
@ -2217,35 +2234,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
if (Bindings[StartSlot + i] != uav) {
|
if (Bindings[StartSlot + i] != uav) {
|
||||||
Bindings[StartSlot + i] = uav;
|
Bindings[StartSlot + i] = uav;
|
||||||
|
BindUnorderedAccessView(uavSlotId + i, ctrSlotId + i, uav);
|
||||||
if (uav != nullptr) {
|
|
||||||
// Figure out what we have to bind based on the resource type
|
|
||||||
if (uav->GetResourceType() == D3D11_RESOURCE_DIMENSION_BUFFER) {
|
|
||||||
EmitCs([
|
|
||||||
cUavSlotId = uavSlotId + i,
|
|
||||||
cCtrSlotId = ctrSlotId + i,
|
|
||||||
cUavBuffer = uav->GetBufferView(),
|
|
||||||
cCtrBuffer = uav->GetCounterSlice()
|
|
||||||
] (DxvkContext* ctx) {
|
|
||||||
ctx->bindResourceTexelBuffer(cUavSlotId, cUavBuffer);
|
|
||||||
ctx->bindResourceBuffer (cCtrSlotId, cCtrBuffer);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
EmitCs([cUavSlotId = uavSlotId + i, cUavImage = uav->GetImageView()]
|
|
||||||
(DxvkContext* ctx) {
|
|
||||||
ctx->bindResourceImage(cUavSlotId, cUavImage);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// When unbinding a resource, it doesn't really matter if
|
|
||||||
// the resource type is correct, so we'll just bind a null
|
|
||||||
// image to the given resource slot
|
|
||||||
EmitCs([cUavSlotId = uavSlotId + i, cCtrSlotId = ctrSlotId + i]
|
|
||||||
(DxvkContext* ctx) {
|
|
||||||
ctx->bindResourceTexelBuffer(cUavSlotId, nullptr);
|
|
||||||
ctx->bindResourceBuffer (cCtrSlotId, DxvkBufferSlice());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -552,28 +552,45 @@ namespace dxvk {
|
|||||||
UINT Offset,
|
UINT Offset,
|
||||||
DXGI_FORMAT Format);
|
DXGI_FORMAT Format);
|
||||||
|
|
||||||
void BindConstantBuffers(
|
void BindConstantBuffer(
|
||||||
|
UINT Slot,
|
||||||
|
D3D11Buffer* pBuffer);
|
||||||
|
|
||||||
|
void BindSampler(
|
||||||
|
UINT Slot,
|
||||||
|
D3D11SamplerState* pSampler);
|
||||||
|
|
||||||
|
void BindShaderResource(
|
||||||
|
UINT Slot,
|
||||||
|
D3D11ShaderResourceView* pResource);
|
||||||
|
|
||||||
|
void BindUnorderedAccessView(
|
||||||
|
UINT UavSlot,
|
||||||
|
UINT CtrSlot,
|
||||||
|
D3D11UnorderedAccessView* pUav);
|
||||||
|
|
||||||
|
void SetConstantBuffers(
|
||||||
DxbcProgramType ShaderStage,
|
DxbcProgramType ShaderStage,
|
||||||
D3D11ConstantBufferBindings& Bindings,
|
D3D11ConstantBufferBindings& Bindings,
|
||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumBuffers,
|
UINT NumBuffers,
|
||||||
ID3D11Buffer* const* ppConstantBuffers);
|
ID3D11Buffer* const* ppConstantBuffers);
|
||||||
|
|
||||||
void BindSamplers(
|
void SetSamplers(
|
||||||
DxbcProgramType ShaderStage,
|
DxbcProgramType ShaderStage,
|
||||||
D3D11SamplerBindings& Bindings,
|
D3D11SamplerBindings& Bindings,
|
||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumSamplers,
|
UINT NumSamplers,
|
||||||
ID3D11SamplerState* const* ppSamplers);
|
ID3D11SamplerState* const* ppSamplers);
|
||||||
|
|
||||||
void BindShaderResources(
|
void SetShaderResources(
|
||||||
DxbcProgramType ShaderStage,
|
DxbcProgramType ShaderStage,
|
||||||
D3D11ShaderResourceBindings& Bindings,
|
D3D11ShaderResourceBindings& Bindings,
|
||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
UINT NumResources,
|
UINT NumResources,
|
||||||
ID3D11ShaderResourceView* const* ppResources);
|
ID3D11ShaderResourceView* const* ppResources);
|
||||||
|
|
||||||
void BindUnorderedAccessViews(
|
void SetUnorderedAccessViews(
|
||||||
DxbcProgramType ShaderStage,
|
DxbcProgramType ShaderStage,
|
||||||
D3D11UnorderedAccessBindings& Bindings,
|
D3D11UnorderedAccessBindings& Bindings,
|
||||||
UINT StartSlot,
|
UINT StartSlot,
|
||||||
|
@ -205,14 +205,14 @@ namespace dxvk {
|
|||||||
m_blendMode.enableBlending = VK_FALSE;
|
m_blendMode.enableBlending = VK_FALSE;
|
||||||
m_context->setBlendMode(0, m_blendMode);
|
m_context->setBlendMode(0, m_blendMode);
|
||||||
|
|
||||||
m_context->bindResourceImage(BindingIds::Texture, m_backBufferView);
|
m_context->bindResourceView(BindingIds::Texture, m_backBufferView, nullptr);
|
||||||
m_context->draw(4, 1, 0, 0);
|
m_context->draw(4, 1, 0, 0);
|
||||||
|
|
||||||
if (m_hud != nullptr) {
|
if (m_hud != nullptr) {
|
||||||
m_blendMode.enableBlending = VK_TRUE;
|
m_blendMode.enableBlending = VK_TRUE;
|
||||||
m_context->setBlendMode(0, m_blendMode);
|
m_context->setBlendMode(0, m_blendMode);
|
||||||
|
|
||||||
m_context->bindResourceImage(BindingIds::Texture, m_hud->texture());
|
m_context->bindResourceView(BindingIds::Texture, m_hud->texture(), nullptr);
|
||||||
m_context->draw(4, 1, 0, 0);
|
m_context->draw(4, 1, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,12 +135,14 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::bindResourceTexelBuffer(
|
void DxvkContext::bindResourceView(
|
||||||
uint32_t slot,
|
uint32_t slot,
|
||||||
|
const Rc<DxvkImageView>& imageView,
|
||||||
const Rc<DxvkBufferView>& bufferView) {
|
const Rc<DxvkBufferView>& bufferView) {
|
||||||
if (m_rc[slot].bufferView != bufferView) {
|
if (m_rc[slot].imageView != imageView
|
||||||
|
|| m_rc[slot].bufferView != bufferView) {
|
||||||
m_rc[slot].sampler = nullptr;
|
m_rc[slot].sampler = nullptr;
|
||||||
m_rc[slot].imageView = nullptr;
|
m_rc[slot].imageView = imageView;
|
||||||
m_rc[slot].bufferView = bufferView;
|
m_rc[slot].bufferView = bufferView;
|
||||||
m_rc[slot].bufferSlice = DxvkBufferSlice();
|
m_rc[slot].bufferSlice = DxvkBufferSlice();
|
||||||
|
|
||||||
@ -151,22 +153,6 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::bindResourceImage(
|
|
||||||
uint32_t slot,
|
|
||||||
const Rc<DxvkImageView>& image) {
|
|
||||||
if (m_rc[slot].imageView != image) {
|
|
||||||
m_rc[slot].sampler = nullptr;
|
|
||||||
m_rc[slot].imageView = image;
|
|
||||||
m_rc[slot].bufferView = nullptr;
|
|
||||||
m_rc[slot].bufferSlice = DxvkBufferSlice();
|
|
||||||
|
|
||||||
m_flags.set(
|
|
||||||
DxvkContextFlag::CpDirtyResources,
|
|
||||||
DxvkContextFlag::GpDirtyResources);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DxvkContext::bindResourceSampler(
|
void DxvkContext::bindResourceSampler(
|
||||||
uint32_t slot,
|
uint32_t slot,
|
||||||
const Rc<DxvkSampler>& sampler) {
|
const Rc<DxvkSampler>& sampler) {
|
||||||
|
@ -96,28 +96,19 @@ namespace dxvk {
|
|||||||
const DxvkBufferSlice& buffer);
|
const DxvkBufferSlice& buffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Binds texel buffer view
|
* \brief Binds image or buffer view
|
||||||
*
|
*
|
||||||
* Can be used for both uniform texel
|
* Can be used for sampled images with a dedicated
|
||||||
* buffers and storage texel buffers.
|
* sampler and for storage images, as well as for
|
||||||
* \param [in] slot Resource binding slot
|
* uniform texel buffers and storage texel buffers.
|
||||||
* \param [in] bufferView Buffer view to bind
|
|
||||||
*/
|
|
||||||
void bindResourceTexelBuffer(
|
|
||||||
uint32_t slot,
|
|
||||||
const Rc<DxvkBufferView>& bufferView);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Binds image view
|
|
||||||
*
|
|
||||||
* Can be used for sampled images with a
|
|
||||||
* dedicated sampler and storage images.
|
|
||||||
* \param [in] slot Resource binding slot
|
* \param [in] slot Resource binding slot
|
||||||
* \param [in] imageView Image view to bind
|
* \param [in] imageView Image view to bind
|
||||||
|
* \param [in] bufferView Buffer view to bind
|
||||||
*/
|
*/
|
||||||
void bindResourceImage(
|
void bindResourceView(
|
||||||
uint32_t slot,
|
uint32_t slot,
|
||||||
const Rc<DxvkImageView>& image);
|
const Rc<DxvkImageView>& imageView,
|
||||||
|
const Rc<DxvkBufferView>& bufferView);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Binds image sampler
|
* \brief Binds image sampler
|
||||||
|
@ -55,7 +55,7 @@ namespace dxvk::hud {
|
|||||||
sizeof(HudTextVertex));
|
sizeof(HudTextVertex));
|
||||||
|
|
||||||
context->bindResourceSampler(1, m_fontSampler);
|
context->bindResourceSampler(1, m_fontSampler);
|
||||||
context->bindResourceImage (2, m_fontView);
|
context->bindResourceView (2, m_fontView, nullptr);
|
||||||
|
|
||||||
m_vertexIndex = 0;
|
m_vertexIndex = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user