Example #1
0
//------------------------------------------------------------------------------
void GFXPCD3D9Device::leaveDebugEvent()
{
   D3DPERF_EndEvent();
}
Example #2
0
 void endEvent()
 {
     D3DPERF_EndEvent();
 }
skyVoid skyPerfEventEnd ( )
{
	#if defined(SKY_BUILD_DEBUG)
	D3DPERF_EndEvent();
	#endif
}
void DebugAnnotator9::endEvent()
{
    D3DPERF_EndEvent();
}
Example #5
0
void DrawRecorder::RenderRecordedDrawCallDepth(
	IDirect3DDevice9* device,
	D3DXMATRIX* view,
	D3DXMATRIX* proj,
	DepthManager* manager
) {

	if ( !manager->IsInitialized() ) {
		return;
	}

	if ( !m_recordedDrawCalls.IsEmpty() ) {

		D3DPERF_BeginEvent(D3DCOLOR_ARGB(255,255,0,0),
			L"Replaying recorded Morrowind Draw Calls");

		// We currently just have a single shader that handles all types of
		// objects that Morrowind renders.  Not great, but it works.
		manager->BeginGenericDepthRendering();	

		// Set new transforms and state	
		manager->SetViewMatrix( view );
		manager->SetProjectionMatrix( proj );

		for (
			PooledList<RecordedDrawCall>::Item* item = 
				m_recordedDrawCalls.GetFirstItem();
			item != m_recordedDrawCalls.GetEndMarker();
			item = item->next
		) {
			DrawRecorder::RecordedDrawCall& ro = *item->data;

			manager->SetAlphaTestTexture( ro.texture );

			device->SetFVF( ro.fvf );

			manager->SetBlendWeightCount( ro.vertexBlendState );

			manager->SetAlphaTest(
				ro.alphaTestEnabled ||
				(ro.alphaBlendFunc == D3DBLEND_SRCALPHA && ro.alphaBlendEnabled)
			);

			manager->SetWorldMatrixArray( ro.worldTrans, 4 );

			manager->SetWorldMatrix( ro.worldTrans );

			manager->CommitChanges();

			device->SetRenderState( D3DRS_CULLMODE, ro.cullModeState );

			if (
				ro.renderType == DrawRecorder::DRAW_INDEXED ||
				ro.renderType == DrawRecorder::DRAW_PRIM
			) {
				device->SetStreamSource( 0, ro.vBuffer, 0, ro.streamSpan );
				if ( ro.renderType == DrawRecorder::DRAW_INDEXED ) {
					device->SetIndices( ro.indices );
					device->DrawIndexedPrimitive(
						ro.primType,
						ro.baseVertexIndex,
						ro.minIndex,
						ro.numVertices,
						ro.startIndex,
						ro.primitiveCount
					);
				} else {
					device->DrawPrimitive(
						ro.primType,
						ro.startIndex,
						ro.primitiveCount
					);
				}
			} else if ( ro.renderType == DrawRecorder::DRAW_INDEXED_UP ) {
				device->DrawIndexedPrimitiveUP(
					ro.primType,
					ro.minIndex,
					ro.numVertices,
					ro.primitiveCount,
					ro.indexData,
					ro.indexDataFormat,
					ro.vertexStreamZeroData,
					ro.vertexStreamZeroSride
				);
			} else if ( ro.renderType == DrawRecorder::DRAW_PRIM_UP ) {
				device->DrawPrimitiveUP(
					ro.primType,
					ro.primitiveCount,
					ro.vertexStreamZeroData,
					ro.vertexStreamZeroSride
				);
			}
		}

		manager->EndDepthRendering();

		D3DPERF_EndEvent(); // Recorded morrowind draw calls
	}
}
Example #6
0
void HudElements::Render()
{
#ifdef _DEBUG
	D3DPERF_EndEvent( );
	D3DPERF_BeginEvent( D3DCOLOR_XRGB(255, 0, 0 ), L"DRAWING HUD BOXES");
#endif

	HRESULT hr;
	hr = g_RenderDevices.GetDevice()->SetRenderState(D3DRS_ZENABLE, false);

	// big ol hack...
	if( m_hudEntities.size() > 0 )
	{
		//g_RenderManager.SetSceneOrthoConstants();

		for( int i = 0; i < m_hudEntities.size(); i++ )
		{
			g_RenderManager.SetUniformData( m_hudEntities[i], m_hudEntities[i]->m_material->rm_Reference.m_effect, m_hudEntities[i]->m_material, false, false, 1 );
			m_hudEntities[i]->Draw();
		}

		//g_RenderManager.SetSceneConstants();
	}

	if( m_currentVertices > 0 )
	{
		//return ;

		if (m_dirty )	// Copy local vertex data into VB if it is new.
		{
			gHUDQuad  *pVerts = NULL;
			m_pVBuff->Lock(0, 0, (void**)&pVerts, 0);
			memcpy(pVerts, m_boxVertices, m_currentVertices * sizeof(gHUDQuad));

			m_pVBuff->Unlock();

			m_dirty = false;    //vert data isn't new anymore
		}


		hr = g_RenderDevices.GetDevice()->SetVertexShader( m_vertexShader->rm_Reference.m_vertexShader );
		//assert( SUCCEEDED( result ) );
		hr = g_RenderDevices.GetDevice()->SetPixelShader( m_pixelShader->rm_Reference.m_pixelShader );
		//assert( SUCCEEDED( result )

		// Draw the lines.
		//hr = g_RenderDevices.GetDevice()->SetIndices(m_pIBuff);
		hr = g_RenderDevices.GetDevice()->SetIndices( m_pIBuff );
		hr = g_RenderDevices.GetDevice()->SetStreamSource(0, m_pVBuff, 0, sizeof(gHUDQuad));
		hr = g_RenderDevices.GetDevice()->SetVertexDeclaration( m_vertexDeclaration );
		//g_RenderDevices.GetDevice()->SetStreamSource( 0, 0, 0, 0 );
		//g_RenderDevices.GetDevice()->SetVertexDeclaration( 0 );

		//Render
		hr = g_RenderDevices.GetDevice()->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, 0, m_currentVertices, 0, m_currentVertices / 2 );
	}



#ifdef _DEBUG
	D3DPERF_EndEvent( );
	D3DPERF_BeginEvent( D3DCOLOR_XRGB(255, 0, 0 ), L"DRAWING HUD TEXT");
#endif

	HRESULT result = m_sprite->Begin( D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE );
	assert( result == D3D_OK );

	// Render the text
	for( unsigned i = 0; i < m_text.size(); i++)
	{
		HRESULT result = m_font->DrawTextA( m_sprite, m_text[i].m_text, -1, &m_text[i].m_rectDimensions, DT_LEFT | DT_NOCLIP | DT_VCENTER | DT_SINGLELINE, m_text[i].m_color );
		assert( result != 0 );
	}



	result = m_sprite->End();
	assert( result == D3D_OK );
}