Refactor public interface to be less strict C and more python friendly

* Generally this means removing ref out parameters and instead returning
  values. In a couple of cases we will want to avoid copies in future
  either by returning const references (e.g. to the pipeline state which
  is immutable).
* At the same time, some pointless bool return values that were always
  true and didn't indicate errors have been removed. They can be added
  again if an error condition comes back.
* Some free functions still have out parameters as C linkage doesn't
  allow returning user types by value.
* The C# UI still invokes into C wrappers for all the C++ classes, which
  handle taking the return value and doing a copy into an out parameter
  still for compatibility.
This commit is contained in:
baldurk
2017-04-18 14:57:46 +01:00
parent a1f2fdacbc
commit f6c045f473
27 changed files with 805 additions and 1001 deletions
@@ -111,8 +111,7 @@ void ConstantBufferPreviewer::OnEventChanged(uint32_t eventID)
if(!m_formatOverride.empty())
{
m_Ctx.Renderer().AsyncInvoke([this, offs, size](IReplayRenderer *r) {
rdctype::array<byte> data;
r->GetBufferData(m_cbuffer, offs, size, &data);
rdctype::array<byte> data = r->GetBufferData(m_cbuffer, offs, size);
rdctype::array<ShaderVariable> vars = applyFormatOverride(data);
GUIInvoke::call([this, vars] { setVariables(vars); });
});
@@ -120,9 +119,8 @@ void ConstantBufferPreviewer::OnEventChanged(uint32_t eventID)
else
{
m_Ctx.Renderer().AsyncInvoke([this, entryPoint, offs](IReplayRenderer *r) {
rdctype::array<ShaderVariable> vars;
r->GetCBufferVariableContents(m_shader, entryPoint.toUtf8().data(), m_slot, m_cbuffer, offs,
&vars);
rdctype::array<ShaderVariable> vars = r->GetCBufferVariableContents(
m_shader, entryPoint.toUtf8().data(), m_slot, m_cbuffer, offs);
GUIInvoke::call([this, vars] { setVariables(vars); });
});
}