1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-13 19:29:14 +01:00

[d3d11] Move shader stage and buffer slot calc to inside lambda

Take advantage of the fact that template permutations transfer into lambdas inside of them.
Removes some unnecessary captures.
This commit is contained in:
Joshua Ashton 2020-01-08 21:59:00 +00:00 committed by Philip Rebohle
parent b738c4220b
commit 3cfc16ea34

View File

@ -3366,12 +3366,7 @@ namespace dxvk {
void D3D11DeviceContext::BindShader(
const D3D11CommonShader* pShaderModule) {
// Bind the shader and the ICB at once
uint32_t slotId = computeConstantBufferBinding(ShaderStage,
D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
EmitCs([
cSlotId = slotId,
cStage = GetShaderStage(ShaderStage),
cSlice = pShaderModule != nullptr
&& pShaderModule->GetIcb() != nullptr
? DxvkBufferSlice(pShaderModule->GetIcb())
@ -3380,8 +3375,13 @@ namespace dxvk {
? pShaderModule->GetShader()
: nullptr
] (DxvkContext* ctx) {
ctx->bindShader (cStage, cShader);
ctx->bindResourceBuffer(cSlotId, cSlice);
VkShaderStageFlagBits stage = GetShaderStage(ShaderStage);
uint32_t slotId = computeConstantBufferBinding(ShaderStage,
D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT);
ctx->bindShader (stage, cShader);
ctx->bindResourceBuffer(slotId, cSlice);
});
}