Ejemplo n.º 1
0
void ReplayOutput::SetFrameEvent(int eventID)
{
  m_EventID = eventID;

  m_OverlayDirty = true;
  m_MainOutput.dirty = true;

  for(size_t i = 0; i < m_Thumbnails.size(); i++)
    m_Thumbnails[i].dirty = true;

  RefreshOverlay();
}
Ejemplo n.º 2
0
void ReplayOutput::DisplayMesh()
{
  FetchDrawcall *draw = m_pRenderer->GetDrawcallByEID(m_EventID, m_LastDeferredEvent);

  if(draw == NULL || m_MainOutput.outputID == 0 || m_Width <= 0 || m_Height <= 0 ||
     (m_RenderData.meshDisplay.type == eMeshDataStage_Unknown) || (draw->flags & eDraw_Drawcall) == 0)
  {
    float color[4] = {0.0f, 0.0f, 0.0f, 0.0f};
    m_pDevice->BindOutputWindow(m_MainOutput.outputID, false);
    m_pDevice->ClearOutputWindowColour(m_MainOutput.outputID, color);
    m_pDevice->ClearOutputWindowDepth(m_MainOutput.outputID, 1.0f, 0);
    m_pDevice->RenderCheckerboard(Vec3f(0.666f, 0.666f, 0.666f), Vec3f(0.333f, 0.333f, 0.333f));

    return;
  }

  if(draw && m_OverlayDirty)
  {
    m_pDevice->ReplayLog(m_EventID, eReplay_WithoutDraw);
    RefreshOverlay();
    m_pDevice->ReplayLog(m_EventID, eReplay_OnlyDraw);
  }

  m_pDevice->BindOutputWindow(m_MainOutput.outputID, true);
  m_pDevice->ClearOutputWindowDepth(m_MainOutput.outputID, 1.0f, 0);

  m_pDevice->RenderCheckerboard(Vec3f(0.666f, 0.666f, 0.666f), Vec3f(0.333f, 0.333f, 0.333f));

  m_pDevice->ClearOutputWindowDepth(m_MainOutput.outputID, 1.0f, 0);

  MeshDisplay mesh = m_RenderData.meshDisplay;
  mesh.position.buf = m_pDevice->GetLiveID(mesh.position.buf);
  mesh.position.idxbuf = m_pDevice->GetLiveID(mesh.position.idxbuf);
  mesh.second.buf = m_pDevice->GetLiveID(mesh.second.buf);
  mesh.second.idxbuf = m_pDevice->GetLiveID(mesh.second.idxbuf);

  vector<MeshFormat> secondaryDraws;

  // we choose a pallette here so that the colours stay consistent (i.e the
  // current draw is always the same colour), but also to indicate somewhat
  // the relationship - ie. instances are closer in colour than other draws
  // in the pass

  // very slightly dark red
  const FloatVector drawItself(0.06f, 0.0f, 0.0f, 1.0f);

  // more desaturated/lighter, but still reddish
  const FloatVector otherInstances(0.18f, 0.1f, 0.1f, 1.0f);

  // lighter grey with blue tinge to contrast from main/instance draws
  const FloatVector passDraws(0.2f, 0.2f, 0.25f, 1.0f);

  if(m_RenderData.meshDisplay.type != eMeshDataStage_VSIn)
  {
    for(size_t i = 0; m_RenderData.meshDisplay.showWholePass && i < passEvents.size(); i++)
    {
      FetchDrawcall *d = m_pRenderer->GetDrawcallByEID(passEvents[i], m_LastDeferredEvent);

      if(d)
      {
        for(uint32_t inst = 0; inst < RDCMAX(1U, draw->numInstances); inst++)
        {
          // get the 'most final' stage
          MeshFormat fmt = m_pDevice->GetPostVSBuffers(passEvents[i], inst, eMeshDataStage_GSOut);
          if(fmt.buf == ResourceId())
            fmt = m_pDevice->GetPostVSBuffers(passEvents[i], inst, eMeshDataStage_VSOut);

          fmt.meshColour = passDraws;

          // if unproject is marked, this output had a 'real' system position output
          if(fmt.unproject)
            secondaryDraws.push_back(fmt);
        }
      }
    }

    // draw previous instances in the current drawcall
    if(draw->flags & eDraw_Instanced)
    {
      uint32_t maxInst = 0;
      if(m_RenderData.meshDisplay.showPrevInstances)
        maxInst = RDCMAX(1U, m_RenderData.meshDisplay.curInstance);
      if(m_RenderData.meshDisplay.showAllInstances)
        maxInst = RDCMAX(1U, draw->numInstances);

      for(uint32_t inst = 0; inst < maxInst; inst++)
      {
        // get the 'most final' stage
        MeshFormat fmt = m_pDevice->GetPostVSBuffers(draw->eventID, inst, eMeshDataStage_GSOut);
        if(fmt.buf == ResourceId())
          fmt = m_pDevice->GetPostVSBuffers(draw->eventID, inst, eMeshDataStage_VSOut);

        fmt.meshColour = otherInstances;

        // if unproject is marked, this output had a 'real' system position output
        if(fmt.unproject)
          secondaryDraws.push_back(fmt);
      }
    }
  }

  mesh.position.meshColour = drawItself;

  m_pDevice->RenderMesh(m_EventID, secondaryDraws, mesh);
}
Ejemplo n.º 3
0
void ReplayOutput::DisplayTex()
{
  FetchDrawcall *draw = m_pRenderer->GetDrawcallByEID(m_EventID, m_LastDeferredEvent);

  if(m_MainOutput.outputID == 0)
    return;
  if(m_RenderData.texDisplay.texid == ResourceId())
  {
    float color[4] = {0.0f, 0.0f, 0.0f, 0.0f};
    m_pDevice->BindOutputWindow(m_MainOutput.outputID, false);
    m_pDevice->ClearOutputWindowColour(m_MainOutput.outputID, color);
    return;
  }
  if(m_Width <= 0 || m_Height <= 0)
    return;

  TextureDisplay texDisplay = m_RenderData.texDisplay;
  texDisplay.rawoutput = false;
  texDisplay.texid = m_pDevice->GetLiveID(texDisplay.texid);

  if(m_RenderData.texDisplay.overlay != eTexOverlay_None && draw)
  {
    if(m_OverlayDirty)
    {
      m_pDevice->ReplayLog(m_EventID, eReplay_WithoutDraw);
      RefreshOverlay();
      m_pDevice->ReplayLog(m_EventID, eReplay_OnlyDraw);
    }
  }
  else if(m_ForceOverlayRefresh)
  {
    m_ForceOverlayRefresh = false;
    m_pDevice->ReplayLog(m_EventID, eReplay_Full);
  }

  if(m_RenderData.texDisplay.CustomShader != ResourceId())
  {
    m_CustomShaderResourceId = m_pDevice->ApplyCustomShader(m_RenderData.texDisplay.CustomShader,
                                                            texDisplay.texid, texDisplay.mip);

    texDisplay.texid = m_pDevice->GetLiveID(m_CustomShaderResourceId);
    texDisplay.CustomShader = ResourceId();
    texDisplay.sliceFace = 0;
    texDisplay.mip = 0;
    texDisplay.linearDisplayAsGamma = false;
  }

  float color[4] = {0.0f, 0.0f, 0.0f, 0.0f};

  m_pDevice->BindOutputWindow(m_MainOutput.outputID, false);
  m_pDevice->ClearOutputWindowColour(m_MainOutput.outputID, color);

  m_pDevice->RenderCheckerboard(
      Vec3f(texDisplay.lightBackgroundColour.x, texDisplay.lightBackgroundColour.y,
            texDisplay.lightBackgroundColour.z),
      Vec3f(texDisplay.darkBackgroundColour.x, texDisplay.darkBackgroundColour.y,
            texDisplay.darkBackgroundColour.z));

  m_pDevice->RenderTexture(texDisplay);

  if(m_RenderData.texDisplay.overlay != eTexOverlay_None && draw &&
     m_pDevice->IsRenderOutput(m_RenderData.texDisplay.texid) &&
     m_RenderData.texDisplay.overlay != eTexOverlay_NaN &&
     m_RenderData.texDisplay.overlay != eTexOverlay_Clipping)
  {
    RDCASSERT(m_OverlayResourceId != ResourceId());
    texDisplay.texid = m_pDevice->GetLiveID(m_OverlayResourceId);
    texDisplay.Red = texDisplay.Green = texDisplay.Blue = texDisplay.Alpha = true;
    texDisplay.rawoutput = false;
    texDisplay.CustomShader = ResourceId();
    texDisplay.scale = m_RenderData.texDisplay.scale;
    texDisplay.HDRMul = -1.0f;
    texDisplay.FlipY = m_RenderData.texDisplay.FlipY;
    texDisplay.rangemin = 0.0f;
    texDisplay.rangemax = 1.0f;

    m_pDevice->RenderTexture(texDisplay);
  }
}
Ejemplo n.º 4
0
void ReplayOutput::DisplayMesh()
{
	FetchDrawcall *draw = m_pRenderer->GetDrawcallByEID(m_EventID, m_LastDeferredEvent);

	if(!draw) return;
	if(m_MainOutput.outputID == 0) return;
	if(m_Width <= 0 || m_Height <= 0) return;
	if(m_RenderData.meshDisplay.type == eMeshDataStage_Unknown) return;
	if((draw->flags & eDraw_Drawcall) == 0) return;

	if(draw && m_OverlayDirty)
	{
		m_pDevice->ReplayLog(m_FrameID, 0, m_EventID, eReplay_WithoutDraw);
		RefreshOverlay();
		m_pDevice->ReplayLog(m_FrameID, 0, m_EventID, eReplay_OnlyDraw);
	}
	
	m_pDevice->BindOutputWindow(m_MainOutput.outputID, true);
	m_pDevice->ClearOutputWindowDepth(m_MainOutput.outputID, 1.0f, 0);

	m_pDevice->RenderCheckerboard(Vec3f(0.666f, 0.666f, 0.666f), Vec3f(0.333f, 0.333f, 0.333f));
	
	m_pDevice->ClearOutputWindowDepth(m_MainOutput.outputID, 1.0f, 0);

	MeshDisplay mesh = m_RenderData.meshDisplay;
	mesh.position.buf = m_pDevice->GetLiveID(mesh.position.buf);
	mesh.position.idxbuf = m_pDevice->GetLiveID(mesh.position.idxbuf);
	mesh.second.buf = m_pDevice->GetLiveID(mesh.second.buf);
	mesh.second.idxbuf = m_pDevice->GetLiveID(mesh.second.idxbuf);
	
	vector<MeshFormat> secondaryDraws;
	
	if(m_RenderData.meshDisplay.type != eMeshDataStage_VSIn &&
		 !m_RenderData.meshDisplay.thisDrawOnly)
	{
		mesh.position.unproject = true;
		mesh.second.unproject = true;

		for(size_t i=0; i < passEvents.size(); i++)
		{
			FetchDrawcall *d = m_pRenderer->GetDrawcallByEID(passEvents[i], m_LastDeferredEvent);

			if(d)
			{
				for(uint32_t inst=0; inst < RDCMAX(1U, draw->numInstances); inst++)
				{
					// get the 'most final' stage
					MeshFormat fmt = m_pDevice->GetPostVSBuffers(m_FrameID, passEvents[i], inst, eMeshDataStage_GSOut);
					if(fmt.buf == ResourceId()) fmt = m_pDevice->GetPostVSBuffers(m_FrameID, passEvents[i], inst, eMeshDataStage_VSOut);

					// if unproject is marked, this output had a 'real' system position output
					if(fmt.unproject)
						secondaryDraws.push_back(fmt);
				}
			}
		}

		// draw previous instances in the current drawcall
		if(draw->flags & eDraw_Instanced)
		{
			for(uint32_t inst=0; inst < RDCMAX(1U, draw->numInstances) && inst < m_RenderData.meshDisplay.curInstance; inst++)
			{
				// get the 'most final' stage
				MeshFormat fmt = m_pDevice->GetPostVSBuffers(m_FrameID, draw->eventID, inst, eMeshDataStage_GSOut);
				if(fmt.buf == ResourceId()) fmt = m_pDevice->GetPostVSBuffers(m_FrameID, draw->eventID, inst, eMeshDataStage_VSOut);

				// if unproject is marked, this output had a 'real' system position output
				if(fmt.unproject)
					secondaryDraws.push_back(fmt);
			}
		}
	}

	m_pDevice->RenderMesh(m_FrameID, m_EventID, secondaryDraws, mesh);
}