Exemplo n.º 1
0
    DiEGLContext::DiEGLContext(EGLDisplay eglDisplay, DiEGLUtil* util, ::EGLConfig glconfig, ::EGLSurface drawable)
        :mGLUtil(util),
        mContext(nullptr)
    {
        DI_ASSERT(drawable);

        DiEGLContext* mainContext = static_cast<DiEGLContext*>(static_cast<DiGLES2Driver*>(Driver)->GetMainContext());
        ::EGLContext shareContext = (::EGLContext) 0;

        if (mainContext)
            shareContext = mainContext->mContext;

        CreateInternalResources(eglDisplay, glconfig, drawable, shareContext);
    }
Exemplo n.º 2
0
HRESULT WrappedID3D12Device::CreateCommandQueue(const D3D12_COMMAND_QUEUE_DESC *pDesc, REFIID riid,
                                                void **ppCommandQueue)
{
  if(ppCommandQueue == NULL)
    return m_pDevice->CreateCommandQueue(pDesc, riid, NULL);

  if(riid != __uuidof(ID3D12CommandQueue))
    return E_NOINTERFACE;

  ID3D12CommandQueue *real = NULL;
  HRESULT ret = m_pDevice->CreateCommandQueue(pDesc, riid, (void **)&real);

  if(SUCCEEDED(ret))
  {
    SCOPED_LOCK(m_D3DLock);

    WrappedID3D12CommandQueue *wrapped =
        new WrappedID3D12CommandQueue(real, this, m_pSerialiser, m_State);

    if(m_State >= WRITING)
    {
      SCOPED_SERIALISE_CONTEXT(CREATE_COMMAND_QUEUE);
      Serialise_CreateCommandQueue(pDesc, riid, (void **)&wrapped);

      m_DeviceRecord->AddChunk(scope.Get());
    }
    else
    {
      GetResourceManager()->AddLiveResource(wrapped->GetResourceID(), wrapped);
    }

    if(pDesc->Type == D3D12_COMMAND_LIST_TYPE_DIRECT)
    {
      if(m_Queue != NULL)
        RDCERR("Don't support multiple queues yet!");

      m_Queue = wrapped;

      CreateInternalResources();
    }

    *ppCommandQueue = (ID3D12CommandQueue *)wrapped;
  }

  return ret;
}
Exemplo n.º 3
0
void Magnify::SetSourceResource( ID3D10Resource* pSourceResource, DXGI_FORMAT Format, 
		int nWidth, int nHeight, int nSamples )
{
	assert( NULL != pSourceResource );
	assert( Format > DXGI_FORMAT_UNKNOWN );
	assert( nWidth > 0 );
	assert( nHeight > 0 );
	assert( nSamples > 0 );

	m_pSourceResource = pSourceResource;
	m_SourceResourceFormat = Format;
	m_nSourceResourceWidth = nWidth;
	m_nSourceResourceHeight = nHeight;
	m_nSourceResourceSamples = nSamples;

	m_bDepthFormat = false;

	switch( m_SourceResourceFormat )
	{
		case DXGI_FORMAT_D32_FLOAT:
			m_DepthFormat = DXGI_FORMAT_R32_TYPELESS;
			m_DepthSRVFormat = DXGI_FORMAT_R32_FLOAT;
			m_bDepthFormat = true;
			break;

		case DXGI_FORMAT_D24_UNORM_S8_UINT:
			m_DepthFormat = DXGI_FORMAT_R24G8_TYPELESS;
			m_DepthSRVFormat = DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
			m_bDepthFormat = true;
			break;

		case DXGI_FORMAT_D16_UNORM:
			m_DepthFormat = DXGI_FORMAT_R16_TYPELESS;
			m_DepthSRVFormat = DXGI_FORMAT_R16_UNORM;
			m_bDepthFormat = true;
			break;
	}

	CreateInternalResources();	
}
Exemplo n.º 4
0
bool WrappedID3D12Device::Serialise_CreateCommandQueue(const D3D12_COMMAND_QUEUE_DESC *pDesc,
                                                       REFIID riid, void **ppCommandQueue)
{
  SERIALISE_ELEMENT_PTR(D3D12_COMMAND_QUEUE_DESC, Descriptor, pDesc);
  SERIALISE_ELEMENT(IID, guid, riid);
  SERIALISE_ELEMENT(ResourceId, Queue,
                    ((WrappedID3D12CommandQueue *)*ppCommandQueue)->GetResourceID());

  if(m_State == READING)
  {
    ID3D12CommandQueue *ret = NULL;
    HRESULT hr = m_pDevice->CreateCommandQueue(&Descriptor, guid, (void **)&ret);

    if(FAILED(hr))
    {
      RDCERR("Failed on resource serialise-creation, HRESULT: 0x%08x", hr);
    }
    else
    {
      ret = new WrappedID3D12CommandQueue(ret, this, m_pSerialiser, m_State);

      GetResourceManager()->AddLiveResource(Queue, ret);

      if(Descriptor.Type == D3D12_COMMAND_LIST_TYPE_DIRECT)
      {
        if(m_Queue != NULL)
          RDCERR("Don't support multiple direct queues yet!");

        m_Queue = (WrappedID3D12CommandQueue *)ret;

        CreateInternalResources();
      }
    }
  }

  return true;
}