mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-11 17:20:56 +00:00
Avoid copying large structs, prefer to pass by reference
This commit is contained in:
@@ -139,7 +139,7 @@ Viewport CommonPipelineState::GetViewport(int index)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ShaderBindpointMapping CommonPipelineState::GetBindpointMapping(ShaderStageType stage)
|
||||
const ShaderBindpointMapping &CommonPipelineState::GetBindpointMapping(ShaderStageType stage)
|
||||
{
|
||||
if(LogLoaded())
|
||||
{
|
||||
@@ -197,10 +197,12 @@ ShaderBindpointMapping CommonPipelineState::GetBindpointMapping(ShaderStageType
|
||||
}
|
||||
}
|
||||
|
||||
return ShaderBindpointMapping();
|
||||
static ShaderBindpointMapping empty;
|
||||
|
||||
return empty;
|
||||
}
|
||||
|
||||
ShaderReflection *CommonPipelineState::GetShaderReflection(ShaderStageType stage)
|
||||
const ShaderReflection *CommonPipelineState::GetShaderReflection(ShaderStageType stage)
|
||||
{
|
||||
if(LogLoaded())
|
||||
{
|
||||
|
||||
@@ -153,8 +153,8 @@ public:
|
||||
QString OutputAbbrev();
|
||||
|
||||
Viewport GetViewport(int index);
|
||||
ShaderBindpointMapping GetBindpointMapping(ShaderStageType stage);
|
||||
ShaderReflection *GetShaderReflection(ShaderStageType stage);
|
||||
const ShaderBindpointMapping &GetBindpointMapping(ShaderStageType stage);
|
||||
const ShaderReflection *GetShaderReflection(ShaderStageType stage);
|
||||
QString GetShaderEntryPoint(ShaderStageType stage);
|
||||
ResourceId GetShader(ShaderStageType stage);
|
||||
QString GetShaderName(ShaderStageType stage);
|
||||
|
||||
@@ -1153,7 +1153,7 @@ void BufferViewer::ConfigureMeshColumns()
|
||||
m_VSIn.compType = vinputs[0].Format.compType;
|
||||
}
|
||||
|
||||
ShaderReflection *vs = m_Ctx.CurPipelineState.GetShaderReflection(eShaderStage_Vertex);
|
||||
const ShaderReflection *vs = m_Ctx.CurPipelineState.GetShaderReflection(eShaderStage_Vertex);
|
||||
|
||||
m_ModelVSOut->columns.clear();
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ void ConstantBufferPreviewer::OnEventChanged(uint32_t eventID)
|
||||
|
||||
m_shader = m_Ctx.CurPipelineState.GetShader(m_stage);
|
||||
QString entryPoint = m_Ctx.CurPipelineState.GetShaderEntryPoint(m_stage);
|
||||
ShaderReflection *reflection = m_Ctx.CurPipelineState.GetShaderReflection(m_stage);
|
||||
const ShaderReflection *reflection = m_Ctx.CurPipelineState.GetShaderReflection(m_stage);
|
||||
|
||||
updateLabels();
|
||||
|
||||
@@ -219,7 +219,7 @@ void ConstantBufferPreviewer::updateLabels()
|
||||
needName = false;
|
||||
}
|
||||
|
||||
ShaderReflection *reflection = m_Ctx.CurPipelineState.GetShaderReflection(m_stage);
|
||||
const ShaderReflection *reflection = m_Ctx.CurPipelineState.GetShaderReflection(m_stage);
|
||||
|
||||
if(reflection != NULL)
|
||||
{
|
||||
|
||||
@@ -271,7 +271,7 @@ QMap<BindpointMap, QVector<BoundResource>> Following::GetReadOnlyResources(Captu
|
||||
return GetReadOnlyResources(ctx, Stage);
|
||||
}
|
||||
|
||||
ShaderReflection *Following::GetReflection(CaptureContext &ctx, ShaderStageType stage)
|
||||
const ShaderReflection *Following::GetReflection(CaptureContext &ctx, ShaderStageType stage)
|
||||
{
|
||||
bool copy = false, compute = false;
|
||||
GetDrawContext(ctx, copy, compute);
|
||||
@@ -284,23 +284,25 @@ ShaderReflection *Following::GetReflection(CaptureContext &ctx, ShaderStageType
|
||||
return ctx.CurPipelineState.GetShaderReflection(stage);
|
||||
}
|
||||
|
||||
ShaderReflection *Following::GetReflection(CaptureContext &ctx)
|
||||
const ShaderReflection *Following::GetReflection(CaptureContext &ctx)
|
||||
{
|
||||
return GetReflection(ctx, Stage);
|
||||
}
|
||||
|
||||
ShaderBindpointMapping Following::GetMapping(CaptureContext &ctx, ShaderStageType stage)
|
||||
const ShaderBindpointMapping &Following::GetMapping(CaptureContext &ctx, ShaderStageType stage)
|
||||
{
|
||||
bool copy = false, compute = false;
|
||||
GetDrawContext(ctx, copy, compute);
|
||||
|
||||
if(copy)
|
||||
{
|
||||
ShaderBindpointMapping mapping;
|
||||
static ShaderBindpointMapping mapping;
|
||||
|
||||
// for PS only add a single mapping to get the copy source
|
||||
if(stage == eShaderStage_Pixel)
|
||||
mapping.ReadOnlyResources = {BindpointMap(0, 0)};
|
||||
else
|
||||
mapping.ReadOnlyResources.clear();
|
||||
|
||||
return mapping;
|
||||
}
|
||||
@@ -314,7 +316,7 @@ ShaderBindpointMapping Following::GetMapping(CaptureContext &ctx, ShaderStageTyp
|
||||
}
|
||||
}
|
||||
|
||||
ShaderBindpointMapping Following::GetMapping(CaptureContext &ctx)
|
||||
const ShaderBindpointMapping &Following::GetMapping(CaptureContext &ctx)
|
||||
{
|
||||
return GetMapping(ctx, Stage);
|
||||
}
|
||||
@@ -2632,8 +2634,8 @@ void TextureViewer::OnEventChanged(uint32_t eventID)
|
||||
QMap<BindpointMap, QVector<BoundResource>> RWs = Following::GetReadWriteResources(m_Ctx, stage);
|
||||
QMap<BindpointMap, QVector<BoundResource>> ROs = Following::GetReadOnlyResources(m_Ctx, stage);
|
||||
|
||||
ShaderReflection *details = Following::GetReflection(m_Ctx, stage);
|
||||
ShaderBindpointMapping mapping = Following::GetMapping(m_Ctx, stage);
|
||||
const ShaderReflection *details = Following::GetReflection(m_Ctx, stage);
|
||||
const ShaderBindpointMapping &mapping = Following::GetMapping(m_Ctx, stage);
|
||||
|
||||
InitStageResourcePreviews(stage, details != NULL ? details->ReadWriteResources : empty,
|
||||
mapping.ReadWriteResources, RWs, ui->outputThumbs, outIndex, copy,
|
||||
|
||||
@@ -84,11 +84,11 @@ struct Following
|
||||
static QMap<BindpointMap, QVector<BoundResource>> GetReadOnlyResources(CaptureContext &ctx,
|
||||
ShaderStageType stage);
|
||||
|
||||
ShaderReflection *GetReflection(CaptureContext &ctx);
|
||||
static ShaderReflection *GetReflection(CaptureContext &ctx, ShaderStageType stage);
|
||||
const ShaderReflection *GetReflection(CaptureContext &ctx);
|
||||
static const ShaderReflection *GetReflection(CaptureContext &ctx, ShaderStageType stage);
|
||||
|
||||
ShaderBindpointMapping GetMapping(CaptureContext &ctx);
|
||||
static ShaderBindpointMapping GetMapping(CaptureContext &ctx, ShaderStageType stage);
|
||||
const ShaderBindpointMapping &GetMapping(CaptureContext &ctx);
|
||||
static const ShaderBindpointMapping &GetMapping(CaptureContext &ctx, ShaderStageType stage);
|
||||
};
|
||||
|
||||
struct TexSettings
|
||||
|
||||
Reference in New Issue
Block a user