mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-23 06:56:40 +00:00
Ensure shader reflection information is stored as const
* Avoids accidental modifications
This commit is contained in:
@@ -1184,7 +1184,7 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11Pipe::Shader &stage, RD
|
||||
RDTreeWidget *samplers, RDTreeWidget *cbuffers,
|
||||
RDTreeWidget *classes)
|
||||
{
|
||||
ShaderReflection *shaderDetails = stage.reflection;
|
||||
const ShaderReflection *shaderDetails = stage.reflection;
|
||||
|
||||
shader->setText(ToQStr(stage.resourceId));
|
||||
|
||||
@@ -2496,7 +2496,7 @@ void D3D11PipelineStateViewer::vertex_leave(QEvent *e)
|
||||
|
||||
void D3D11PipelineStateViewer::shaderView_clicked()
|
||||
{
|
||||
ShaderReflection *shaderDetails = NULL;
|
||||
const ShaderReflection *shaderDetails = NULL;
|
||||
|
||||
QWidget *sender = qobject_cast<QWidget *>(QObject::sender());
|
||||
if(sender == ui->iaBytecode || sender == ui->iaBytecodeViewButton)
|
||||
@@ -2528,7 +2528,7 @@ void D3D11PipelineStateViewer::shaderSave_clicked()
|
||||
if(stage == NULL)
|
||||
return;
|
||||
|
||||
ShaderReflection *shaderDetails = stage->reflection;
|
||||
const ShaderReflection *shaderDetails = stage->reflection;
|
||||
|
||||
if(stage->resourceId == ResourceId())
|
||||
return;
|
||||
@@ -2537,7 +2537,7 @@ void D3D11PipelineStateViewer::shaderSave_clicked()
|
||||
}
|
||||
|
||||
QVariantList D3D11PipelineStateViewer::exportViewHTML(const Descriptor &view, uint32_t reg,
|
||||
ShaderReflection *refl,
|
||||
const ShaderReflection *refl,
|
||||
const QString &extraParams)
|
||||
{
|
||||
const ShaderResource *shaderInput = NULL;
|
||||
@@ -2755,7 +2755,7 @@ void D3D11PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D11Pipe
|
||||
|
||||
void D3D11PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D11Pipe::Shader &sh)
|
||||
{
|
||||
ShaderReflection *shaderDetails = sh.reflection;
|
||||
const ShaderReflection *shaderDetails = sh.reflection;
|
||||
|
||||
{
|
||||
xml.writeStartElement(lit("h3"));
|
||||
@@ -2951,7 +2951,7 @@ void D3D11PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D11Pipe
|
||||
|
||||
for(int i = 0; i < cblocks.count(); i++)
|
||||
{
|
||||
ConstantBlock *shaderCBuf = NULL;
|
||||
const ConstantBlock *shaderCBuf = NULL;
|
||||
|
||||
if(cblocks[i].descriptor.resource == ResourceId())
|
||||
continue;
|
||||
|
||||
@@ -105,7 +105,7 @@ private:
|
||||
void setState();
|
||||
void clearState();
|
||||
|
||||
QVariantList exportViewHTML(const Descriptor &view, uint32_t reg, ShaderReflection *refl,
|
||||
QVariantList exportViewHTML(const Descriptor &view, uint32_t reg, const ShaderReflection *refl,
|
||||
const QString &extraParams);
|
||||
void exportHTML(QXmlStreamWriter &xml, const D3D11Pipe::InputAssembly &ia);
|
||||
void exportHTML(QXmlStreamWriter &xml, const D3D11Pipe::Shader &sh);
|
||||
|
||||
@@ -1171,7 +1171,7 @@ void D3D12PipelineStateViewer::clearState()
|
||||
void D3D12PipelineStateViewer::setShaderState(const D3D12Pipe::Shader &stage, RDLabel *pipeline,
|
||||
RDLabel *shader, RDLabel *rootSig)
|
||||
{
|
||||
ShaderReflection *shaderDetails = stage.reflection;
|
||||
const ShaderReflection *shaderDetails = stage.reflection;
|
||||
const D3D12Pipe::State &state = *m_Ctx.CurD3D12PipelineState();
|
||||
|
||||
rootSig->setText(ToQStr(state.rootSignature.resourceId));
|
||||
@@ -2643,7 +2643,7 @@ void D3D12PipelineStateViewer::shaderSave_clicked()
|
||||
if(stage == NULL)
|
||||
return;
|
||||
|
||||
ShaderReflection *shaderDetails = stage->reflection;
|
||||
const ShaderReflection *shaderDetails = stage->reflection;
|
||||
|
||||
if(stage->resourceId == ResourceId())
|
||||
return;
|
||||
@@ -2882,7 +2882,7 @@ void D3D12PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D12Pipe
|
||||
|
||||
void D3D12PipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const D3D12Pipe::Shader &sh)
|
||||
{
|
||||
ShaderReflection *shaderDetails = sh.reflection;
|
||||
const ShaderReflection *shaderDetails = sh.reflection;
|
||||
|
||||
{
|
||||
xml.writeStartElement(lit("h3"));
|
||||
|
||||
@@ -1278,7 +1278,7 @@ void GLPipelineStateViewer::clearState()
|
||||
void GLPipelineStateViewer::setShaderState(const GLPipe::Shader &stage, RDLabel *pipeline,
|
||||
RDLabel *program, RDLabel *shader, RDTreeWidget *subs)
|
||||
{
|
||||
ShaderReflection *shaderDetails = stage.reflection;
|
||||
const ShaderReflection *shaderDetails = stage.reflection;
|
||||
const GLPipe::State &state = *m_Ctx.CurGLPipelineState();
|
||||
|
||||
if(state.pipelineResourceId != ResourceId())
|
||||
@@ -2876,7 +2876,7 @@ void GLPipelineStateViewer::shaderView_clicked()
|
||||
if(stage == NULL || stage->shaderResourceId == ResourceId())
|
||||
return;
|
||||
|
||||
ShaderReflection *shaderDetails = stage->reflection;
|
||||
const ShaderReflection *shaderDetails = stage->reflection;
|
||||
|
||||
if(!shaderDetails)
|
||||
return;
|
||||
@@ -2893,7 +2893,7 @@ void GLPipelineStateViewer::shaderSave_clicked()
|
||||
if(stage == NULL)
|
||||
return;
|
||||
|
||||
ShaderReflection *shaderDetails = stage->reflection;
|
||||
const ShaderReflection *shaderDetails = stage->reflection;
|
||||
|
||||
if(stage->shaderResourceId == ResourceId())
|
||||
return;
|
||||
@@ -3064,7 +3064,7 @@ void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Vert
|
||||
void GLPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const GLPipe::Shader &sh)
|
||||
{
|
||||
const GLPipe::State &pipe = *m_Ctx.CurGLPipelineState();
|
||||
ShaderReflection *shaderDetails = sh.reflection;
|
||||
const ShaderReflection *shaderDetails = sh.reflection;
|
||||
|
||||
{
|
||||
xml.writeStartElement(tr("h3"));
|
||||
|
||||
@@ -1722,7 +1722,7 @@ void VulkanPipelineStateViewer::setShaderState(const VKPipe::Pipeline &pipe,
|
||||
RDLabel *shader, RDLabel *shaderDebug,
|
||||
RDLabel *pipeLayout, RDTreeWidget *descSets)
|
||||
{
|
||||
ShaderReflection *shaderDetails = stage.reflection;
|
||||
const ShaderReflection *shaderDetails = stage.reflection;
|
||||
|
||||
if(stage.shaderObject)
|
||||
{
|
||||
@@ -2017,7 +2017,7 @@ void VulkanPipelineStateViewer::setState()
|
||||
|
||||
if(state.vertexShader.resourceId != ResourceId())
|
||||
{
|
||||
for(SigParameter &sigParam : state.vertexShader.reflection->inputSignature)
|
||||
for(const SigParameter &sigParam : state.vertexShader.reflection->inputSignature)
|
||||
{
|
||||
if(sigParam.regIndex == a.location)
|
||||
{
|
||||
@@ -3564,7 +3564,7 @@ void VulkanPipelineStateViewer::shaderView_clicked()
|
||||
if(stage == NULL || stage->resourceId == ResourceId())
|
||||
return;
|
||||
|
||||
ShaderReflection *shaderDetails = stage->reflection;
|
||||
const ShaderReflection *shaderDetails = stage->reflection;
|
||||
|
||||
ResourceId pipe = stage->stage == ShaderStage::Compute
|
||||
? m_Ctx.CurVulkanPipelineState()->compute.pipelineResourceId
|
||||
@@ -3585,7 +3585,7 @@ void VulkanPipelineStateViewer::shaderSave_clicked()
|
||||
if(stage == NULL)
|
||||
return;
|
||||
|
||||
ShaderReflection *shaderDetails = stage->reflection;
|
||||
const ShaderReflection *shaderDetails = stage->reflection;
|
||||
|
||||
if(stage->resourceId == ResourceId())
|
||||
return;
|
||||
@@ -3722,7 +3722,7 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe::
|
||||
|
||||
void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe::Shader &sh)
|
||||
{
|
||||
ShaderReflection *shaderDetails = sh.reflection;
|
||||
const ShaderReflection *shaderDetails = sh.reflection;
|
||||
|
||||
{
|
||||
xml.writeStartElement(lit("h3"));
|
||||
|
||||
@@ -216,7 +216,7 @@ struct InputAssembly
|
||||
|
||||
:type: ShaderReflection
|
||||
)");
|
||||
ShaderReflection *bytecode = NULL;
|
||||
const ShaderReflection *bytecode = NULL;
|
||||
|
||||
DOCUMENT(R"(The bound vertex buffers
|
||||
|
||||
@@ -255,7 +255,7 @@ struct Shader
|
||||
|
||||
:type: ShaderReflection
|
||||
)");
|
||||
ShaderReflection *reflection = NULL;
|
||||
const ShaderReflection *reflection = NULL;
|
||||
|
||||
DOCUMENT(R"(A :class:`ShaderStage` identifying which stage this shader is bound to.
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ struct Shader
|
||||
|
||||
:type: ShaderReflection
|
||||
)");
|
||||
ShaderReflection *reflection = NULL;
|
||||
const ShaderReflection *reflection = NULL;
|
||||
|
||||
DOCUMENT(R"(A :class:`ShaderStage` identifying which stage this shader is bound to.
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ struct Shader
|
||||
|
||||
:type: ShaderReflection
|
||||
)");
|
||||
ShaderReflection *reflection = NULL;
|
||||
const ShaderReflection *reflection = NULL;
|
||||
|
||||
DOCUMENT(R"(A :class:`ShaderStage` identifying which stage this shader is bound to.
|
||||
|
||||
|
||||
@@ -711,7 +711,7 @@ rdcarray<VertexInputAttribute> PipeState::GetVertexInputs() const
|
||||
|
||||
if(m_D3D11->inputAssembly.bytecode != NULL)
|
||||
{
|
||||
rdcarray<SigParameter> &sig = m_D3D11->inputAssembly.bytecode->inputSignature;
|
||||
const rdcarray<SigParameter> &sig = m_D3D11->inputAssembly.bytecode->inputSignature;
|
||||
for(int ia = 0; ia < sig.count(); ia++)
|
||||
{
|
||||
if(striequal(semName, sig[ia].semanticName) &&
|
||||
@@ -769,7 +769,7 @@ rdcarray<VertexInputAttribute> PipeState::GetVertexInputs() const
|
||||
|
||||
if(m_D3D12->vertexShader.reflection != NULL)
|
||||
{
|
||||
rdcarray<SigParameter> &sig = m_D3D12->vertexShader.reflection->inputSignature;
|
||||
const rdcarray<SigParameter> &sig = m_D3D12->vertexShader.reflection->inputSignature;
|
||||
for(int ia = 0; ia < sig.count(); ia++)
|
||||
{
|
||||
if(striequal(semName, sig[ia].semanticName) &&
|
||||
|
||||
@@ -502,7 +502,7 @@ struct Shader
|
||||
|
||||
:type: ShaderReflection
|
||||
)");
|
||||
ShaderReflection *reflection = NULL;
|
||||
const ShaderReflection *reflection = NULL;
|
||||
|
||||
DOCUMENT(R"(A :class:`ShaderStage` identifying which stage this shader is bound to.
|
||||
|
||||
|
||||
@@ -1233,13 +1233,13 @@ rdcarray<ShaderEntryPoint> ReplayProxy::GetShaderEntryPoints(ResourceId id)
|
||||
}
|
||||
|
||||
template <typename ParamSerialiser, typename ReturnSerialiser>
|
||||
ShaderReflection *ReplayProxy::Proxied_GetShader(ParamSerialiser ¶mser,
|
||||
ReturnSerialiser &retser, ResourceId pipeline,
|
||||
ResourceId shader, ShaderEntryPoint entry)
|
||||
const ShaderReflection *ReplayProxy::Proxied_GetShader(ParamSerialiser ¶mser,
|
||||
ReturnSerialiser &retser, ResourceId pipeline,
|
||||
ResourceId shader, ShaderEntryPoint entry)
|
||||
{
|
||||
const ReplayProxyPacket expectedPacket = eReplayProxy_GetShader;
|
||||
ReplayProxyPacket packet = eReplayProxy_GetShader;
|
||||
ShaderReflection *ret = NULL;
|
||||
const ShaderReflection *ret = NULL;
|
||||
|
||||
// only consider eventID part of the key on APIs where shaders are mutable
|
||||
ShaderReflKey key(pipeline, shader, entry);
|
||||
@@ -1282,8 +1282,8 @@ ShaderReflection *ReplayProxy::Proxied_GetShader(ParamSerialiser ¶mser,
|
||||
return m_ShaderReflectionCache[key];
|
||||
}
|
||||
|
||||
ShaderReflection *ReplayProxy::GetShader(ResourceId pipeline, ResourceId shader,
|
||||
ShaderEntryPoint entry)
|
||||
const ShaderReflection *ReplayProxy::GetShader(ResourceId pipeline, ResourceId shader,
|
||||
ShaderEntryPoint entry)
|
||||
{
|
||||
PROXY_FUNCTION(GetShader, pipeline, shader, entry);
|
||||
}
|
||||
@@ -3066,7 +3066,7 @@ RDResult ReplayProxy::FatalErrorCheck()
|
||||
IReplayDriver *ReplayProxy::MakeDummyDriver()
|
||||
{
|
||||
// gather up the shaders we've allocated to pass to the dummy driver
|
||||
rdcarray<ShaderReflection *> shaders;
|
||||
rdcarray<const ShaderReflection *> shaders;
|
||||
for(auto it = m_ShaderReflectionCache.begin(); it != m_ShaderReflectionCache.end(); ++it)
|
||||
shaders.push_back(it->second);
|
||||
m_ShaderReflectionCache.clear();
|
||||
|
||||
@@ -531,7 +531,7 @@ public:
|
||||
const rdcarray<uint32_t> &passEvents);
|
||||
|
||||
IMPLEMENT_FUNCTION_PROXIED(rdcarray<ShaderEntryPoint>, GetShaderEntryPoints, ResourceId shader);
|
||||
IMPLEMENT_FUNCTION_PROXIED(ShaderReflection *, GetShader, ResourceId pipeline, ResourceId,
|
||||
IMPLEMENT_FUNCTION_PROXIED(const ShaderReflection *, GetShader, ResourceId pipeline, ResourceId,
|
||||
ShaderEntryPoint entry);
|
||||
|
||||
IMPLEMENT_FUNCTION_PROXIED(rdcarray<rdcstr>, GetDisassemblyTargets, bool withPipeline);
|
||||
@@ -679,7 +679,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
std::map<ShaderReflKey, ShaderReflection *> m_ShaderReflectionCache;
|
||||
std::map<ShaderReflKey, const ShaderReflection *> m_ShaderReflectionCache;
|
||||
|
||||
// reader from the other side of the host <-> remote connection
|
||||
ReadSerialiser &m_Reader;
|
||||
|
||||
@@ -254,11 +254,11 @@ void D3D11Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
return;
|
||||
}
|
||||
|
||||
DXBC::DXBCContainer *dxbcVS = wrappedVS->GetDXBC();
|
||||
const DXBC::DXBCContainer *dxbcVS = wrappedVS->GetDXBC();
|
||||
|
||||
RDCASSERT(dxbcVS);
|
||||
|
||||
DXBC::DXBCContainer *dxbcGS = NULL;
|
||||
const DXBC::DXBCContainer *dxbcGS = NULL;
|
||||
|
||||
if(gs)
|
||||
{
|
||||
@@ -266,11 +266,12 @@ void D3D11Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
(WrappedID3D11Shader<ID3D11GeometryShader> *)gs;
|
||||
|
||||
dxbcGS = wrappedGS->GetDXBC();
|
||||
wrappedGS->GetWriteableDXBC()->CacheOutputTopology();
|
||||
|
||||
RDCASSERT(dxbcGS);
|
||||
}
|
||||
|
||||
DXBC::DXBCContainer *dxbcDS = NULL;
|
||||
const DXBC::DXBCContainer *dxbcDS = NULL;
|
||||
|
||||
if(ds)
|
||||
{
|
||||
@@ -278,12 +279,13 @@ void D3D11Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
(WrappedID3D11Shader<ID3D11DomainShader> *)ds;
|
||||
|
||||
dxbcDS = wrappedDS->GetDXBC();
|
||||
wrappedDS->GetWriteableDXBC()->CacheOutputTopology();
|
||||
|
||||
RDCASSERT(dxbcDS);
|
||||
}
|
||||
|
||||
ResourceId lastShaderId = GetIDForDeviceChild(ds);
|
||||
DXBC::DXBCContainer *lastShader = dxbcDS;
|
||||
const DXBC::DXBCContainer *lastShader = dxbcDS;
|
||||
if(dxbcGS)
|
||||
{
|
||||
lastShaderId = GetIDForDeviceChild(gs);
|
||||
|
||||
@@ -1053,7 +1053,7 @@ bool D3D11RenderState::Shader::Used_CB(uint32_t slot) const
|
||||
if(shad == NULL)
|
||||
return false;
|
||||
|
||||
DXBC::DXBCContainer *dxbc = shad->GetDXBC();
|
||||
const DXBC::DXBCContainer *dxbc = shad->GetDXBC();
|
||||
|
||||
// have to assume it's used if there's no DXBC
|
||||
if(dxbc == NULL)
|
||||
@@ -1076,7 +1076,7 @@ bool D3D11RenderState::Shader::Used_SRV(uint32_t slot) const
|
||||
if(shad == NULL)
|
||||
return false;
|
||||
|
||||
DXBC::DXBCContainer *dxbc = shad->GetDXBC();
|
||||
const DXBC::DXBCContainer *dxbc = shad->GetDXBC();
|
||||
|
||||
// have to assume it's used if there's no DXBC
|
||||
if(dxbc == NULL)
|
||||
@@ -1096,7 +1096,7 @@ bool D3D11RenderState::Shader::Used_UAV(uint32_t slot) const
|
||||
if(shad == NULL)
|
||||
return false;
|
||||
|
||||
DXBC::DXBCContainer *dxbc = shad->GetDXBC();
|
||||
const DXBC::DXBCContainer *dxbc = shad->GetDXBC();
|
||||
|
||||
// have to assume it's used if there's no DXBC
|
||||
if(dxbc == NULL)
|
||||
|
||||
@@ -94,7 +94,7 @@ RDResult D3D11Replay::FatalErrorCheck()
|
||||
IReplayDriver *D3D11Replay::MakeDummyDriver()
|
||||
{
|
||||
// gather up the shaders we've allocated to pass to the dummy driver
|
||||
rdcarray<ShaderReflection *> shaders;
|
||||
rdcarray<const ShaderReflection *> shaders;
|
||||
WrappedID3D11Shader<ID3D11ComputeShader>::GetReflections(shaders);
|
||||
|
||||
IReplayDriver *dummy = new DummyDriver(this, shaders, m_pDevice->DetachStructuredFile());
|
||||
|
||||
@@ -1074,7 +1074,12 @@ public:
|
||||
SCOPED_LOCK(m_ShaderListLock);
|
||||
return m_ShaderList[m_ID]->GetShaderExtSlot();
|
||||
}
|
||||
DXBC::DXBCContainer *GetDXBC()
|
||||
const DXBC::DXBCContainer *GetDXBC()
|
||||
{
|
||||
SCOPED_LOCK(m_ShaderListLock);
|
||||
return m_ShaderList[m_ID]->GetDXBC();
|
||||
}
|
||||
DXBC::DXBCContainer *GetWriteableDXBC()
|
||||
{
|
||||
SCOPED_LOCK(m_ShaderListLock);
|
||||
return m_ShaderList[m_ID]->GetDXBC();
|
||||
@@ -1090,7 +1095,7 @@ public:
|
||||
return m_ShaderList[m_ID]->GetDescriptorAccess();
|
||||
}
|
||||
|
||||
static void GetReflections(rdcarray<ShaderReflection *> &refls)
|
||||
static void GetReflections(rdcarray<const ShaderReflection *> &refls)
|
||||
{
|
||||
SCOPED_LOCK(m_ShaderListLock);
|
||||
refls.clear();
|
||||
|
||||
@@ -1454,13 +1454,13 @@ ShaderDebugTrace *D3D11Replay::DebugVertex(uint32_t eventId, uint32_t vertid, ui
|
||||
if(!vs)
|
||||
return new ShaderDebugTrace;
|
||||
|
||||
DXBC::DXBCContainer *dxbc = vs->GetDXBC();
|
||||
const DXBC::DXBCContainer *dxbc = vs->GetDXBC();
|
||||
const ShaderReflection &refl = vs->GetDetails();
|
||||
|
||||
if(!dxbc)
|
||||
return new ShaderDebugTrace;
|
||||
|
||||
dxbc->GetDisassembly(false);
|
||||
vs->GetWriteableDXBC()->GetDisassembly(false);
|
||||
|
||||
D3D11RenderState *rs = m_pImmediateContext->GetCurrentPipelineState();
|
||||
|
||||
@@ -1842,15 +1842,15 @@ ShaderDebugTrace *D3D11Replay::DebugPixel(uint32_t eventId, uint32_t x, uint32_t
|
||||
|
||||
D3D11RenderState *rs = m_pImmediateContext->GetCurrentPipelineState();
|
||||
|
||||
DXBC::DXBCContainer *dxbc = ps->GetDXBC();
|
||||
const DXBC::DXBCContainer *dxbc = ps->GetDXBC();
|
||||
const ShaderReflection &refl = ps->GetDetails();
|
||||
|
||||
if(!dxbc)
|
||||
return new ShaderDebugTrace;
|
||||
|
||||
dxbc->GetDisassembly(false);
|
||||
ps->GetWriteableDXBC()->GetDisassembly(false);
|
||||
|
||||
DXBC::DXBCContainer *prevdxbc = NULL;
|
||||
const DXBC::DXBCContainer *prevdxbc = NULL;
|
||||
|
||||
if(prevdxbc == NULL && gs != NULL)
|
||||
prevdxbc = gs->GetDXBC();
|
||||
@@ -2305,13 +2305,13 @@ ShaderDebugTrace *D3D11Replay::DebugThread(uint32_t eventId,
|
||||
if(!cs)
|
||||
return new ShaderDebugTrace;
|
||||
|
||||
DXBC::DXBCContainer *dxbc = cs->GetDXBC();
|
||||
const DXBC::DXBCContainer *dxbc = cs->GetDXBC();
|
||||
const ShaderReflection &refl = cs->GetDetails();
|
||||
|
||||
if(!dxbc)
|
||||
return new ShaderDebugTrace;
|
||||
|
||||
dxbc->GetDisassembly(false);
|
||||
cs->GetWriteableDXBC()->GetDisassembly(false);
|
||||
|
||||
D3D11RenderState *rs = m_pImmediateContext->GetCurrentPipelineState();
|
||||
|
||||
|
||||
@@ -1991,8 +1991,8 @@ ResourceId D3D12Replay::RenderOverlay(ResourceId texid, FloatVector clearCol, De
|
||||
WrappedID3D12PipelineState::ShaderEntry *wrappedPS = pipe->PS();
|
||||
if(wrappedPS)
|
||||
{
|
||||
ShaderReflection &reflection = pipe->PS()->GetDetails();
|
||||
for(SigParameter &output : reflection.outputSignature)
|
||||
const ShaderReflection &reflection = pipe->PS()->GetDetails();
|
||||
for(const SigParameter &output : reflection.outputSignature)
|
||||
{
|
||||
if(output.systemValue == ShaderBuiltin::DepthOutput)
|
||||
useDepthWriteStencilPass = true;
|
||||
|
||||
@@ -2901,33 +2901,35 @@ void D3D12Replay::InitPostVSBuffers(uint32_t eventId)
|
||||
return;
|
||||
}
|
||||
|
||||
DXBC::DXBCContainer *dxbcVS = vs->GetDXBC();
|
||||
const DXBC::DXBCContainer *dxbcVS = vs->GetDXBC();
|
||||
|
||||
RDCASSERT(dxbcVS);
|
||||
|
||||
DXBC::DXBCContainer *dxbcGS = NULL;
|
||||
const DXBC::DXBCContainer *dxbcGS = NULL;
|
||||
|
||||
WrappedID3D12Shader *gs = origPSO->GS();
|
||||
|
||||
if(gs)
|
||||
{
|
||||
dxbcGS = gs->GetDXBC();
|
||||
gs->GetWriteableDXBC()->CacheOutputTopology();
|
||||
|
||||
RDCASSERT(dxbcGS);
|
||||
}
|
||||
|
||||
DXBC::DXBCContainer *dxbcDS = NULL;
|
||||
const DXBC::DXBCContainer *dxbcDS = NULL;
|
||||
|
||||
WrappedID3D12Shader *ds = origPSO->DS();
|
||||
|
||||
if(ds)
|
||||
{
|
||||
dxbcDS = ds->GetDXBC();
|
||||
ds->GetWriteableDXBC()->CacheOutputTopology();
|
||||
|
||||
RDCASSERT(dxbcDS);
|
||||
}
|
||||
|
||||
DXBC::DXBCContainer *lastShader = dxbcDS;
|
||||
const DXBC::DXBCContainer *lastShader = dxbcDS;
|
||||
if(dxbcGS)
|
||||
lastShader = dxbcGS;
|
||||
|
||||
|
||||
@@ -541,7 +541,7 @@ bool D3D12Replay::RenderTextureInternal(D3D12_CPU_DESCRIPTOR_HANDLE rtv, Texture
|
||||
if(FAILED(hr))
|
||||
return false;
|
||||
|
||||
DXBC::DXBCContainer *dxbc = shader->GetDXBC();
|
||||
const DXBC::DXBCContainer *dxbc = shader->GetDXBC();
|
||||
|
||||
RDCASSERT(dxbc);
|
||||
RDCASSERT(dxbc->m_Type == DXBC::ShaderType::Pixel);
|
||||
|
||||
@@ -163,7 +163,7 @@ RDResult D3D12Replay::FatalErrorCheck()
|
||||
IReplayDriver *D3D12Replay::MakeDummyDriver()
|
||||
{
|
||||
// gather up the shaders we've allocated to pass to the dummy driver
|
||||
rdcarray<ShaderReflection *> shaders;
|
||||
rdcarray<const ShaderReflection *> shaders;
|
||||
WrappedID3D12Shader::GetReflections(shaders);
|
||||
|
||||
IReplayDriver *dummy = new DummyDriver(this, shaders, m_pDevice->DetachStructuredFile());
|
||||
@@ -530,13 +530,13 @@ rdcarray<ShaderEntryPoint> D3D12Replay::GetShaderEntryPoints(ResourceId shader)
|
||||
|
||||
WrappedID3D12Shader *sh = (WrappedID3D12Shader *)res;
|
||||
|
||||
ShaderReflection &ret = sh->GetDetails();
|
||||
const ShaderReflection &ret = sh->GetDetails();
|
||||
|
||||
return {{"main", ret.stage}};
|
||||
}
|
||||
|
||||
ShaderReflection *D3D12Replay::GetShader(ResourceId pipeline, ResourceId shader,
|
||||
ShaderEntryPoint entry)
|
||||
const ShaderReflection *D3D12Replay::GetShader(ResourceId pipeline, ResourceId shader,
|
||||
ShaderEntryPoint entry)
|
||||
{
|
||||
WrappedID3D12Shader *sh =
|
||||
m_pDevice->GetResourceManager()->GetCurrentAs<WrappedID3D12Shader>(shader);
|
||||
@@ -594,13 +594,11 @@ rdcstr D3D12Replay::DisassembleShader(ResourceId pipeline, const ShaderReflectio
|
||||
if(!sh)
|
||||
return "; Invalid Shader Specified";
|
||||
|
||||
DXBC::DXBCContainer *dxbc = sh->GetDXBC();
|
||||
|
||||
if(target == DXBCDXILDisassemblyTarget || target.empty())
|
||||
return dxbc->GetDisassembly(false);
|
||||
return sh->GetWriteableDXBC()->GetDisassembly(false);
|
||||
|
||||
if(target == DXCDXILDisassemblyTarget)
|
||||
return dxbc->GetDisassembly(true);
|
||||
return sh->GetWriteableDXBC()->GetDisassembly(true);
|
||||
|
||||
if(target == LiveDriverDisassemblyTarget)
|
||||
{
|
||||
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
rdcarray<DebugMessage> GetDebugMessages();
|
||||
|
||||
rdcarray<ShaderEntryPoint> GetShaderEntryPoints(ResourceId shader);
|
||||
ShaderReflection *GetShader(ResourceId pipeline, ResourceId shader, ShaderEntryPoint entry);
|
||||
const ShaderReflection *GetShader(ResourceId pipeline, ResourceId shader, ShaderEntryPoint entry);
|
||||
|
||||
rdcarray<rdcstr> GetDisassemblyTargets(bool withPipeline);
|
||||
rdcstr DisassembleShader(ResourceId pipeline, const ShaderReflection *refl, const rdcstr &target);
|
||||
@@ -255,7 +255,7 @@ public:
|
||||
rdcarray<PixelModification> PixelHistory(rdcarray<EventUsage> events, ResourceId target, uint32_t x,
|
||||
uint32_t y, const Subresource &sub, CompType typeCast);
|
||||
|
||||
ID3DBlob *CompileShaderDebugFetcher(DXBC::DXBCContainer *dxbc, const rdcstr &hlsl);
|
||||
ID3DBlob *CompileShaderDebugFetcher(const DXBC::DXBCContainer *dxbc, const rdcstr &hlsl);
|
||||
ID3D12Resource *CreateInputFetchBuffer(DXDebug::InputFetcher &fetcher, uint64_t &laneDataOffset,
|
||||
uint64_t &evalDataOffset);
|
||||
ID3D12RootSignature *CreateInputFetchRootSig(bool compute, uint32_t &uavspace, uint32_t &sigElem);
|
||||
|
||||
@@ -942,7 +942,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
static void GetReflections(rdcarray<ShaderReflection *> &refls)
|
||||
static void GetReflections(rdcarray<const ShaderReflection *> &refls)
|
||||
{
|
||||
refls.clear();
|
||||
for(auto it = m_Shaders.begin(); it != m_Shaders.end(); ++it)
|
||||
@@ -987,7 +987,8 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
DXBC::DXBCContainer *GetDXBC()
|
||||
const DXBC::DXBCContainer *GetDXBC() { return GetWriteableDXBC(); }
|
||||
DXBC::DXBCContainer *GetWriteableDXBC()
|
||||
{
|
||||
if(m_DXBCFile == NULL && !m_Bytecode.empty())
|
||||
{
|
||||
@@ -996,7 +997,7 @@ public:
|
||||
}
|
||||
return m_DXBCFile;
|
||||
}
|
||||
ShaderReflection &GetDetails()
|
||||
const ShaderReflection &GetDetails()
|
||||
{
|
||||
if(!m_Built && GetDXBC() != NULL)
|
||||
BuildReflection();
|
||||
|
||||
@@ -970,7 +970,7 @@ static bool AddArraySlots(WrappedID3D12PipelineState::ShaderEntry *shad, uint32_
|
||||
|
||||
bool dynamicUsed = false;
|
||||
|
||||
ShaderReflection &refl = shad->GetDetails();
|
||||
const ShaderReflection &refl = shad->GetDetails();
|
||||
|
||||
for(size_t i = 0; i < refl.readOnlyResources.size(); i++)
|
||||
{
|
||||
|
||||
@@ -1631,7 +1631,7 @@ void GatherConstantBuffers(WrappedID3D12Device *pDevice, const DXBCBytecode::Pro
|
||||
}
|
||||
}
|
||||
|
||||
ID3DBlob *D3D12Replay::CompileShaderDebugFetcher(DXBC::DXBCContainer *dxbc, const rdcstr &hlsl)
|
||||
ID3DBlob *D3D12Replay::CompileShaderDebugFetcher(const DXBC::DXBCContainer *dxbc, const rdcstr &hlsl)
|
||||
{
|
||||
ID3DBlob *psBlob = NULL;
|
||||
|
||||
@@ -1859,7 +1859,7 @@ ShaderDebugTrace *D3D12Replay::DebugVertex(uint32_t eventId, uint32_t vertid, ui
|
||||
return new ShaderDebugTrace;
|
||||
}
|
||||
|
||||
DXBC::DXBCContainer *dxbc = vs->GetDXBC();
|
||||
const DXBC::DXBCContainer *dxbc = vs->GetDXBC();
|
||||
const ShaderReflection &refl = vs->GetDetails();
|
||||
|
||||
if(!dxbc)
|
||||
@@ -1874,7 +1874,7 @@ ShaderDebugTrace *D3D12Replay::DebugVertex(uint32_t eventId, uint32_t vertid, ui
|
||||
return new ShaderDebugTrace;
|
||||
}
|
||||
|
||||
dxbc->GetDisassembly(false);
|
||||
vs->GetWriteableDXBC()->GetDisassembly(false);
|
||||
|
||||
const ActionDescription *action = m_pDevice->GetAction(eventId);
|
||||
|
||||
@@ -2756,7 +2756,7 @@ ShaderDebugTrace *D3D12Replay::DebugPixel(uint32_t eventId, uint32_t x, uint32_t
|
||||
return new ShaderDebugTrace;
|
||||
}
|
||||
|
||||
DXBC::DXBCContainer *dxbc = ps->GetDXBC();
|
||||
const DXBC::DXBCContainer *dxbc = ps->GetDXBC();
|
||||
const ShaderReflection &refl = ps->GetDetails();
|
||||
|
||||
if(!dxbc)
|
||||
@@ -2771,12 +2771,12 @@ ShaderDebugTrace *D3D12Replay::DebugPixel(uint32_t eventId, uint32_t x, uint32_t
|
||||
return new ShaderDebugTrace;
|
||||
}
|
||||
|
||||
dxbc->GetDisassembly(false);
|
||||
ps->GetWriteableDXBC()->GetDisassembly(false);
|
||||
|
||||
ShaderDebugTrace *ret = NULL;
|
||||
|
||||
// Fetch the previous stage's disassembly, to match outputs to PS inputs
|
||||
DXBC::DXBCContainer *prevDxbc = NULL;
|
||||
const DXBC::DXBCContainer *prevDxbc = NULL;
|
||||
// Check for geometry shader first
|
||||
{
|
||||
WrappedID3D12Shader *gs = (WrappedID3D12Shader *)pso->graphics->GS.pShaderBytecode;
|
||||
@@ -3334,7 +3334,7 @@ ShaderDebugTrace *D3D12Replay::DebugThread(uint32_t eventId,
|
||||
return new ShaderDebugTrace;
|
||||
}
|
||||
|
||||
DXBC::DXBCContainer *dxbc = cs->GetDXBC();
|
||||
const DXBC::DXBCContainer *dxbc = cs->GetDXBC();
|
||||
const ShaderReflection &refl = cs->GetDetails();
|
||||
|
||||
if(!dxbc)
|
||||
@@ -3349,7 +3349,7 @@ ShaderDebugTrace *D3D12Replay::DebugThread(uint32_t eventId,
|
||||
return new ShaderDebugTrace;
|
||||
}
|
||||
|
||||
dxbc->GetDisassembly(false);
|
||||
cs->GetWriteableDXBC()->GetDisassembly(false);
|
||||
|
||||
ShaderDebugTrace *ret = NULL;
|
||||
if(dxbc->GetDXBCByteCode())
|
||||
|
||||
@@ -621,9 +621,9 @@ struct ShaderBindpointMapping;
|
||||
void EvaluateVertexAttributeBinds(GLuint curProg, const ShaderReflection *refl, bool spirv,
|
||||
rdcarray<int32_t> &vertexAttrBindings);
|
||||
|
||||
void GetCurrentBinding(GLuint curProg, ShaderReflection *refl, const ShaderResource &resource,
|
||||
void GetCurrentBinding(GLuint curProg, const ShaderReflection *refl, const ShaderResource &resource,
|
||||
uint32_t &slot, bool &used);
|
||||
void GetCurrentBinding(GLuint curProg, ShaderReflection *refl, const ConstantBlock &cblock,
|
||||
void GetCurrentBinding(GLuint curProg, const ShaderReflection *refl, const ConstantBlock &cblock,
|
||||
uint32_t &slot, bool &used);
|
||||
|
||||
// calls glBlitFramebuffer but ensures no state can interfere like scissor or color mask
|
||||
@@ -917,8 +917,8 @@ template <typename SerialiserType>
|
||||
void SerialiseProgramUniforms(SerialiserType &ser, CaptureState state,
|
||||
const PerStageReflections &stages, GLuint prog,
|
||||
std::map<GLint, GLint> *locTranslate);
|
||||
bool CopyProgramAttribBindings(GLuint progsrc, GLuint progdst, ShaderReflection *refl);
|
||||
bool CopyProgramFragDataBindings(GLuint progsrc, GLuint progdst, ShaderReflection *refl);
|
||||
bool CopyProgramAttribBindings(GLuint progsrc, GLuint progdst, const ShaderReflection *refl);
|
||||
bool CopyProgramFragDataBindings(GLuint progsrc, GLuint progdst, const ShaderReflection *refl);
|
||||
template <typename SerialiserType>
|
||||
bool SerialiseProgramBindings(SerialiserType &ser, CaptureState state,
|
||||
const PerStageReflections &stages, GLuint prog);
|
||||
|
||||
@@ -1553,7 +1553,7 @@ void GLReplay::FillWithDiscardPattern(DiscardType type, ResourceId id, GLuint mi
|
||||
|
||||
GLMarkerRegion region("FillWithDiscardPattern Texture");
|
||||
|
||||
auto &texDetails = drv.m_Textures[id];
|
||||
WrappedOpenGL::TextureData &texDetails = drv.m_Textures[id];
|
||||
|
||||
GLenum fmt = texDetails.internalFormat;
|
||||
|
||||
@@ -1684,7 +1684,7 @@ void GLReplay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, const Subre
|
||||
texDisplay.xOffset = -float(x << sub.mip);
|
||||
texDisplay.yOffset = -float(y << sub.mip);
|
||||
|
||||
auto &texDetails = m_pDriver->m_Textures[texDisplay.resourceId];
|
||||
WrappedOpenGL::TextureData &texDetails = m_pDriver->m_Textures[texDisplay.resourceId];
|
||||
|
||||
uint32_t mipWidth = RDCMAX(1U, (uint32_t)texDetails.width >> sub.mip);
|
||||
uint32_t mipHeight = RDCMAX(1U, (uint32_t)texDetails.height >> sub.mip);
|
||||
@@ -1756,7 +1756,7 @@ void GLReplay::PickPixel(ResourceId texture, uint32_t x, uint32_t y, const Subre
|
||||
bool GLReplay::GetMinMax(ResourceId texid, const Subresource &sub, CompType typeCast, float *minval,
|
||||
float *maxval)
|
||||
{
|
||||
auto &texDetails = m_pDriver->m_Textures[texid];
|
||||
WrappedOpenGL::TextureData &texDetails = m_pDriver->m_Textures[texid];
|
||||
|
||||
if(!IsCompressedFormat(texDetails.internalFormat) &&
|
||||
GetBaseFormat(texDetails.internalFormat) == eGL_DEPTH_STENCIL)
|
||||
@@ -1814,7 +1814,7 @@ bool GLReplay::GetMinMax(ResourceId texid, const Subresource &sub, CompType type
|
||||
if(!HasExt[ARB_compute_shader] || !HasExt[ARB_shading_language_420pack])
|
||||
return false;
|
||||
|
||||
auto &texDetails = m_pDriver->m_Textures[texid];
|
||||
WrappedOpenGL::TextureData &texDetails = m_pDriver->m_Textures[texid];
|
||||
|
||||
TextureDescription details = GetTexture(texid);
|
||||
|
||||
@@ -2044,7 +2044,7 @@ bool GLReplay::GetHistogram(ResourceId texid, const Subresource &sub, CompType t
|
||||
// take a local copy so we can modify it
|
||||
rdcfixedarray<bool, 4> channels = channels_;
|
||||
|
||||
auto &texDetails = m_pDriver->m_Textures[texid];
|
||||
WrappedOpenGL::TextureData &texDetails = m_pDriver->m_Textures[texid];
|
||||
|
||||
TextureDescription details = GetTexture(texid);
|
||||
|
||||
|
||||
@@ -1721,10 +1721,10 @@ void WrappedOpenGL::ReplaceResource(ResourceId from, ResourceId to)
|
||||
GLuint progdst = toresource.name;
|
||||
|
||||
if(shaderType == eGL_VERTEX_SHADER)
|
||||
CopyProgramAttribBindings(progsrc, progdst, shadDetails.reflection);
|
||||
CopyProgramAttribBindings(progsrc, progdst, shadDetails.GetReflection());
|
||||
|
||||
if(shaderType == eGL_FRAGMENT_SHADER)
|
||||
CopyProgramFragDataBindings(progsrc, progdst, shadDetails.reflection);
|
||||
CopyProgramFragDataBindings(progsrc, progdst, shadDetails.GetReflection());
|
||||
|
||||
{
|
||||
PerStageReflections dstStages;
|
||||
@@ -1872,10 +1872,10 @@ void WrappedOpenGL::RefreshDerivedReplacements()
|
||||
ResourceId fs = progdata.stageShaders[4];
|
||||
|
||||
if(vs != ResourceId())
|
||||
CopyProgramAttribBindings(progsrc, progdst, m_Shaders[vs].reflection);
|
||||
CopyProgramAttribBindings(progsrc, progdst, GetShader(vs).GetReflection());
|
||||
|
||||
if(fs != ResourceId())
|
||||
CopyProgramFragDataBindings(progsrc, progdst, m_Shaders[fs].reflection);
|
||||
CopyProgramFragDataBindings(progsrc, progdst, GetShader(fs).GetReflection());
|
||||
|
||||
// link new program
|
||||
glLinkProgram(progdst);
|
||||
@@ -5460,7 +5460,7 @@ void WrappedOpenGL::AddUsage(const ActionDescription &a)
|
||||
GLRenderState rs;
|
||||
rs.FetchState(this);
|
||||
|
||||
ShaderReflection *refl[NumShaderStages] = {NULL};
|
||||
const ShaderReflection *refl[NumShaderStages] = {NULL};
|
||||
GLuint progForStage[NumShaderStages] = {};
|
||||
|
||||
GLuint curProg = 0;
|
||||
@@ -5476,7 +5476,8 @@ void WrappedOpenGL::AddUsage(const ActionDescription &a)
|
||||
}
|
||||
else
|
||||
{
|
||||
auto &pipeDetails = m_Pipelines[rm->GetResID(ProgramPipeRes(ctx, curProg))];
|
||||
const WrappedOpenGL::PipelineData &pipeDetails =
|
||||
GetPipeline(rm->GetResID(ProgramPipeRes(ctx, curProg)));
|
||||
|
||||
for(size_t i = 0; i < ARRAY_COUNT(pipeDetails.stageShaders); i++)
|
||||
{
|
||||
@@ -5484,7 +5485,7 @@ void WrappedOpenGL::AddUsage(const ActionDescription &a)
|
||||
{
|
||||
curProg = rm->GetCurrentResource(pipeDetails.stagePrograms[i]).name;
|
||||
|
||||
refl[i] = m_Shaders[pipeDetails.stageShaders[i]].reflection;
|
||||
refl[i] = GetShader(pipeDetails.stageShaders[i]).GetReflection();
|
||||
progForStage[i] = curProg;
|
||||
}
|
||||
}
|
||||
@@ -5492,13 +5493,14 @@ void WrappedOpenGL::AddUsage(const ActionDescription &a)
|
||||
}
|
||||
else
|
||||
{
|
||||
auto &progDetails = m_Programs[rm->GetResID(ProgramRes(ctx, curProg))];
|
||||
const WrappedOpenGL::ProgramData &progDetails =
|
||||
GetProgram(rm->GetResID(ProgramRes(ctx, curProg)));
|
||||
|
||||
for(size_t i = 0; i < ARRAY_COUNT(progDetails.stageShaders); i++)
|
||||
{
|
||||
if(progDetails.stageShaders[i] != ResourceId())
|
||||
{
|
||||
refl[i] = m_Shaders[progDetails.stageShaders[i]].reflection;
|
||||
refl[i] = GetShader(progDetails.stageShaders[i]).GetReflection();
|
||||
progForStage[i] = curProg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -722,8 +722,8 @@ public:
|
||||
rdcspv::Reflector spirv;
|
||||
rdcstr disassembly;
|
||||
std::map<size_t, uint32_t> spirvInstructionLines;
|
||||
ShaderReflection *reflection;
|
||||
int version;
|
||||
const ShaderReflection *GetReflection() const { return reflection; }
|
||||
|
||||
// used only when we're capturing and don't have driver-side reflection so we need to emulate
|
||||
glslang::TShader *glslangShader = NULL;
|
||||
@@ -741,6 +741,27 @@ public:
|
||||
void ProcessSPIRVCompilation(WrappedOpenGL &drv, ResourceId id, GLuint realShader,
|
||||
const GLchar *pEntryPoint, GLuint numSpecializationConstants,
|
||||
const GLuint *pConstantIndex, const GLuint *pConstantValue);
|
||||
|
||||
void ClearReflection()
|
||||
{
|
||||
*reflection = ShaderReflection();
|
||||
spirv = rdcspv::Reflector();
|
||||
}
|
||||
const ShaderReflection *StealReflection()
|
||||
{
|
||||
ShaderReflection *ret = reflection;
|
||||
reflection = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Disassemble(const rdcstr &disasmEntryPoint)
|
||||
{
|
||||
if(disassembly.empty())
|
||||
disassembly = spirv.Disassemble(disasmEntryPoint, spirvInstructionLines);
|
||||
}
|
||||
|
||||
private:
|
||||
ShaderReflection *reflection;
|
||||
};
|
||||
|
||||
struct ProgramData
|
||||
@@ -787,15 +808,22 @@ public:
|
||||
std::map<ResourceId, ProgramData> m_Programs;
|
||||
std::map<ResourceId, PipelineData> m_Pipelines;
|
||||
|
||||
bool HasShader(ResourceId id) { return m_Shaders.find(id) != m_Shaders.end(); }
|
||||
const ShaderData &GetShader(ResourceId id) { return m_Shaders[id]; }
|
||||
ShaderData &GetWriteableShader(ResourceId id) { return m_Shaders[id]; }
|
||||
const ProgramData &GetProgram(ResourceId id) { return m_Programs[id]; }
|
||||
ProgramData &GetWriteableProgram(ResourceId id) { return m_Programs[id]; }
|
||||
const PipelineData &GetPipeline(ResourceId id) { return m_Pipelines[id]; }
|
||||
|
||||
void FillReflectionArray(ResourceId program, PerStageReflections &stages)
|
||||
{
|
||||
ProgramData &progdata = m_Programs[program];
|
||||
const ProgramData &progdata = GetProgram(program);
|
||||
for(size_t i = 0; i < ARRAY_COUNT(progdata.stageShaders); i++)
|
||||
{
|
||||
ResourceId shadId = progdata.stageShaders[i];
|
||||
if(shadId != ResourceId())
|
||||
{
|
||||
stages.refls[i] = m_Shaders[shadId].reflection;
|
||||
stages.refls[i] = GetShader(shadId).GetReflection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1177,7 +1177,8 @@ bool GLResourceManager::Serialise_InitialState(SerialiserType &ser, ResourceId i
|
||||
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
WrappedOpenGL::ProgramData &details = m_Driver->m_Programs[GetLiveID(id)];
|
||||
// need to write to serialise the location translation table
|
||||
WrappedOpenGL::ProgramData &details = m_Driver->GetWriteableProgram(GetLiveID(id));
|
||||
|
||||
m_Driver->FillReflectionArray(GetLiveID(id), stages);
|
||||
|
||||
@@ -1193,15 +1194,15 @@ bool GLResourceManager::Serialise_InitialState(SerialiserType &ser, ResourceId i
|
||||
|
||||
numShaders++;
|
||||
|
||||
const auto &shadDetails = m_Driver->m_Shaders[details.stageShaders[i]];
|
||||
const WrappedOpenGL::ShaderData &shadDetails = m_Driver->GetShader(details.stageShaders[i]);
|
||||
|
||||
IsProgramSPIRV |= shadDetails.reflection->encoding == ShaderEncoding::OpenGLSPIRV;
|
||||
IsProgramSPIRV |= shadDetails.GetReflection()->encoding == ShaderEncoding::OpenGLSPIRV;
|
||||
|
||||
GLuint shad = drv.glCreateShader(shadDetails.type);
|
||||
|
||||
if(shadDetails.type == eGL_VERTEX_SHADER)
|
||||
{
|
||||
for(const SigParameter &sig : shadDetails.reflection->outputSignature)
|
||||
for(const SigParameter &sig : shadDetails.GetReflection()->outputSignature)
|
||||
{
|
||||
rdcstr name = sig.varName;
|
||||
|
||||
@@ -2224,17 +2225,19 @@ void GLResourceManager::Apply_InitialState(GLResource live, GLInitialContents &i
|
||||
{
|
||||
ResourceId Id = GetID(live);
|
||||
|
||||
const WrappedOpenGL::ProgramData &prog = m_Driver->m_Programs[Id];
|
||||
const WrappedOpenGL::ProgramData &prog = m_Driver->GetProgram(Id);
|
||||
|
||||
bool changedBindings = false;
|
||||
|
||||
if(prog.stageShaders[0] != ResourceId())
|
||||
changedBindings |= CopyProgramAttribBindings(
|
||||
initial.resource.name, live.name, m_Driver->m_Shaders[prog.stageShaders[0]].reflection);
|
||||
changedBindings |=
|
||||
CopyProgramAttribBindings(initial.resource.name, live.name,
|
||||
m_Driver->GetShader(prog.stageShaders[0]).GetReflection());
|
||||
|
||||
if(prog.stageShaders[4] != ResourceId())
|
||||
changedBindings |= CopyProgramFragDataBindings(
|
||||
initial.resource.name, live.name, m_Driver->m_Shaders[prog.stageShaders[4]].reflection);
|
||||
changedBindings |=
|
||||
CopyProgramFragDataBindings(initial.resource.name, live.name,
|
||||
m_Driver->GetShader(prog.stageShaders[4]).GetReflection());
|
||||
|
||||
// we need to re-link the program to apply the bindings, as long as it's linkable.
|
||||
// See the comment on shaderProgramUnlinkable for more information.
|
||||
|
||||
@@ -53,7 +53,7 @@ bool GLReplay::CreateFragmentShaderReplacementProgram(GLuint program, GLuint rep
|
||||
GLuint tmpShaders[4] = {0};
|
||||
|
||||
// the reflection for the vertex shader, used to copy vertex bindings
|
||||
ShaderReflection *vsRefl = NULL;
|
||||
const ShaderReflection *vsRefl = NULL;
|
||||
|
||||
bool HasSPIRVShaders = false;
|
||||
bool HasGLSLShaders = false;
|
||||
@@ -67,7 +67,7 @@ bool GLReplay::CreateFragmentShaderReplacementProgram(GLuint program, GLuint rep
|
||||
else
|
||||
{
|
||||
ResourceId id = m_pDriver->GetResourceManager()->GetResID(ProgramPipeRes(ctx, pipeline));
|
||||
const WrappedOpenGL::PipelineData &pipeDetails = m_pDriver->m_Pipelines[id];
|
||||
const WrappedOpenGL::PipelineData &pipeDetails = m_pDriver->GetPipeline(id);
|
||||
|
||||
// fetch the corresponding shaders and programs for each stage
|
||||
for(size_t i = 0; i < 4; i++)
|
||||
@@ -75,9 +75,9 @@ bool GLReplay::CreateFragmentShaderReplacementProgram(GLuint program, GLuint rep
|
||||
if(pipeDetails.stageShaders[i] != ResourceId())
|
||||
{
|
||||
const WrappedOpenGL::ShaderData &shadDetails =
|
||||
m_pDriver->m_Shaders[pipeDetails.stageShaders[i]];
|
||||
m_pDriver->GetShader(pipeDetails.stageShaders[i]);
|
||||
|
||||
if(shadDetails.reflection->encoding == ShaderEncoding::OpenGLSPIRV)
|
||||
if(shadDetails.GetReflection()->encoding == ShaderEncoding::OpenGLSPIRV)
|
||||
HasSPIRVShaders = true;
|
||||
else
|
||||
HasGLSLShaders = true;
|
||||
@@ -90,7 +90,7 @@ bool GLReplay::CreateFragmentShaderReplacementProgram(GLuint program, GLuint rep
|
||||
if(pipeDetails.stagePrograms[i] == pipeDetails.stageShaders[i])
|
||||
{
|
||||
const WrappedOpenGL::ProgramData &progDetails =
|
||||
m_pDriver->m_Programs[pipeDetails.stagePrograms[i]];
|
||||
m_pDriver->GetProgram(pipeDetails.stagePrograms[i]);
|
||||
|
||||
if(progDetails.shaderProgramUnlinkable)
|
||||
{
|
||||
@@ -126,7 +126,7 @@ bool GLReplay::CreateFragmentShaderReplacementProgram(GLuint program, GLuint rep
|
||||
else
|
||||
{
|
||||
const WrappedOpenGL::ProgramData &progDetails =
|
||||
m_pDriver->m_Programs[m_pDriver->GetResourceManager()->GetResID(ProgramRes(ctx, program))];
|
||||
m_pDriver->GetProgram(m_pDriver->GetResourceManager()->GetResID(ProgramRes(ctx, program)));
|
||||
|
||||
// fetch any and all non-fragment shader shaders
|
||||
for(size_t i = 0; i < 4; i++)
|
||||
@@ -138,9 +138,9 @@ bool GLReplay::CreateFragmentShaderReplacementProgram(GLuint program, GLuint rep
|
||||
m_pDriver->GetResourceManager()->GetCurrentResource(progDetails.stageShaders[i]).name;
|
||||
|
||||
const WrappedOpenGL::ShaderData &shadDetails =
|
||||
m_pDriver->m_Shaders[progDetails.stageShaders[i]];
|
||||
m_pDriver->GetShader(progDetails.stageShaders[i]);
|
||||
|
||||
if(shadDetails.reflection->encoding == ShaderEncoding::OpenGLSPIRV)
|
||||
if(shadDetails.GetReflection()->encoding == ShaderEncoding::OpenGLSPIRV)
|
||||
HasSPIRVShaders = true;
|
||||
else
|
||||
HasGLSLShaders = true;
|
||||
@@ -413,14 +413,14 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, Debug
|
||||
|
||||
if(rs.Program.name)
|
||||
vs =
|
||||
m_pDriver->m_Programs[m_pDriver->GetResourceManager()->GetResID(rs.Program)].stageShaders[0];
|
||||
m_pDriver->GetProgram(m_pDriver->GetResourceManager()->GetResID(rs.Program)).stageShaders[0];
|
||||
else
|
||||
vs = m_pDriver->m_Pipelines[m_pDriver->GetResourceManager()->GetResID(rs.Pipeline)]
|
||||
vs = m_pDriver->GetPipeline(m_pDriver->GetResourceManager()->GetResID(rs.Pipeline))
|
||||
.stageShaders[0];
|
||||
|
||||
if(vs != ResourceId())
|
||||
{
|
||||
glslVer = m_pDriver->m_Shaders[vs].version;
|
||||
glslVer = m_pDriver->GetShader(vs).version;
|
||||
if(glslVer == 0)
|
||||
glslVer = 100;
|
||||
}
|
||||
@@ -501,7 +501,7 @@ ResourceId GLReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, Debug
|
||||
overlayFixedColLocation =
|
||||
drv.glGetUniformLocation(DebugData.overlayProg, "RENDERDOC_Fixed_Color");
|
||||
|
||||
auto &texDetails = m_pDriver->m_Textures[texid];
|
||||
WrappedOpenGL::TextureData &texDetails = m_pDriver->m_Textures[texid];
|
||||
|
||||
GLenum texBindingEnum = eGL_TEXTURE_2D;
|
||||
GLenum texQueryEnum = eGL_TEXTURE_BINDING_2D;
|
||||
|
||||
@@ -33,8 +33,9 @@
|
||||
#include "gl_resources.h"
|
||||
#include "gl_shader_refl.h"
|
||||
|
||||
static void MakeVaryingsFromShaderReflection(ShaderReflection &refl, rdcarray<const char *> &varyings,
|
||||
uint32_t &stride, ShaderReflection *trimRefl = NULL)
|
||||
static void MakeVaryingsFromShaderReflection(const ShaderReflection &refl,
|
||||
rdcarray<const char *> &varyings, uint32_t &stride,
|
||||
ShaderReflection *trimRefl = NULL)
|
||||
{
|
||||
static rdcarray<rdcstr> tmpStrings;
|
||||
tmpStrings.reserve(refl.outputSignature.size());
|
||||
@@ -249,9 +250,9 @@ void GLReplay::InitPostVSBuffers(uint32_t eventId)
|
||||
drv.glBindBuffer(eGL_QUERY_BUFFER, 0);
|
||||
|
||||
// reflection structures
|
||||
ShaderReflection *vsRefl = NULL;
|
||||
ShaderReflection *tesRefl = NULL;
|
||||
ShaderReflection *gsRefl = NULL;
|
||||
const ShaderReflection *vsRefl = NULL;
|
||||
const ShaderReflection *tesRefl = NULL;
|
||||
const ShaderReflection *gsRefl = NULL;
|
||||
SPIRVPatchData vsPatch, tesPatch, gsPatch;
|
||||
|
||||
// the program we'll be binding, that we attach shaders to
|
||||
@@ -302,31 +303,31 @@ void GLReplay::InitPostVSBuffers(uint32_t eventId)
|
||||
else
|
||||
{
|
||||
ResourceId id = rm->GetResID(rs.Pipeline);
|
||||
auto &pipeDetails = m_pDriver->m_Pipelines[id];
|
||||
const WrappedOpenGL::PipelineData &pipeDetails = m_pDriver->GetPipeline(id);
|
||||
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
if(pipeDetails.stageShaders[i] != ResourceId())
|
||||
{
|
||||
ShaderReflection *refl = NULL;
|
||||
const ShaderReflection *refl = NULL;
|
||||
if(i == 0)
|
||||
{
|
||||
refl = vsRefl = GetShader(ResourceId(), pipeDetails.stageShaders[i], ShaderEntryPoint());
|
||||
glslVer = m_pDriver->m_Shaders[pipeDetails.stageShaders[0]].version;
|
||||
vsPatch = m_pDriver->m_Shaders[pipeDetails.stageShaders[0]].patchData;
|
||||
glslVer = m_pDriver->GetShader(pipeDetails.stageShaders[0]).version;
|
||||
vsPatch = m_pDriver->GetShader(pipeDetails.stageShaders[0]).patchData;
|
||||
|
||||
CheckVertexOutputUses(m_pDriver->m_Shaders[pipeDetails.stageShaders[0]].sources,
|
||||
CheckVertexOutputUses(m_pDriver->GetShader(pipeDetails.stageShaders[0]).sources,
|
||||
outputUsage);
|
||||
}
|
||||
else if(i == 2)
|
||||
{
|
||||
refl = tesRefl = GetShader(ResourceId(), pipeDetails.stageShaders[2], ShaderEntryPoint());
|
||||
tesPatch = m_pDriver->m_Shaders[pipeDetails.stageShaders[2]].patchData;
|
||||
tesPatch = m_pDriver->GetShader(pipeDetails.stageShaders[2]).patchData;
|
||||
}
|
||||
else if(i == 3)
|
||||
{
|
||||
refl = gsRefl = GetShader(ResourceId(), pipeDetails.stageShaders[3], ShaderEntryPoint());
|
||||
gsPatch = m_pDriver->m_Shaders[pipeDetails.stageShaders[3]].patchData;
|
||||
gsPatch = m_pDriver->GetShader(pipeDetails.stageShaders[3]).patchData;
|
||||
}
|
||||
|
||||
stageShaders[i] = rm->GetCurrentResource(pipeDetails.stageShaders[i]).name;
|
||||
@@ -335,7 +336,7 @@ void GLReplay::InitPostVSBuffers(uint32_t eventId)
|
||||
if(stageShaders[i] == stageSrcPrograms[i])
|
||||
{
|
||||
const WrappedOpenGL::ProgramData &progDetails =
|
||||
m_pDriver->m_Programs[pipeDetails.stagePrograms[i]];
|
||||
m_pDriver->GetProgram(pipeDetails.stagePrograms[i]);
|
||||
|
||||
if(progDetails.shaderProgramUnlinkable)
|
||||
{
|
||||
@@ -360,31 +361,31 @@ void GLReplay::InitPostVSBuffers(uint32_t eventId)
|
||||
}
|
||||
else
|
||||
{
|
||||
auto &progDetails = m_pDriver->m_Programs[rm->GetResID(rs.Program)];
|
||||
const WrappedOpenGL::ProgramData &progDetails = m_pDriver->GetProgram(rm->GetResID(rs.Program));
|
||||
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
if(progDetails.stageShaders[0] != ResourceId())
|
||||
{
|
||||
ShaderReflection *refl = NULL;
|
||||
const ShaderReflection *refl = NULL;
|
||||
if(i == 0)
|
||||
{
|
||||
refl = vsRefl = GetShader(ResourceId(), progDetails.stageShaders[0], ShaderEntryPoint());
|
||||
glslVer = m_pDriver->m_Shaders[progDetails.stageShaders[0]].version;
|
||||
vsPatch = m_pDriver->m_Shaders[progDetails.stageShaders[0]].patchData;
|
||||
glslVer = m_pDriver->GetShader(progDetails.stageShaders[0]).version;
|
||||
vsPatch = m_pDriver->GetShader(progDetails.stageShaders[0]).patchData;
|
||||
|
||||
CheckVertexOutputUses(m_pDriver->m_Shaders[progDetails.stageShaders[0]].sources,
|
||||
CheckVertexOutputUses(m_pDriver->GetShader(progDetails.stageShaders[0]).sources,
|
||||
outputUsage);
|
||||
}
|
||||
else if(i == 2 && progDetails.stageShaders[2] != ResourceId())
|
||||
{
|
||||
refl = tesRefl = GetShader(ResourceId(), progDetails.stageShaders[2], ShaderEntryPoint());
|
||||
tesPatch = m_pDriver->m_Shaders[progDetails.stageShaders[2]].patchData;
|
||||
tesPatch = m_pDriver->GetShader(progDetails.stageShaders[2]).patchData;
|
||||
}
|
||||
else if(i == 3 && progDetails.stageShaders[3] != ResourceId())
|
||||
{
|
||||
refl = gsRefl = GetShader(ResourceId(), progDetails.stageShaders[3], ShaderEntryPoint());
|
||||
gsPatch = m_pDriver->m_Shaders[progDetails.stageShaders[3]].patchData;
|
||||
gsPatch = m_pDriver->GetShader(progDetails.stageShaders[3]).patchData;
|
||||
}
|
||||
|
||||
stageShaders[i] = rm->GetCurrentResource(progDetails.stageShaders[i]).name;
|
||||
@@ -410,7 +411,7 @@ void GLReplay::InitPostVSBuffers(uint32_t eventId)
|
||||
{
|
||||
if(recompile[i] != ResourceId())
|
||||
{
|
||||
const WrappedOpenGL::ShaderData &shadDetails = m_pDriver->m_Shaders[recompile[i]];
|
||||
const WrappedOpenGL::ShaderData &shadDetails = m_pDriver->GetShader(recompile[i]);
|
||||
|
||||
stageShaders[i] = tmpShaders[i] = RecompileShader(drv, shadDetails, action->drawIndex);
|
||||
}
|
||||
@@ -1181,7 +1182,7 @@ void GLReplay::InitPostVSBuffers(uint32_t eventId)
|
||||
{
|
||||
ret.gsout.status.clear();
|
||||
|
||||
ShaderReflection *lastRefl = gsRefl;
|
||||
const ShaderReflection *lastRefl = gsRefl;
|
||||
SPIRVPatchData lastPatch = gsPatch;
|
||||
int lastIndex = 3;
|
||||
|
||||
|
||||
@@ -1190,7 +1190,7 @@ template void SerialiseProgramUniforms(WriteSerialiser &ser, CaptureState state,
|
||||
const PerStageReflections &stages, GLuint prog,
|
||||
std::map<GLint, GLint> *locTranslate);
|
||||
|
||||
bool CopyProgramAttribBindings(GLuint progsrc, GLuint progdst, ShaderReflection *refl)
|
||||
bool CopyProgramAttribBindings(GLuint progsrc, GLuint progdst, const ShaderReflection *refl)
|
||||
{
|
||||
// don't try to copy bindings for SPIR-V shaders. The queries by name may fail, and the bindings
|
||||
// are immutable anyway
|
||||
@@ -1212,7 +1212,7 @@ bool CopyProgramAttribBindings(GLuint progsrc, GLuint progdst, ShaderReflection
|
||||
return !refl->inputSignature.empty();
|
||||
}
|
||||
|
||||
bool CopyProgramFragDataBindings(GLuint progsrc, GLuint progdst, ShaderReflection *refl)
|
||||
bool CopyProgramFragDataBindings(GLuint progsrc, GLuint progdst, const ShaderReflection *refl)
|
||||
{
|
||||
// don't try to copy bindings for SPIR-V shaders. The queries by name may fail, and the bindings
|
||||
// are immutable anyway
|
||||
|
||||
@@ -43,7 +43,7 @@ bool GLReplay::RenderTextureInternal(TextureDisplay cfg, TexDisplayFlags flags)
|
||||
|
||||
WrappedOpenGL &drv = *m_pDriver;
|
||||
|
||||
auto &texDetails = m_pDriver->m_Textures[cfg.resourceId];
|
||||
WrappedOpenGL::TextureData &texDetails = m_pDriver->m_Textures[cfg.resourceId];
|
||||
|
||||
if(texDetails.internalFormat == eGL_NONE)
|
||||
return false;
|
||||
|
||||
@@ -100,11 +100,10 @@ RDResult GLReplay::FatalErrorCheck()
|
||||
IReplayDriver *GLReplay::MakeDummyDriver()
|
||||
{
|
||||
// gather up the shaders we've allocated to pass to the dummy driver
|
||||
rdcarray<ShaderReflection *> shaders;
|
||||
rdcarray<const ShaderReflection *> shaders;
|
||||
for(auto it = m_pDriver->m_Shaders.begin(); it != m_pDriver->m_Shaders.end(); it++)
|
||||
{
|
||||
shaders.push_back(it->second.reflection);
|
||||
it->second.reflection = NULL;
|
||||
shaders.push_back(it->second.StealReflection());
|
||||
}
|
||||
|
||||
IReplayDriver *dummy = new DummyDriver(this, shaders, m_pDriver->DetachStructuredFile());
|
||||
@@ -390,7 +389,7 @@ void GLReplay::GetBufferData(ResourceId buff, uint64_t offset, uint64_t len, byt
|
||||
return;
|
||||
}
|
||||
|
||||
auto &buf = m_pDriver->m_Buffers[buff];
|
||||
WrappedOpenGL::BufferData &buf = m_pDriver->m_Buffers[buff];
|
||||
|
||||
uint64_t bufsize = buf.size;
|
||||
|
||||
@@ -435,7 +434,7 @@ void GLReplay::CacheTexture(ResourceId id)
|
||||
|
||||
MakeCurrentReplayContext(&m_ReplayCtx);
|
||||
|
||||
auto &res = m_pDriver->m_Textures[id];
|
||||
WrappedOpenGL::TextureData &res = m_pDriver->m_Textures[id];
|
||||
WrappedOpenGL &drv = *m_pDriver;
|
||||
|
||||
tex.resourceId = m_pDriver->GetResourceManager()->GetOriginalID(id);
|
||||
@@ -688,7 +687,7 @@ BufferDescription GLReplay::GetBuffer(ResourceId id)
|
||||
|
||||
MakeCurrentReplayContext(&m_ReplayCtx);
|
||||
|
||||
auto &res = m_pDriver->m_Buffers[id];
|
||||
WrappedOpenGL::BufferData &res = m_pDriver->m_Buffers[id];
|
||||
|
||||
if(res.resource.Namespace == eResUnknown)
|
||||
{
|
||||
@@ -754,7 +753,7 @@ rdcarray<TextureDescription> GLReplay::GetTextures()
|
||||
|
||||
for(auto it = m_pDriver->m_Textures.begin(); it != m_pDriver->m_Textures.end(); ++it)
|
||||
{
|
||||
auto &res = m_pDriver->m_Textures[it->first];
|
||||
WrappedOpenGL::TextureData &res = m_pDriver->m_Textures[it->first];
|
||||
|
||||
// skip textures that aren't from the log (except the 'default backbuffer' textures)
|
||||
if(!(res.creationFlags & TextureCategory::SwapBuffer) &&
|
||||
@@ -775,31 +774,32 @@ rdcarray<DebugMessage> GLReplay::GetDebugMessages()
|
||||
|
||||
rdcarray<ShaderEntryPoint> GLReplay::GetShaderEntryPoints(ResourceId shader)
|
||||
{
|
||||
if(m_pDriver->m_Shaders.find(shader) == m_pDriver->m_Shaders.end())
|
||||
if(m_pDriver->HasShader(shader))
|
||||
return {};
|
||||
|
||||
WrappedOpenGL::ShaderData &shaderDetails = m_pDriver->m_Shaders[shader];
|
||||
const WrappedOpenGL::ShaderData &shaderDetails = m_pDriver->GetShader(shader);
|
||||
|
||||
if(shaderDetails.reflection->resourceId == ResourceId())
|
||||
if(shaderDetails.GetReflection()->resourceId == ResourceId())
|
||||
{
|
||||
RDCERR("Can't get shader details without successful reflect");
|
||||
return {};
|
||||
}
|
||||
|
||||
return {{shaderDetails.reflection->entryPoint, shaderDetails.reflection->stage}};
|
||||
return {{shaderDetails.GetReflection()->entryPoint, shaderDetails.GetReflection()->stage}};
|
||||
}
|
||||
|
||||
ShaderReflection *GLReplay::GetShader(ResourceId pipeline, ResourceId shader, ShaderEntryPoint entry)
|
||||
const ShaderReflection *GLReplay::GetShader(ResourceId pipeline, ResourceId shader,
|
||||
ShaderEntryPoint entry)
|
||||
{
|
||||
auto &shaderDetails = m_pDriver->m_Shaders[shader];
|
||||
const WrappedOpenGL::ShaderData &shaderDetails = m_pDriver->GetShader(shader);
|
||||
|
||||
if(shaderDetails.reflection->resourceId == ResourceId())
|
||||
if(shaderDetails.GetReflection()->resourceId == ResourceId())
|
||||
{
|
||||
RDCERR("Can't get shader details without successful reflect");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return shaderDetails.reflection;
|
||||
return shaderDetails.GetReflection();
|
||||
}
|
||||
|
||||
rdcarray<rdcstr> GLReplay::GetDisassemblyTargets(bool withPipeline)
|
||||
@@ -810,20 +810,17 @@ rdcarray<rdcstr> GLReplay::GetDisassemblyTargets(bool withPipeline)
|
||||
rdcstr GLReplay::DisassembleShader(ResourceId pipeline, const ShaderReflection *refl,
|
||||
const rdcstr &target)
|
||||
{
|
||||
auto &shaderDetails =
|
||||
m_pDriver->m_Shaders[m_pDriver->GetResourceManager()->GetLiveID(refl->resourceId)];
|
||||
ResourceId liveId = m_pDriver->GetResourceManager()->GetLiveID(refl->resourceId);
|
||||
const WrappedOpenGL::ShaderData &shaderDetails = m_pDriver->GetShader(liveId);
|
||||
|
||||
if(shaderDetails.sources.empty() && shaderDetails.spirvWords.empty())
|
||||
return "; Invalid Shader Specified";
|
||||
|
||||
if(target == SPIRVDisassemblyTarget || target.empty())
|
||||
{
|
||||
rdcstr &disasm = shaderDetails.disassembly;
|
||||
m_pDriver->GetWriteableShader(liveId).Disassemble(refl->entryPoint);
|
||||
|
||||
if(disasm.empty())
|
||||
disasm = shaderDetails.spirv.Disassemble(refl->entryPoint, shaderDetails.spirvInstructionLines);
|
||||
|
||||
return disasm;
|
||||
return shaderDetails.disassembly;
|
||||
}
|
||||
|
||||
return StringFormat::Fmt("; Invalid disassembly target %s", target.c_str());
|
||||
@@ -1058,7 +1055,7 @@ void GLReplay::SavePipelineState(uint32_t eventId)
|
||||
&pipe.vertexShader, &pipe.tessControlShader, &pipe.tessEvalShader,
|
||||
&pipe.geometryShader, &pipe.fragmentShader, &pipe.computeShader,
|
||||
};
|
||||
ShaderReflection *refls[NumShaderStages] = {NULL};
|
||||
const ShaderReflection *refls[NumShaderStages] = {NULL};
|
||||
ResourceId progIds[NumShaderStages];
|
||||
ResourceId shadIds[NumShaderStages];
|
||||
GLuint progForStage[NumShaderStages] = {};
|
||||
@@ -1087,7 +1084,7 @@ void GLReplay::SavePipelineState(uint32_t eventId)
|
||||
if(curPipe != 0)
|
||||
{
|
||||
ResourceId id = rm->GetResID(ProgramPipeRes(ctx, curPipe));
|
||||
const WrappedOpenGL::PipelineData &pipeDetails = m_pDriver->m_Pipelines[id];
|
||||
const WrappedOpenGL::PipelineData &pipeDetails = m_pDriver->GetPipeline(id);
|
||||
|
||||
pipe.pipelineResourceId = rm->GetUnreplacedOriginalID(id);
|
||||
|
||||
@@ -1109,7 +1106,7 @@ void GLReplay::SavePipelineState(uint32_t eventId)
|
||||
else
|
||||
{
|
||||
ResourceId id = rm->GetResID(ProgramRes(ctx, curProg));
|
||||
const WrappedOpenGL::ProgramData &progDetails = m_pDriver->m_Programs[id];
|
||||
const WrappedOpenGL::ProgramData &progDetails = m_pDriver->GetProgram(id);
|
||||
|
||||
pipe.pipelineResourceId = ResourceId();
|
||||
|
||||
@@ -1137,12 +1134,12 @@ void GLReplay::SavePipelineState(uint32_t eventId)
|
||||
stages[i]->programResourceId = rm->GetUnreplacedOriginalID(progIds[i]);
|
||||
stages[i]->shaderResourceId = rm->GetUnreplacedOriginalID(shadIds[i]);
|
||||
|
||||
const WrappedOpenGL::ShaderData &shaderDetails = m_pDriver->m_Shaders[shadIds[i]];
|
||||
const WrappedOpenGL::ShaderData &shaderDetails = m_pDriver->GetShader(shadIds[i]);
|
||||
|
||||
if(shaderDetails.reflection->resourceId == ResourceId())
|
||||
if(shaderDetails.GetReflection()->resourceId == ResourceId())
|
||||
stages[i]->reflection = refls[i] = NULL;
|
||||
else
|
||||
stages[i]->reflection = refls[i] = shaderDetails.reflection;
|
||||
stages[i]->reflection = refls[i] = shaderDetails.GetReflection();
|
||||
|
||||
if(!shaderDetails.spirvWords.empty())
|
||||
spirv[i] = true;
|
||||
@@ -1169,7 +1166,7 @@ void GLReplay::SavePipelineState(uint32_t eventId)
|
||||
|
||||
for(size_t s = 0; s < NumShaderStages; s++)
|
||||
{
|
||||
ShaderReflection *refl = refls[s];
|
||||
const ShaderReflection *refl = refls[s];
|
||||
|
||||
if(!refl)
|
||||
continue;
|
||||
@@ -1359,7 +1356,7 @@ void GLReplay::SavePipelineState(uint32_t eventId)
|
||||
if(!IsReadOnlyDescriptor(access.type))
|
||||
continue;
|
||||
|
||||
ShaderReflection *refl = refls[(uint32_t)access.stage];
|
||||
const ShaderReflection *refl = refls[(uint32_t)access.stage];
|
||||
if(refl == NULL)
|
||||
{
|
||||
RDCERR("Unexpected NULL reflection on %s shader with a descriptor access",
|
||||
@@ -2856,9 +2853,9 @@ void GLReplay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, Shad
|
||||
|
||||
MakeCurrentReplayContext(&m_ReplayCtx);
|
||||
|
||||
auto &shaderDetails = m_pDriver->m_Shaders[shader];
|
||||
const WrappedOpenGL::ShaderData &shaderDetails = m_pDriver->GetShader(shader);
|
||||
|
||||
if((int32_t)cbufSlot >= shaderDetails.reflection->constantBlocks.count())
|
||||
if((int32_t)cbufSlot >= shaderDetails.GetReflection()->constantBlocks.count())
|
||||
{
|
||||
RDCERR("Requesting invalid constant block");
|
||||
return;
|
||||
@@ -2880,7 +2877,7 @@ void GLReplay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, Shad
|
||||
{
|
||||
ResourceId id =
|
||||
m_pDriver->GetResourceManager()->GetResID(ProgramPipeRes(m_pDriver->GetCtx(), curProg));
|
||||
auto &pipeDetails = m_pDriver->m_Pipelines[id];
|
||||
const WrappedOpenGL::PipelineData &pipeDetails = m_pDriver->GetPipeline(id);
|
||||
|
||||
size_t s = ShaderIdx(shaderDetails.type);
|
||||
|
||||
@@ -2889,11 +2886,11 @@ void GLReplay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, Shad
|
||||
}
|
||||
}
|
||||
|
||||
const ConstantBlock &cblock = shaderDetails.reflection->constantBlocks[cbufSlot];
|
||||
const ConstantBlock &cblock = shaderDetails.GetReflection()->constantBlocks[cbufSlot];
|
||||
|
||||
if(shaderDetails.spirvWords.empty())
|
||||
{
|
||||
OpenGLFillCBufferVariables(shaderDetails.reflection->resourceId, curProg,
|
||||
OpenGLFillCBufferVariables(shaderDetails.GetReflection()->resourceId, curProg,
|
||||
cblock.bufferBacked ? true : false, "", cblock.variables, outvars,
|
||||
data);
|
||||
}
|
||||
@@ -2912,18 +2909,18 @@ void GLReplay::FillCBufferVariables(ResourceId pipeline, ResourceId shader, Shad
|
||||
specconsts.push_back(spec);
|
||||
}
|
||||
|
||||
FillSpecConstantVariables(shaderDetails.reflection->resourceId, shaderDetails.patchData,
|
||||
FillSpecConstantVariables(shaderDetails.GetReflection()->resourceId, shaderDetails.patchData,
|
||||
cblock.variables, outvars, specconsts);
|
||||
}
|
||||
else if(!cblock.bufferBacked)
|
||||
{
|
||||
OpenGLFillCBufferVariables(shaderDetails.reflection->resourceId, curProg, false, "",
|
||||
OpenGLFillCBufferVariables(shaderDetails.GetReflection()->resourceId, curProg, false, "",
|
||||
cblock.variables, outvars, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
StandardFillCBufferVariables(shaderDetails.reflection->resourceId, cblock.variables, outvars,
|
||||
data);
|
||||
StandardFillCBufferVariables(shaderDetails.GetReflection()->resourceId, cblock.variables,
|
||||
outvars, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3591,7 +3588,7 @@ ResourceId GLReplay::ApplyCustomShader(TextureDisplay &display)
|
||||
if(display.customShaderId == ResourceId() || display.resourceId == ResourceId())
|
||||
return ResourceId();
|
||||
|
||||
auto &texDetails = m_pDriver->m_Textures[display.resourceId];
|
||||
WrappedOpenGL::TextureData &texDetails = m_pDriver->m_Textures[display.resourceId];
|
||||
|
||||
MakeCurrentReplayContext(m_DebugCtx);
|
||||
|
||||
@@ -3926,7 +3923,7 @@ void GLReplay::SetProxyTextureData(ResourceId texid, const Subresource &sub, byt
|
||||
|
||||
GLuint tex = m_pDriver->GetResourceManager()->GetCurrentResource(texid).name;
|
||||
|
||||
auto &texdetails = m_pDriver->m_Textures[texid];
|
||||
WrappedOpenGL::TextureData &texdetails = m_pDriver->m_Textures[texid];
|
||||
|
||||
if(texdetails.curType == eGL_NONE)
|
||||
return;
|
||||
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
TextureDescription GetTexture(ResourceId id);
|
||||
|
||||
rdcarray<ShaderEntryPoint> GetShaderEntryPoints(ResourceId shader);
|
||||
ShaderReflection *GetShader(ResourceId pipeline, ResourceId shader, ShaderEntryPoint entry);
|
||||
const ShaderReflection *GetShader(ResourceId pipeline, ResourceId shader, ShaderEntryPoint entry);
|
||||
|
||||
rdcarray<rdcstr> GetDisassemblyTargets(bool withPipeline);
|
||||
rdcstr DisassembleShader(ResourceId pipeline, const ShaderReflection *refl, const rdcstr &target);
|
||||
|
||||
@@ -2473,7 +2473,7 @@ void EvaluateVertexAttributeBinds(GLuint curProg, const ShaderReflection *refl,
|
||||
}
|
||||
}
|
||||
|
||||
void GetCurrentBinding(GLuint curProg, ShaderReflection *refl, const ShaderResource &resource,
|
||||
void GetCurrentBinding(GLuint curProg, const ShaderReflection *refl, const ShaderResource &resource,
|
||||
uint32_t &slot, bool &used)
|
||||
{
|
||||
// in case of bugs, we readback into this array instead of a single int
|
||||
@@ -2696,7 +2696,7 @@ void GetCurrentBinding(GLuint curProg, ShaderReflection *refl, const ShaderResou
|
||||
#endif
|
||||
}
|
||||
|
||||
void GetCurrentBinding(GLuint curProg, ShaderReflection *refl, const ConstantBlock &cblock,
|
||||
void GetCurrentBinding(GLuint curProg, const ShaderReflection *refl, const ConstantBlock &cblock,
|
||||
uint32_t &slot, bool &used)
|
||||
{
|
||||
if(refl->encoding == ShaderEncoding::OpenGLSPIRV)
|
||||
|
||||
@@ -200,14 +200,14 @@ bool WrappedOpenGL::Check_SafeDraw(bool indexed)
|
||||
if(prog)
|
||||
{
|
||||
ResourceId id = GetResourceManager()->GetResID(ProgramRes(GetCtx(), prog));
|
||||
const ProgramData &progDetails = m_Programs[id];
|
||||
const ProgramData &progDetails = GetProgram(id);
|
||||
|
||||
vs = progDetails.stageShaders[0];
|
||||
}
|
||||
else if(pipe)
|
||||
{
|
||||
ResourceId id = GetResourceManager()->GetResID(ProgramPipeRes(GetCtx(), pipe));
|
||||
const PipelineData &pipeDetails = m_Pipelines[id];
|
||||
const PipelineData &pipeDetails = GetPipeline(id);
|
||||
|
||||
GL.glGetProgramPipelineiv(pipe, eGL_VERTEX_SHADER, (GLint *)&prog);
|
||||
|
||||
@@ -223,17 +223,17 @@ bool WrappedOpenGL::Check_SafeDraw(bool indexed)
|
||||
}
|
||||
else
|
||||
{
|
||||
const ShaderData &shaderDetails = m_Shaders[vs];
|
||||
const ShaderData &shaderDetails = GetShader(vs);
|
||||
|
||||
rdcarray<int32_t> vertexAttrBindings;
|
||||
EvaluateVertexAttributeBinds(prog, shaderDetails.reflection, !shaderDetails.spirvWords.empty(),
|
||||
vertexAttrBindings);
|
||||
EvaluateVertexAttributeBinds(prog, shaderDetails.GetReflection(),
|
||||
!shaderDetails.spirvWords.empty(), vertexAttrBindings);
|
||||
|
||||
for(int attrib = 0; attrib < vertexAttrBindings.count(); attrib++)
|
||||
{
|
||||
// skip attributes that don't map to the shader, they're unused
|
||||
int reflIndex = vertexAttrBindings[attrib];
|
||||
if(reflIndex >= 0 && reflIndex < shaderDetails.reflection->inputSignature.count())
|
||||
if(reflIndex >= 0 && reflIndex < shaderDetails.GetReflection()->inputSignature.count())
|
||||
{
|
||||
// check that this attribute is in-bounds, and enabled. If so then the driver will read from
|
||||
// it so we make sure there's a buffer bound
|
||||
@@ -258,7 +258,7 @@ bool WrappedOpenGL::Check_SafeDraw(bool indexed)
|
||||
"No vertex buffer bound to attribute %d: %s (buffer slot %d) at draw!\n"
|
||||
"This can be caused by deleting a buffer early, before all draws using it "
|
||||
"have been made",
|
||||
attrib, shaderDetails.reflection->inputSignature[reflIndex].varName.c_str(),
|
||||
attrib, shaderDetails.GetReflection()->inputSignature[reflIndex].varName.c_str(),
|
||||
bufIdx));
|
||||
|
||||
ret = false;
|
||||
@@ -278,7 +278,7 @@ bool WrappedOpenGL::Check_SafeDraw(bool indexed)
|
||||
"draw is 0-sized!\n"
|
||||
"Has this buffer been initialised?",
|
||||
ToStr(GetResourceManager()->GetOriginalID(id)).c_str(), attrib,
|
||||
shaderDetails.reflection->inputSignature[reflIndex].varName.c_str(), bufIdx));
|
||||
shaderDetails.GetReflection()->inputSignature[reflIndex].varName.c_str(), bufIdx));
|
||||
|
||||
ret = false;
|
||||
}
|
||||
|
||||
@@ -2574,15 +2574,15 @@ static glslang::TProgram *GetGlslangProgram(GLuint program, bool *hasRealProgram
|
||||
|
||||
ResourceId id = driver->GetResourceManager()->GetResID(ProgramRes(driver->GetCtx(), program));
|
||||
|
||||
if(!driver->m_Programs[id].glslangProgram)
|
||||
if(!driver->GetProgram(id).glslangProgram)
|
||||
{
|
||||
RDCERR("Don't have glslang program for reflecting program %u = %s", program, ToStr(id).c_str());
|
||||
}
|
||||
|
||||
if(hasRealProgram)
|
||||
*hasRealProgram = !driver->m_Programs[id].shaders.empty();
|
||||
*hasRealProgram = !driver->GetProgram(id).shaders.empty();
|
||||
|
||||
return driver->m_Programs[id].glslangProgram;
|
||||
return driver->GetProgram(id).glslangProgram;
|
||||
}
|
||||
|
||||
void APIENTRY _glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname,
|
||||
@@ -4242,7 +4242,7 @@ void MakeOfflineShaderReflection(ShaderStage stage, const rdcstr &source, const
|
||||
REQUIRE(prog);
|
||||
|
||||
// the lookup won't get a valid Id, so set the program to the ResourceId()
|
||||
driver.m_Programs[ResourceId()].glslangProgram = prog;
|
||||
driver.GetWriteableProgram(ResourceId()).glslangProgram = prog;
|
||||
|
||||
GLuint fakeProg = 0;
|
||||
|
||||
@@ -4376,7 +4376,7 @@ void main() {
|
||||
REQUIRE(prog);
|
||||
|
||||
// the lookup won't get a valid Id, so set the program to the ResourceId()
|
||||
driver.m_Programs[ResourceId()].glslangProgram = prog;
|
||||
driver.GetWriteableProgram(ResourceId()).glslangProgram = prog;
|
||||
|
||||
GLint numUniforms = 0;
|
||||
GL.glGetProgramInterfaceiv(0, eGL_UNIFORM, eGL_ACTIVE_RESOURCES, &numUniforms);
|
||||
|
||||
@@ -418,10 +418,9 @@ bool WrappedOpenGL::Serialise_glShaderSource(SerialiserType &ser, GLuint shaderH
|
||||
// Doing this means we support the case of recompiling a shader different ways
|
||||
// and relinking a program before use, which is still moderately crazy and
|
||||
// so people who do that should be moderately ashamed.
|
||||
if(m_Shaders[liveId].reflection->resourceId != ResourceId())
|
||||
if(m_Shaders[liveId].GetReflection()->resourceId != ResourceId())
|
||||
{
|
||||
m_Shaders[liveId].spirv = rdcspv::Reflector();
|
||||
*m_Shaders[liveId].reflection = ShaderReflection();
|
||||
m_Shaders[liveId].ClearReflection();
|
||||
}
|
||||
|
||||
AddResourceInitChunk(shader);
|
||||
@@ -691,14 +690,14 @@ bool WrappedOpenGL::Serialise_glCreateShaderProgramv(SerialiserType &ser, GLenum
|
||||
|
||||
ResourceId liveId = m_ResourceManager->RegisterResource(res);
|
||||
|
||||
auto &progDetails = m_Programs[liveId];
|
||||
WrappedOpenGL::ProgramData &progDetails = m_Programs[liveId];
|
||||
|
||||
progDetails.linked = true;
|
||||
progDetails.shaders.push_back(liveId);
|
||||
progDetails.stageShaders[ShaderIdx(type)] = liveId;
|
||||
progDetails.shaderProgramUnlinkable = true;
|
||||
|
||||
auto &shadDetails = m_Shaders[liveId];
|
||||
WrappedOpenGL::ShaderData &shadDetails = m_Shaders[liveId];
|
||||
|
||||
shadDetails.type = type;
|
||||
shadDetails.sources.swap(src);
|
||||
@@ -846,7 +845,7 @@ bool WrappedOpenGL::Serialise_glLinkProgram(SerialiserType &ser, GLuint programH
|
||||
{
|
||||
for(size_t sh = 0; sh < progDetails.shaders.size(); sh++)
|
||||
{
|
||||
if(m_Shaders[progDetails.shaders[sh]].type == ShaderEnum(s))
|
||||
if(GetShader(progDetails.shaders[sh]).type == ShaderEnum(s))
|
||||
progDetails.stageShaders[s] = progDetails.shaders[sh];
|
||||
}
|
||||
}
|
||||
@@ -860,14 +859,14 @@ bool WrappedOpenGL::Serialise_glLinkProgram(SerialiserType &ser, GLuint programH
|
||||
if(id == ResourceId())
|
||||
continue;
|
||||
|
||||
glslang::TShader *s = m_Shaders[id].glslangShader;
|
||||
glslang::TShader *s = GetShader(id).glslangShader;
|
||||
if(s == NULL)
|
||||
{
|
||||
RDCERR("Shader attached with no compiled glslang reflection shader!");
|
||||
continue;
|
||||
}
|
||||
|
||||
glslangShaders.push_back(m_Shaders[id].glslangShader);
|
||||
glslangShaders.push_back(s);
|
||||
}
|
||||
|
||||
progDetails.glslangProgram = LinkProgramForReflection(glslangShaders);
|
||||
@@ -920,7 +919,7 @@ void WrappedOpenGL::glLinkProgram(GLuint program)
|
||||
{
|
||||
for(size_t sh = 0; sh < progDetails.shaders.size(); sh++)
|
||||
{
|
||||
if(m_Shaders[progDetails.shaders[sh]].type == ShaderEnum(s))
|
||||
if(GetShader(progDetails.shaders[sh]).type == ShaderEnum(s))
|
||||
progDetails.stageShaders[s] = progDetails.shaders[sh];
|
||||
}
|
||||
}
|
||||
@@ -934,14 +933,14 @@ void WrappedOpenGL::glLinkProgram(GLuint program)
|
||||
if(id == ResourceId())
|
||||
continue;
|
||||
|
||||
glslang::TShader *s = m_Shaders[id].glslangShader;
|
||||
glslang::TShader *s = GetShader(id).glslangShader;
|
||||
if(s == NULL)
|
||||
{
|
||||
RDCERR("Shader attached with no compiled glslang reflection shader!");
|
||||
continue;
|
||||
}
|
||||
|
||||
glslangShaders.push_back(m_Shaders[id].glslangShader);
|
||||
glslangShaders.push_back(s);
|
||||
}
|
||||
|
||||
progDetails.glslangProgram = LinkProgramForReflection(glslangShaders);
|
||||
@@ -1492,7 +1491,7 @@ bool WrappedOpenGL::Serialise_glUseProgramStages(SerialiserType &ser, GLuint pip
|
||||
ResourceId liveProgId = GetResourceManager()->GetResID(program);
|
||||
|
||||
PipelineData &pipeDetails = m_Pipelines[livePipeId];
|
||||
ProgramData &progDetails = m_Programs[liveProgId];
|
||||
const ProgramData &progDetails = GetProgram(liveProgId);
|
||||
|
||||
for(size_t s = 0; s < NumShaderStages; s++)
|
||||
{
|
||||
@@ -1500,7 +1499,7 @@ bool WrappedOpenGL::Serialise_glUseProgramStages(SerialiserType &ser, GLuint pip
|
||||
{
|
||||
for(size_t sh = 0; sh < progDetails.shaders.size(); sh++)
|
||||
{
|
||||
if(m_Shaders[progDetails.shaders[sh]].type == ShaderEnum(s))
|
||||
if(GetShader(progDetails.shaders[sh]).type == ShaderEnum(s))
|
||||
{
|
||||
pipeDetails.stagePrograms[s] = liveProgId;
|
||||
pipeDetails.stageShaders[s] = progDetails.shaders[sh];
|
||||
@@ -1591,7 +1590,7 @@ void WrappedOpenGL::glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuin
|
||||
ResourceId progID = GetResourceManager()->GetResID(ProgramRes(GetCtx(), program));
|
||||
|
||||
PipelineData &pipeDetails = m_Pipelines[pipeID];
|
||||
ProgramData &progDetails = m_Programs[progID];
|
||||
const ProgramData &progDetails = GetProgram(progID);
|
||||
|
||||
for(size_t s = 0; s < NumShaderStages; s++)
|
||||
{
|
||||
@@ -1599,7 +1598,7 @@ void WrappedOpenGL::glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuin
|
||||
{
|
||||
for(size_t sh = 0; sh < progDetails.shaders.size(); sh++)
|
||||
{
|
||||
if(m_Shaders[progDetails.shaders[sh]].type == ShaderEnum(s))
|
||||
if(GetShader(progDetails.shaders[sh]).type == ShaderEnum(s))
|
||||
{
|
||||
pipeDetails.stagePrograms[s] = progID;
|
||||
pipeDetails.stageShaders[s] = progDetails.shaders[sh];
|
||||
@@ -1878,7 +1877,7 @@ bool WrappedOpenGL::Serialise_glCompileShaderIncludeARB(SerialiserType &ser, GLu
|
||||
|
||||
ResourceId liveId = GetResourceManager()->GetResID(shader);
|
||||
|
||||
auto &shadDetails = m_Shaders[liveId];
|
||||
WrappedOpenGL::ShaderData &shadDetails = m_Shaders[liveId];
|
||||
|
||||
shadDetails.includepaths.clear();
|
||||
shadDetails.includepaths.reserve(count);
|
||||
@@ -1919,7 +1918,7 @@ void WrappedOpenGL::glCompileShaderIncludeARB(GLuint shader, GLsizei count,
|
||||
{
|
||||
ResourceId id = GetResourceManager()->GetResID(ShaderRes(GetCtx(), shader));
|
||||
|
||||
auto &shadDetails = m_Shaders[id];
|
||||
WrappedOpenGL::ShaderData &shadDetails = m_Shaders[id];
|
||||
|
||||
shadDetails.includepaths.clear();
|
||||
shadDetails.includepaths.reserve(count);
|
||||
|
||||
@@ -117,9 +117,10 @@ bool WrappedOpenGL::Serialise_glProgramUniformVector(SerialiserType &ser, GLuint
|
||||
ResourceId liveProgId = GetResourceManager()->GetResID(Program);
|
||||
GLuint live = Program.name;
|
||||
|
||||
std::map<GLint, GLint> &translate = m_Programs[liveProgId].locationTranslate;
|
||||
if(translate.find(location) != translate.end())
|
||||
location = translate[location];
|
||||
const std::map<GLint, GLint> &translate = GetProgram(liveProgId).locationTranslate;
|
||||
auto it = translate.find(location);
|
||||
if(it != translate.end())
|
||||
location = it->second;
|
||||
else
|
||||
location = -1;
|
||||
|
||||
@@ -238,9 +239,10 @@ bool WrappedOpenGL::Serialise_glProgramUniformMatrix(SerialiserType &ser, GLuint
|
||||
ResourceId liveProgId = GetResourceManager()->GetResID(Program);
|
||||
GLuint live = Program.name;
|
||||
|
||||
std::map<GLint, GLint> &translate = m_Programs[liveProgId].locationTranslate;
|
||||
if(translate.find(location) != translate.end())
|
||||
location = translate[location];
|
||||
const std::map<GLint, GLint> &translate = GetProgram(liveProgId).locationTranslate;
|
||||
auto it = translate.find(location);
|
||||
if(it != translate.end())
|
||||
location = it->second;
|
||||
else
|
||||
location = -1;
|
||||
|
||||
|
||||
@@ -680,7 +680,7 @@ CBufferVariableType DXBCContainer::ParseRDEFType(const RDEFHeader *h, const byte
|
||||
return ret;
|
||||
}
|
||||
|
||||
D3D_PRIMITIVE_TOPOLOGY DXBCContainer::GetOutputTopology()
|
||||
void DXBCContainer::CacheOutputTopology()
|
||||
{
|
||||
if(m_OutputTopology == D3D_PRIMITIVE_TOPOLOGY_UNDEFINED)
|
||||
{
|
||||
@@ -691,8 +691,6 @@ D3D_PRIMITIVE_TOPOLOGY DXBCContainer::GetOutputTopology()
|
||||
else if(m_DXILByteCode)
|
||||
m_OutputTopology = m_DXILByteCode->GetOutputTopology();
|
||||
}
|
||||
|
||||
return m_OutputTopology;
|
||||
}
|
||||
|
||||
D3D_PRIMITIVE_TOPOLOGY DXBCContainer::GetOutputTopology(const void *ByteCode, size_t ByteCodeLength)
|
||||
|
||||
@@ -206,7 +206,8 @@ public:
|
||||
const bytebuf &GetShaderBlob() const { return m_ShaderBlob; }
|
||||
const IDebugInfo *GetDebugInfo() const { return m_DebugInfo; }
|
||||
const Reflection *GetReflection() const { return m_Reflection; }
|
||||
D3D_PRIMITIVE_TOPOLOGY GetOutputTopology();
|
||||
void CacheOutputTopology();
|
||||
D3D_PRIMITIVE_TOPOLOGY GetOutputTopology() const { return m_OutputTopology; }
|
||||
ThreadScope GetThreadScope() const { return m_Threadscope; }
|
||||
|
||||
CBufferVariableType GetRayPayload(const ShaderEntryPoint &entry)
|
||||
|
||||
@@ -404,6 +404,7 @@ void MakeShaderReflection(DXBC::DXBCContainer *dxbc, const ShaderEntryPoint &ent
|
||||
refl->inputSignature = dxbcRefl->InputSig;
|
||||
refl->outputSignature = dxbcRefl->OutputSig;
|
||||
|
||||
dxbc->CacheOutputTopology();
|
||||
switch(dxbc->GetOutputTopology())
|
||||
{
|
||||
case D3D_PRIMITIVE_TOPOLOGY_POINTLIST: refl->outputTopology = Topology::PointList; break;
|
||||
|
||||
@@ -854,7 +854,7 @@ uint32_t GetDescriptorSizeOfBind(VulkanResourceManager *resourceMan,
|
||||
}
|
||||
|
||||
static void ProcessStaticDescriptorAccess(VulkanResourceManager *resourceMan,
|
||||
ShaderReflection *refl, ResourceId specStorage,
|
||||
const ShaderReflection *refl, ResourceId specStorage,
|
||||
rdcarray<DescriptorAccess> &descriptorAccess,
|
||||
rdcarray<const DescSetLayout *> setLayoutInfos)
|
||||
{
|
||||
|
||||
@@ -242,8 +242,8 @@ struct VulkanCreationInfo
|
||||
ResourceId module;
|
||||
ShaderStage stage = ShaderStage::Count;
|
||||
rdcstr entryPoint;
|
||||
ShaderReflection *refl = NULL;
|
||||
SPIRVPatchData *patchData = NULL;
|
||||
const ShaderReflection *refl = NULL;
|
||||
const SPIRVPatchData *patchData = NULL;
|
||||
|
||||
VkPipelineShaderStageCreateFlags flags;
|
||||
|
||||
|
||||
@@ -2050,10 +2050,10 @@ ResourceId VulkanReplay::RenderOverlay(ResourceId texid, FloatVector clearCol, D
|
||||
: pipeInfo.shaders[4];
|
||||
if(ps.module != ResourceId())
|
||||
{
|
||||
ShaderReflection *reflection = ps.refl;
|
||||
const ShaderReflection *reflection = ps.refl;
|
||||
if(reflection)
|
||||
{
|
||||
for(SigParameter &output : reflection->outputSignature)
|
||||
for(const SigParameter &output : reflection->outputSignature)
|
||||
{
|
||||
if(output.systemValue == ShaderBuiltin::DepthOutput)
|
||||
useDepthWriteStencilPass = true;
|
||||
|
||||
@@ -2877,7 +2877,7 @@ void VulkanReplay::FetchMeshOut(uint32_t eventId, VulkanRenderState &state)
|
||||
: pipeInfo.shaders[(size_t)ShaderStage::Mesh];
|
||||
|
||||
const VulkanCreationInfo::ShaderModule &meshInfo = creationInfo.m_ShaderModule[meshShad.module];
|
||||
ShaderReflection *meshrefl = meshShad.refl;
|
||||
const ShaderReflection *meshrefl = meshShad.refl;
|
||||
|
||||
VulkanPostVSData &ret = m_PostVS.Data[eventId];
|
||||
|
||||
@@ -4253,7 +4253,7 @@ void VulkanReplay::FetchVSOut(uint32_t eventId, VulkanRenderState &state)
|
||||
|
||||
const VulkanCreationInfo::ShaderModule &moduleInfo = creationInfo.m_ShaderModule[vertShad.module];
|
||||
|
||||
ShaderReflection *refl = vertShad.refl;
|
||||
const ShaderReflection *refl = vertShad.refl;
|
||||
|
||||
VulkanPostVSData &ret = m_PostVS.Data[eventId];
|
||||
|
||||
@@ -5650,7 +5650,7 @@ void VulkanReplay::FetchTessGSOut(uint32_t eventId, VulkanRenderState &state)
|
||||
state.graphics.shaderObject ? creationInfo.m_ShaderObject[state.shaderObjects[stageIndex]].shad
|
||||
: pipeInfo.shaders[stageIndex];
|
||||
|
||||
ShaderReflection *lastRefl = shader.refl;
|
||||
const ShaderReflection *lastRefl = shader.refl;
|
||||
|
||||
RDCASSERT(lastRefl);
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ RDResult VulkanReplay::FatalErrorCheck()
|
||||
IReplayDriver *VulkanReplay::MakeDummyDriver()
|
||||
{
|
||||
// gather up the shaders we've allocated to pass to the dummy driver
|
||||
rdcarray<ShaderReflection *> shaders;
|
||||
rdcarray<const ShaderReflection *> shaders;
|
||||
for(auto it = m_pDriver->m_CreationInfo.m_ShaderModule.begin();
|
||||
it != m_pDriver->m_CreationInfo.m_ShaderModule.end(); it++)
|
||||
{
|
||||
@@ -440,8 +440,8 @@ rdcarray<ShaderEntryPoint> VulkanReplay::GetShaderEntryPoints(ResourceId shader)
|
||||
return shad->second.spirv.EntryPoints();
|
||||
}
|
||||
|
||||
ShaderReflection *VulkanReplay::GetShader(ResourceId pipeline, ResourceId shader,
|
||||
ShaderEntryPoint entry)
|
||||
const ShaderReflection *VulkanReplay::GetShader(ResourceId pipeline, ResourceId shader,
|
||||
ShaderEntryPoint entry)
|
||||
{
|
||||
auto shad = m_pDriver->m_CreationInfo.m_ShaderModule.find(shader);
|
||||
|
||||
|
||||
@@ -337,7 +337,7 @@ public:
|
||||
TextureDescription GetTexture(ResourceId id);
|
||||
|
||||
rdcarray<ShaderEntryPoint> GetShaderEntryPoints(ResourceId shader);
|
||||
ShaderReflection *GetShader(ResourceId pipeline, ResourceId shader, ShaderEntryPoint entry);
|
||||
const ShaderReflection *GetShader(ResourceId pipeline, ResourceId shader, ShaderEntryPoint entry);
|
||||
|
||||
rdcarray<rdcstr> GetDisassemblyTargets(bool withPipeline);
|
||||
rdcstr DisassembleShader(ResourceId pipeline, const ShaderReflection *refl, const rdcstr &target);
|
||||
|
||||
@@ -1558,7 +1558,7 @@ bool VulkanReplay::FetchShaderFeedback(uint32_t eventId)
|
||||
feedbackData.feedbackStorageSize += 16 + Vulkan_Debug_PrintfBufferSize() + 1024;
|
||||
}
|
||||
|
||||
ShaderReflection *stageRefls[NumShaderStages] = {};
|
||||
const ShaderReflection *stageRefls[NumShaderStages] = {};
|
||||
|
||||
{
|
||||
const rdcarray<VulkanRenderState::DescriptorBuffer> &descBufs = state.descBufs;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#include "dummy_driver.h"
|
||||
|
||||
DummyDriver::DummyDriver(IReplayDriver *original, const rdcarray<ShaderReflection *> &shaders,
|
||||
DummyDriver::DummyDriver(IReplayDriver *original, const rdcarray<const ShaderReflection *> &shaders,
|
||||
SDFile *sdfile)
|
||||
{
|
||||
m_Shaders = shaders;
|
||||
@@ -49,7 +49,7 @@ DummyDriver::DummyDriver(IReplayDriver *original, const rdcarray<ShaderReflectio
|
||||
DummyDriver::~DummyDriver()
|
||||
{
|
||||
// we own the shaders
|
||||
for(ShaderReflection *refl : m_Shaders)
|
||||
for(const ShaderReflection *refl : m_Shaders)
|
||||
delete refl;
|
||||
|
||||
// and we own the structured file
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
class DummyDriver : public IReplayDriver
|
||||
{
|
||||
public:
|
||||
DummyDriver(IReplayDriver *original, const rdcarray<ShaderReflection *> &shaders, SDFile *sdfile);
|
||||
DummyDriver(IReplayDriver *original, const rdcarray<const ShaderReflection *> &shaders,
|
||||
SDFile *sdfile);
|
||||
|
||||
void Shutdown();
|
||||
|
||||
@@ -192,7 +193,7 @@ public:
|
||||
private:
|
||||
virtual ~DummyDriver();
|
||||
|
||||
rdcarray<ShaderReflection *> m_Shaders;
|
||||
rdcarray<const ShaderReflection *> m_Shaders;
|
||||
SDFile *m_SDFile;
|
||||
|
||||
APIProperties m_Props;
|
||||
|
||||
@@ -151,8 +151,8 @@ public:
|
||||
virtual rdcarray<DebugMessage> GetDebugMessages() = 0;
|
||||
|
||||
virtual rdcarray<ShaderEntryPoint> GetShaderEntryPoints(ResourceId shader) = 0;
|
||||
virtual ShaderReflection *GetShader(ResourceId pipeline, ResourceId shader,
|
||||
ShaderEntryPoint entry) = 0;
|
||||
virtual const ShaderReflection *GetShader(ResourceId pipeline, ResourceId shader,
|
||||
ShaderEntryPoint entry) = 0;
|
||||
|
||||
virtual rdcarray<rdcstr> GetDisassemblyTargets(bool withPipeline) = 0;
|
||||
virtual rdcstr DisassembleShader(ResourceId pipeline, const ShaderReflection *refl,
|
||||
|
||||
Reference in New Issue
Block a user