예제 #1
0
		public void EndToEndTest()
		{	
			// Arrange.
		    var device = new Device();
            var logger = new TracefileBuilder(device);
            var expectedData = RenderScene(device);

            var stringWriter = new StringWriter();
			logger.WriteTo(stringWriter);

			var loggedJson = stringWriter.ToString();
			var logReader = new StringReader(loggedJson);
			var tracefile = Tracefile.FromTextReader(logReader);

			// Act.
			var swapChainPresenter = new RawSwapChainPresenter();
			var replayer = new Replayer(
                tracefile.Frames[0], tracefile.Frames[0].Events.Last(),
                swapChainPresenter);
			replayer.Replay();
            var actualData = swapChainPresenter.Data;

			// Assert.
			Assert.That(actualData, Is.EqualTo(expectedData));
		}
예제 #2
0
		public Replayer(TracefileFrame frame, TracefileEvent lastEvent, 
			ISwapChainPresenter swapChainPresenter, 
            int? renderTargetViewID = null, int? renderTargetArrayIndex = null,
            int? pixelX = null, int? pixelY = null)
		{
			_frame = frame;
			_lastEvent = lastEvent;
		    _swapChainPresenter = swapChainPresenter;
		    _device = new Device();
		    _deviceContext = _device.ImmediateContext;
            _logger = new TracefileBuilder(_device, 
                renderTargetViewID, renderTargetArrayIndex, 
                pixelX, pixelY);
		}
예제 #3
0
 public Replayer(TracefileFrame frame, TracefileEvent lastEvent,
                 ISwapChainPresenter swapChainPresenter,
                 int?renderTargetViewID = null, int?renderTargetArrayIndex = null,
                 int?pixelX             = null, int?pixelY = null)
 {
     _frame              = frame;
     _lastEvent          = lastEvent;
     _swapChainPresenter = swapChainPresenter;
     _device             = new Device();
     _deviceContext      = _device.ImmediateContext;
     _logger             = new TracefileBuilder(_device,
                                                renderTargetViewID, renderTargetArrayIndex,
                                                pixelX, pixelY);
 }
예제 #4
0
        public void AnalyzeLastFrame()
	    {
	        // Create new instance of sample object.
	        var newSample = (SampleBase) Activator.CreateInstance(_sample.GetType());
            IoC.BuildUp(newSample);

            // Create logger.
            var device = new Device();
            var logger = new TracefileBuilder(device);

            // Initialize and draw.
            newSample.Initialize(device);
            newSample.Draw(_totalTime);

            var tracefileDocument = new TracefileViewerViewModel(
                IoC.Get<ISelectionService>(), 
                "[Sample " + _sample.Name + "]",
                logger.Tracefile);
            IoC.Get<IShell>().OpenDocument(tracefileDocument);
	    }