mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[d3d9] Use mutable lambdas to avoid some redundant ref counting
This commit is contained in:
parent
f10be7bc85
commit
0315997fcd
@ -117,8 +117,8 @@ namespace dxvk {
|
|||||||
cStages = m_stages,
|
cStages = m_stages,
|
||||||
cBinding = m_binding,
|
cBinding = m_binding,
|
||||||
cSlice = DxvkBufferSlice(m_buffer)
|
cSlice = DxvkBufferSlice(m_buffer)
|
||||||
] (DxvkContext* ctx) {
|
] (DxvkContext* ctx) mutable {
|
||||||
ctx->bindResourceBuffer(cStages, cBinding, cSlice);
|
ctx->bindResourceBuffer(cStages, cBinding, std::move(cSlice));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2503,12 +2503,12 @@ namespace dxvk {
|
|||||||
cPrimCount = PrimitiveCount,
|
cPrimCount = PrimitiveCount,
|
||||||
cInstanceCount = GetInstanceCount(),
|
cInstanceCount = GetInstanceCount(),
|
||||||
cStride = VertexStreamZeroStride
|
cStride = VertexStreamZeroStride
|
||||||
](DxvkContext* ctx) {
|
](DxvkContext* ctx) mutable {
|
||||||
auto drawInfo = GenerateDrawInfo(cPrimType, cPrimCount, cInstanceCount);
|
auto drawInfo = GenerateDrawInfo(cPrimType, cPrimCount, cInstanceCount);
|
||||||
|
|
||||||
ApplyPrimitiveType(ctx, cPrimType);
|
ApplyPrimitiveType(ctx, cPrimType);
|
||||||
|
|
||||||
ctx->bindVertexBuffer(0, cBufferSlice, cStride);
|
ctx->bindVertexBuffer(0, std::move(cBufferSlice), cStride);
|
||||||
ctx->draw(
|
ctx->draw(
|
||||||
drawInfo.vertexCount, drawInfo.instanceCount,
|
drawInfo.vertexCount, drawInfo.instanceCount,
|
||||||
0, 0);
|
0, 0);
|
||||||
@ -2645,7 +2645,7 @@ namespace dxvk {
|
|||||||
cInstanceCount = GetInstanceCount(),
|
cInstanceCount = GetInstanceCount(),
|
||||||
cBufferSlice = slice,
|
cBufferSlice = slice,
|
||||||
cIndexed = m_state.indices != nullptr
|
cIndexed = m_state.indices != nullptr
|
||||||
](DxvkContext* ctx) {
|
](DxvkContext* ctx) mutable {
|
||||||
Rc<DxvkShader> shader = m_swvpEmulator.GetShaderModule(this, cDecl);
|
Rc<DxvkShader> shader = m_swvpEmulator.GetShaderModule(this, cDecl);
|
||||||
|
|
||||||
auto drawInfo = GenerateDrawInfo(D3DPT_POINTLIST, cVertexCount, cInstanceCount);
|
auto drawInfo = GenerateDrawInfo(D3DPT_POINTLIST, cVertexCount, cInstanceCount);
|
||||||
@ -2662,8 +2662,8 @@ namespace dxvk {
|
|||||||
// to avoid val errors / UB.
|
// to avoid val errors / UB.
|
||||||
ctx->bindShader(VK_SHADER_STAGE_FRAGMENT_BIT, nullptr);
|
ctx->bindShader(VK_SHADER_STAGE_FRAGMENT_BIT, nullptr);
|
||||||
|
|
||||||
ctx->bindShader(VK_SHADER_STAGE_GEOMETRY_BIT, shader);
|
ctx->bindShader(VK_SHADER_STAGE_GEOMETRY_BIT, std::move(shader));
|
||||||
ctx->bindResourceBuffer(VK_SHADER_STAGE_GEOMETRY_BIT, getSWVPBufferSlot(), cBufferSlice);
|
ctx->bindResourceBuffer(VK_SHADER_STAGE_GEOMETRY_BIT, getSWVPBufferSlot(), std::move(cBufferSlice));
|
||||||
ctx->draw(
|
ctx->draw(
|
||||||
drawInfo.vertexCount, drawInfo.instanceCount,
|
drawInfo.vertexCount, drawInfo.instanceCount,
|
||||||
cStartIndex, 0);
|
cStartIndex, 0);
|
||||||
@ -5476,8 +5476,8 @@ namespace dxvk {
|
|||||||
// Create and bind the framebuffer object to the context
|
// Create and bind the framebuffer object to the context
|
||||||
EmitCs([
|
EmitCs([
|
||||||
cAttachments = std::move(attachments)
|
cAttachments = std::move(attachments)
|
||||||
] (DxvkContext* ctx) {
|
] (DxvkContext* ctx) mutable {
|
||||||
ctx->bindRenderTargets(cAttachments);
|
ctx->bindRenderTargets(std::move(cAttachments));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5813,7 +5813,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
auto pair = m_samplers.find(cKey);
|
auto pair = m_samplers.find(cKey);
|
||||||
if (pair != m_samplers.end()) {
|
if (pair != m_samplers.end()) {
|
||||||
ctx->bindResourceSampler(stage, cSlot, pair->second);
|
ctx->bindResourceSampler(stage, cSlot,
|
||||||
|
Rc<DxvkSampler>(pair->second));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5880,9 +5881,9 @@ namespace dxvk {
|
|||||||
EmitCs([
|
EmitCs([
|
||||||
cSlot = slot,
|
cSlot = slot,
|
||||||
cImageView = commonTex->GetSampleView(srgb)
|
cImageView = commonTex->GetSampleView(srgb)
|
||||||
](DxvkContext* ctx) {
|
](DxvkContext* ctx) mutable {
|
||||||
VkShaderStageFlags stage = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT;
|
VkShaderStageFlags stage = VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT;
|
||||||
ctx->bindResourceView(stage, cSlot, cImageView, nullptr);
|
ctx->bindResourceView(stage, cSlot, std::move(cImageView), nullptr);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6129,8 +6130,8 @@ namespace dxvk {
|
|||||||
D3D9ShaderPermutation Permutation) {
|
D3D9ShaderPermutation Permutation) {
|
||||||
EmitCs([
|
EmitCs([
|
||||||
cShader = pShaderModule->GetShader(Permutation)
|
cShader = pShaderModule->GetShader(Permutation)
|
||||||
] (DxvkContext* ctx) {
|
] (DxvkContext* ctx) mutable {
|
||||||
ctx->bindShader(GetShaderStage(ShaderStage), cShader);
|
ctx->bindShader(GetShaderStage(ShaderStage), std::move(cShader));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6259,8 +6260,8 @@ namespace dxvk {
|
|||||||
pBuffer->GetCommonBuffer()->GetBufferSlice<D3D9_COMMON_BUFFER_TYPE_REAL>(Offset)
|
pBuffer->GetCommonBuffer()->GetBufferSlice<D3D9_COMMON_BUFFER_TYPE_REAL>(Offset)
|
||||||
: DxvkBufferSlice(),
|
: DxvkBufferSlice(),
|
||||||
cStride = pBuffer != nullptr ? Stride : 0
|
cStride = pBuffer != nullptr ? Stride : 0
|
||||||
] (DxvkContext* ctx) {
|
] (DxvkContext* ctx) mutable {
|
||||||
ctx->bindVertexBuffer(cSlotId, cBufferSlice, cStride);
|
ctx->bindVertexBuffer(cSlotId, std::move(cBufferSlice), cStride);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6276,8 +6277,8 @@ namespace dxvk {
|
|||||||
EmitCs([
|
EmitCs([
|
||||||
cBufferSlice = buffer != nullptr ? buffer->GetBufferSlice<D3D9_COMMON_BUFFER_TYPE_REAL>() : DxvkBufferSlice(),
|
cBufferSlice = buffer != nullptr ? buffer->GetBufferSlice<D3D9_COMMON_BUFFER_TYPE_REAL>() : DxvkBufferSlice(),
|
||||||
cIndexType = indexType
|
cIndexType = indexType
|
||||||
](DxvkContext* ctx) {
|
](DxvkContext* ctx) mutable {
|
||||||
ctx->bindIndexBuffer(cBufferSlice, cIndexType);
|
ctx->bindIndexBuffer(std::move(cBufferSlice), cIndexType);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,9 +94,9 @@ namespace dxvk {
|
|||||||
auto tmpBufferView = m_device->createBufferView(srcSlice.buffer(), bufferViewInfo);
|
auto tmpBufferView = m_device->createBufferView(srcSlice.buffer(), bufferViewInfo);
|
||||||
|
|
||||||
m_context->setSpecConstant(VK_PIPELINE_BIND_POINT_COMPUTE, 0, specConstantValue);
|
m_context->setSpecConstant(VK_PIPELINE_BIND_POINT_COMPUTE, 0, specConstantValue);
|
||||||
m_context->bindResourceView(VK_SHADER_STAGE_COMPUTE_BIT, BindingIds::Image, tmpImageView, nullptr);
|
m_context->bindResourceView(VK_SHADER_STAGE_COMPUTE_BIT, BindingIds::Image, std::move(tmpImageView), nullptr);
|
||||||
m_context->bindResourceView(VK_SHADER_STAGE_COMPUTE_BIT, BindingIds::Buffer, nullptr, tmpBufferView);
|
m_context->bindResourceView(VK_SHADER_STAGE_COMPUTE_BIT, BindingIds::Buffer, nullptr, std::move(tmpBufferView));
|
||||||
m_context->bindShader(VK_SHADER_STAGE_COMPUTE_BIT, m_shaders[videoFormat.FormatType]);
|
m_context->bindShader(VK_SHADER_STAGE_COMPUTE_BIT, Rc<DxvkShader>(m_shaders[videoFormat.FormatType]));
|
||||||
m_context->pushConstants(0, sizeof(VkExtent2D), &imageExtent);
|
m_context->pushConstants(0, sizeof(VkExtent2D), &imageExtent);
|
||||||
m_context->dispatch(
|
m_context->dispatch(
|
||||||
(imageExtent.width / 8) + (imageExtent.width % 8),
|
(imageExtent.width / 8) + (imageExtent.width % 8),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user