├── lib ├── MSBuild.Fxc.dll ├── SlimShader.dll ├── SlimShader.pdb ├── D3DCompiler_43.dll ├── AssimpNet │ ├── Assimp32.dll │ ├── Assimp64.dll │ ├── AssimpNet.dll │ └── AssimpNet.pdb ├── SlimShader.Compiler.dll ├── SlimShader.Compiler.pdb ├── SlimShader.VirtualMachine.dll ├── SlimShader.VirtualMachine.pdb ├── SlimShader.VirtualMachine.Jitter.dll └── SlimShader.VirtualMachine.Jitter.pdb ├── src ├── .nuget │ ├── NuGet.exe │ └── NuGet.Config ├── Rasterizr │ ├── FodyWeavers.xml │ ├── Diagnostics │ │ ├── PixelEvent.cs │ │ ├── PixelExclusionReason.cs │ │ ├── SimpleEvent.cs │ │ └── DrawEvent.cs │ ├── Pipeline │ │ ├── Rasterizer │ │ │ ├── FillMode.cs │ │ │ ├── CullMode.cs │ │ │ ├── FragmentQuadLocation.cs │ │ │ ├── Sample.cs │ │ │ ├── Primitives │ │ │ │ ├── BarycentricCoordinates.cs │ │ │ │ ├── Vector3ForCulling.cs │ │ │ │ └── PrimitiveRasterizerFactory.cs │ │ │ ├── ShaderOutputInputBinding.cs │ │ │ ├── FragmentQuad.cs │ │ │ ├── RasterizerState.cs │ │ │ ├── Samples.cs │ │ │ ├── Fragment.cs │ │ │ ├── Viewport.cs │ │ │ ├── MultiSamplingUtility.cs │ │ │ └── RasterizerStateDescription.cs │ │ ├── OutputMerger │ │ │ ├── DepthWriteMask.cs │ │ │ ├── BlendOperation.cs │ │ │ ├── DepthStencilClearFlags.cs │ │ │ ├── DepthStencilViewFlags.cs │ │ │ ├── StencilOperation.cs │ │ │ ├── ColorWriteMaskFlags.cs │ │ │ ├── DepthStencilViewDimension.cs │ │ │ ├── RenderTargetViewDimension.cs │ │ │ ├── DepthStencilOperationDescription.cs │ │ │ ├── RenderTargetBlendDescription.cs │ │ │ ├── BlendOption.cs │ │ │ ├── DepthStencilState.cs │ │ │ ├── RenderTargetView.Texture1DView.cs │ │ │ ├── RenderTargetView.Texture2DView.cs │ │ │ ├── DepthStencilView.Texture2DView.cs │ │ │ ├── DepthStencilView.Texture1DView.cs │ │ │ ├── RenderTargetView.cs │ │ │ ├── RenderTargetView.Texture1DArrayView.cs │ │ │ ├── RenderTargetView.Texture2DArrayView.cs │ │ │ ├── DepthStencilStateDescription.cs │ │ │ ├── RenderTargetView.Texture3DView.cs │ │ │ ├── DepthStencilView.Texture1DArrayView.cs │ │ │ ├── DepthStencilView.Texture2DArrayView.cs │ │ │ ├── DepthStencilView.InnerResourceView.cs │ │ │ └── DepthStencilView.cs │ │ ├── InputAssembler │ │ │ ├── InputClassification.cs │ │ │ ├── InputAssemblerVertexOutput.cs │ │ │ ├── InputAssemblerPrimitiveOutput.cs │ │ │ ├── IndexBufferBinding.cs │ │ │ ├── VertexBufferBinding.cs │ │ │ ├── PrimitiveTopology.cs │ │ │ ├── InputAssemblerVertexEventArgs.cs │ │ │ ├── InstancedVertexBufferIndex.cs │ │ │ ├── IndexedVertexBufferIndex.cs │ │ │ ├── VertexBufferIndex.cs │ │ │ └── InputElement.cs │ │ ├── ShaderResourceViewExtendedBufferFlags.cs │ │ ├── PixelShader │ │ │ ├── PixelShader.cs │ │ │ └── Pixel.cs │ │ ├── VertexShader │ │ │ ├── VertexShader.cs │ │ │ ├── VertexShaderOutput.cs │ │ │ └── VertexShaderStage.cs │ │ ├── GeometryShader │ │ │ └── GeometryShader.cs │ │ ├── UnorderedAccessView.cs │ │ ├── ShaderResourceViewDimension.cs │ │ ├── ResourceView.cs │ │ ├── ShaderBase.cs │ │ ├── ShaderResourceView.cs │ │ └── ShaderResourceView.Texture2DView.cs │ ├── packages.config │ ├── Resources │ │ ├── ResourceType.cs │ │ ├── TextureAddressMode.cs │ │ ├── Texture1DDescription.cs │ │ ├── Texture3DDescription.cs │ │ ├── Texture2DDescription.cs │ │ ├── BufferDescription.cs │ │ ├── BindFlags.cs │ │ ├── Resource.cs │ │ ├── Filter.cs │ │ ├── SamplerStateDescription.cs │ │ ├── TextureBase.cs │ │ └── Buffer.cs │ ├── Util │ │ ├── SerializedVertexBufferBinding.cs │ │ ├── Interop.cs │ │ ├── DiagnosticUtilities.cs │ │ └── ConversionExtensions.cs │ ├── Comparison.cs │ ├── SampleDescription.cs │ ├── ISwapChainPresenter.cs │ ├── RawSwapChainPresenter.cs │ ├── SwapChainDescription.cs │ ├── Math │ │ ├── Point.cs │ │ └── MathUtility.cs │ ├── DeviceChild.cs │ ├── DiagnosticEventArgs.cs │ ├── ComparisonUtility.cs │ ├── SwapChain.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Rasterizr.Tests │ ├── Assets │ │ ├── Texture.png │ │ ├── TextureMip1.png │ │ └── TextureMip2.png │ ├── packages.config │ ├── TestHelper.cs │ ├── Pipeline │ │ └── OutputMerger │ │ │ ├── DepthStencilStateTests.cs │ │ │ └── BlendStateTests.cs │ ├── Resources │ │ ├── BufferTests.cs │ │ └── Texture1DTests.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Rasterizr.Toolkit.Tests │ ├── Assets │ │ └── Sponza │ │ │ ├── sky.jpg │ │ │ ├── kamen.jpg │ │ │ ├── reljef.jpg │ │ │ ├── sp_luk.jpg │ │ │ ├── sponza.3ds │ │ │ ├── x01_st.jpg │ │ │ ├── 00_skap.jpg │ │ │ ├── 01_S_ba.jpg │ │ │ ├── 01_S_kap.jpg │ │ │ ├── 01_St_kp.jpg │ │ │ ├── 01_stub.jpg │ │ │ ├── prozor1.jpg │ │ │ ├── vrata_ko.jpg │ │ │ ├── vrata_kr.jpg │ │ │ └── kamen-stup.jpg │ ├── packages.config │ └── Properties │ │ └── AssemblyInfo.cs ├── Weavers │ ├── packages.config │ └── Properties │ │ └── AssemblyInfo.cs ├── Rasterizr.Toolkit │ ├── packages.config │ ├── Models │ │ ├── TextureLoadHandler.cs │ │ ├── ModelMesh.cs │ │ └── ConversionExtensions.cs │ ├── Number4Extensions.cs │ ├── Color3F.cs │ ├── VertexPositionColor.cs │ ├── VertexPositionTexture.cs │ ├── Color4.cs │ ├── ProceduralTextures.cs │ ├── VertexPositionColorTexture.cs │ └── VertexPositionNormalTexture.cs ├── Rasterizr.Studio │ ├── Modules │ │ ├── SampleBrowser │ │ │ ├── Samples │ │ │ │ ├── ModelLoading │ │ │ │ │ ├── Car │ │ │ │ │ │ ├── body.bmp │ │ │ │ │ │ ├── wheel.bmp │ │ │ │ │ │ ├── turret.bmp │ │ │ │ │ │ └── car.mtl │ │ │ │ │ ├── Sponza │ │ │ │ │ │ ├── kamen.jpg │ │ │ │ │ │ ├── sky.jpg │ │ │ │ │ │ ├── 00_skap.jpg │ │ │ │ │ │ ├── 01_S_ba.jpg │ │ │ │ │ │ ├── 01_stub.jpg │ │ │ │ │ │ ├── prozor1.jpg │ │ │ │ │ │ ├── reljef.jpg │ │ │ │ │ │ ├── sp_luk.jpg │ │ │ │ │ │ ├── sponza.3ds │ │ │ │ │ │ ├── x01_st.jpg │ │ │ │ │ │ ├── 01_S_kap.jpg │ │ │ │ │ │ ├── 01_St_kp.jpg │ │ │ │ │ │ ├── kamen-stup.jpg │ │ │ │ │ │ ├── vrata_ko.jpg │ │ │ │ │ │ └── vrata_kr.jpg │ │ │ │ │ └── ModelLoading.fx │ │ │ │ ├── EnvironmentMapping │ │ │ │ │ ├── white.bmp │ │ │ │ │ └── teapot.mtl │ │ │ │ ├── ISampleMetadata.cs │ │ │ │ ├── MiniCubeTexture │ │ │ │ │ └── GeneticaMortarlessBlocks.jpg │ │ │ │ ├── SampleBase.cs │ │ │ │ ├── SampleView.xaml.cs │ │ │ │ ├── SampleClock.cs │ │ │ │ └── FpsCounter.cs │ │ │ ├── ISample.cs │ │ │ ├── TechDemos │ │ │ │ ├── ITechDemoMetadata.cs │ │ │ │ ├── Resources │ │ │ │ │ ├── TextureMipmapping │ │ │ │ │ │ ├── window_28.jpg │ │ │ │ │ │ ├── TextureMipmappingView.xaml.cs │ │ │ │ │ │ └── MipMapViewModel.cs │ │ │ │ │ └── TextureSampling │ │ │ │ │ │ ├── CorrodedTiles.png │ │ │ │ │ │ ├── TextureSamplingView.xaml.cs │ │ │ │ │ │ └── TextureSamplingView.xaml │ │ │ │ └── TechDemoViewModel.cs │ │ │ ├── Views │ │ │ │ └── SampleBrowserView.xaml.cs │ │ │ ├── ViewModels │ │ │ │ └── SampleCategoryViewModel.cs │ │ │ └── Module.cs │ │ ├── GraphicsPixelHistory │ │ │ ├── Resources │ │ │ │ ├── FailedZTestLarge.png │ │ │ │ └── FailedZTestSmall.png │ │ │ ├── ViewModels │ │ │ │ ├── DrawPixelHistoryEventPartViewModel.cs │ │ │ │ ├── PixelHistoryEventViewModelBase.cs │ │ │ │ ├── PixelResults │ │ │ │ │ ├── ColorResultViewModel.cs │ │ │ │ │ ├── ExcludedPixelResultViewModel.cs │ │ │ │ │ └── PixelResultViewModel.cs │ │ │ │ ├── ColorViewModel.cs │ │ │ │ ├── SimplePixelHistoryEventViewModel.cs │ │ │ │ ├── VertexShaderDrawPixelHistoryEventPartViewModel.cs │ │ │ │ ├── OutputMergerDrawPixelHistoryEventPartViewModel.cs │ │ │ │ ├── DrawPixelHistoryEventViewModel.cs │ │ │ │ └── PixelHistoryEventViewModel.cs │ │ │ ├── Views │ │ │ │ ├── PixelResults │ │ │ │ │ ├── ColorResultView.xaml.cs │ │ │ │ │ ├── ExcludedPixelResultView.xaml.cs │ │ │ │ │ ├── ExcludedPixelResultView.xaml │ │ │ │ │ └── ColorResultView.xaml │ │ │ │ ├── GraphicsPixelHistoryView.xaml.cs │ │ │ │ ├── ColorView.xaml.cs │ │ │ │ ├── SimplePixelHistoryEventView.xaml.cs │ │ │ │ ├── OutputMergerDrawPixelHistoryEventPartView.xaml.cs │ │ │ │ ├── VertexShaderDrawPixelHistoryEventPartView.xaml.cs │ │ │ │ ├── InputAssemblerDrawPixelHistoryEventPartView.xaml.cs │ │ │ │ └── PixelHistoryResources.xaml │ │ │ ├── Design │ │ │ │ ├── DesignTimeColorViewModel.cs │ │ │ │ ├── DesignTimeColorResultViewModel.cs │ │ │ │ ├── DesignTimeSimplePixelHistoryEventViewModel.cs │ │ │ │ └── DesignTimeOutputMergerDrawPixelHistoryEventPartViewModel.cs │ │ │ └── Controls │ │ │ │ ├── ItemToCollectionConverter.cs │ │ │ │ ├── NullToVisibilityConverter.cs │ │ │ │ └── PixelHistoryEventTemplateSelector.cs │ │ ├── GraphicsEventList │ │ │ ├── Module.cs │ │ │ ├── Views │ │ │ │ ├── GraphicsEventListView.xaml.cs │ │ │ │ └── GraphicsEventListView.xaml │ │ │ └── Design │ │ │ │ └── DesignTimeGraphicsEventListViewModel.cs │ │ ├── GraphicsObjectTable │ │ │ ├── Views │ │ │ │ ├── InputLayoutView.xaml.cs │ │ │ │ ├── ShaderView.xaml │ │ │ │ ├── BufferView.xaml.cs │ │ │ │ ├── ShaderView.xaml.cs │ │ │ │ ├── Texture2DView.xaml.cs │ │ │ │ ├── BlendStateView.xaml.cs │ │ │ │ ├── GraphicsObjectDocumentView.xaml.cs │ │ │ │ ├── BufferView.xaml │ │ │ │ ├── GraphicsObjectDocumentView.xaml │ │ │ │ ├── GraphicsObjectTableView.xaml.cs │ │ │ │ └── InputLayoutView.xaml │ │ │ └── ViewModels │ │ │ │ ├── ShaderViewModel.cs │ │ │ │ └── BufferViewModel.cs │ │ ├── GraphicsDebugging │ │ │ ├── PixelChangedEventArgs.cs │ │ │ ├── Design │ │ │ │ ├── DesignTimeTracefile.cs │ │ │ │ └── DesignTimeSelectionService.cs │ │ │ ├── TracefileEventChangedEventArgs.cs │ │ │ ├── TracefileFrameChangedEventArgs.cs │ │ │ ├── ISelectionService.cs │ │ │ ├── ViewModels │ │ │ │ ├── TracefileViewModel.cs │ │ │ │ └── TracefileEventViewModel.cs │ │ │ ├── Views │ │ │ │ ├── TracefileEventView.xaml │ │ │ │ └── TracefileEventView.xaml.cs │ │ │ └── Module.cs │ │ ├── TracefileViewer │ │ │ ├── Design │ │ │ │ └── DesignTimeTracefileViewerViewModel.cs │ │ │ ├── EditorProvider.cs │ │ │ └── Views │ │ │ │ └── TracefileViewerView.xaml.cs │ │ ├── GraphicsPipelineStages │ │ │ └── Views │ │ │ │ ├── GraphicsPipelineStagesView.xaml.cs │ │ │ │ └── GraphicsPipelineStagesView.xaml │ │ └── Startup │ │ │ └── Module.cs │ ├── App.xaml.cs │ ├── Properties │ │ ├── Settings.settings │ │ └── Settings.Designer.cs │ ├── Framework │ │ ├── Controls │ │ │ ├── NearestNeighborImage.cs │ │ │ └── WriteableBitmapImage.cs │ │ ├── Int32Point.cs │ │ └── Converters │ │ │ └── ColorToBrushConverter.cs │ ├── app.config │ ├── packages.config │ ├── App.xaml │ ├── Bootstrapper.cs │ └── Themes │ │ └── Generic.xaml ├── Rasterizr.Diagnostics.Logging │ ├── packages.config │ ├── ObjectModel │ │ ├── PixelEventCollection.cs │ │ ├── TracefileFrame.cs │ │ ├── TracefileEvent.cs │ │ ├── Tracefile.cs │ │ └── TracefileEventArgumentCollection.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Rasterizr.Platform.WindowsForms │ ├── RenderForm.cs │ ├── WindowsFormsSwapChainPresenter.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Rasterizr.sln.DotSettings └── Rasterizr.Platform.Wpf │ └── Properties │ └── AssemblyInfo.cs ├── doc ├── rasterizr-studio.png └── rasterizr-studio-triangle.png ├── tools └── MSBuild.Fxc │ ├── readme.txt │ ├── MSBuild.Fxc.sln.DotSettings │ ├── Properties │ └── AssemblyInfo.cs │ ├── MSBuild.Fxc.sln │ └── ShaderProfileInfo.cs ├── .gitattributes └── .gitignore /lib/MSBuild.Fxc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/lib/MSBuild.Fxc.dll -------------------------------------------------------------------------------- /lib/SlimShader.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/lib/SlimShader.dll -------------------------------------------------------------------------------- /lib/SlimShader.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/lib/SlimShader.pdb -------------------------------------------------------------------------------- /src/.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/.nuget/NuGet.exe -------------------------------------------------------------------------------- /lib/D3DCompiler_43.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/lib/D3DCompiler_43.dll -------------------------------------------------------------------------------- /doc/rasterizr-studio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/doc/rasterizr-studio.png -------------------------------------------------------------------------------- /lib/AssimpNet/Assimp32.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/lib/AssimpNet/Assimp32.dll -------------------------------------------------------------------------------- /lib/AssimpNet/Assimp64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/lib/AssimpNet/Assimp64.dll -------------------------------------------------------------------------------- /lib/AssimpNet/AssimpNet.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/lib/AssimpNet/AssimpNet.dll -------------------------------------------------------------------------------- /lib/AssimpNet/AssimpNet.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/lib/AssimpNet/AssimpNet.pdb -------------------------------------------------------------------------------- /lib/SlimShader.Compiler.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/lib/SlimShader.Compiler.dll -------------------------------------------------------------------------------- /lib/SlimShader.Compiler.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/lib/SlimShader.Compiler.pdb -------------------------------------------------------------------------------- /src/Rasterizr/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /tools/MSBuild.Fxc/readme.txt: -------------------------------------------------------------------------------- 1 | From http://sharpdx.org/forum/4-general/355-shader-compilation-using-msbuild -------------------------------------------------------------------------------- /doc/rasterizr-studio-triangle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/doc/rasterizr-studio-triangle.png -------------------------------------------------------------------------------- /lib/SlimShader.VirtualMachine.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/lib/SlimShader.VirtualMachine.dll -------------------------------------------------------------------------------- /lib/SlimShader.VirtualMachine.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/lib/SlimShader.VirtualMachine.pdb -------------------------------------------------------------------------------- /lib/SlimShader.VirtualMachine.Jitter.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/lib/SlimShader.VirtualMachine.Jitter.dll -------------------------------------------------------------------------------- /lib/SlimShader.VirtualMachine.Jitter.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/lib/SlimShader.VirtualMachine.Jitter.pdb -------------------------------------------------------------------------------- /src/Rasterizr.Tests/Assets/Texture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Tests/Assets/Texture.png -------------------------------------------------------------------------------- /src/Rasterizr.Tests/Assets/TextureMip1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Tests/Assets/TextureMip1.png -------------------------------------------------------------------------------- /src/Rasterizr.Tests/Assets/TextureMip2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Tests/Assets/TextureMip2.png -------------------------------------------------------------------------------- /src/Rasterizr/Diagnostics/PixelEvent.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Diagnostics 2 | { 3 | public abstract class PixelEvent 4 | { 5 | 6 | } 7 | } -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Assets/Sponza/sky.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Toolkit.Tests/Assets/Sponza/sky.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Assets/Sponza/kamen.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Toolkit.Tests/Assets/Sponza/kamen.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Assets/Sponza/reljef.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Toolkit.Tests/Assets/Sponza/reljef.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Assets/Sponza/sp_luk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Toolkit.Tests/Assets/Sponza/sp_luk.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Assets/Sponza/sponza.3ds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Toolkit.Tests/Assets/Sponza/sponza.3ds -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Assets/Sponza/x01_st.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Toolkit.Tests/Assets/Sponza/x01_st.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Assets/Sponza/00_skap.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Toolkit.Tests/Assets/Sponza/00_skap.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Assets/Sponza/01_S_ba.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Toolkit.Tests/Assets/Sponza/01_S_ba.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Assets/Sponza/01_S_kap.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Toolkit.Tests/Assets/Sponza/01_S_kap.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Assets/Sponza/01_St_kp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Toolkit.Tests/Assets/Sponza/01_St_kp.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Assets/Sponza/01_stub.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Toolkit.Tests/Assets/Sponza/01_stub.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Assets/Sponza/prozor1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Toolkit.Tests/Assets/Sponza/prozor1.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Assets/Sponza/vrata_ko.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Toolkit.Tests/Assets/Sponza/vrata_ko.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Assets/Sponza/vrata_kr.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Toolkit.Tests/Assets/Sponza/vrata_kr.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Assets/Sponza/kamen-stup.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Toolkit.Tests/Assets/Sponza/kamen-stup.jpg -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/Rasterizer/FillMode.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.Rasterizer 2 | { 3 | public enum FillMode 4 | { 5 | Wireframe, 6 | Solid 7 | } 8 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/Rasterizer/CullMode.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.Rasterizer 2 | { 3 | public enum CullMode 4 | { 5 | None, 6 | Front, 7 | Back 8 | } 9 | } -------------------------------------------------------------------------------- /src/Weavers/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/DepthWriteMask.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.OutputMerger 2 | { 3 | public enum DepthWriteMask 4 | { 5 | Zero, 6 | All 7 | } 8 | } -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Rasterizr/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Rasterizr/Resources/ResourceType.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Resources 2 | { 3 | public enum ResourceType 4 | { 5 | Buffer, 6 | Texture1D, 7 | Texture2D, 8 | Texture3D 9 | } 10 | } -------------------------------------------------------------------------------- /src/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Car/body.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Car/body.bmp -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Car/wheel.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Car/wheel.bmp -------------------------------------------------------------------------------- /src/Rasterizr.Diagnostics.Logging/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Resources/FailedZTestLarge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Resources/FailedZTestLarge.png -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Resources/FailedZTestSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Resources/FailedZTestSmall.png -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/EnvironmentMapping/white.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/EnvironmentMapping/white.bmp -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Car/turret.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Car/turret.bmp -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/kamen.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/kamen.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/sky.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/sky.jpg -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/InputAssembler/InputClassification.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.InputAssembler 2 | { 3 | public enum InputClassification 4 | { 5 | PerVertexData, 6 | PerInstanceData 7 | } 8 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/00_skap.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/00_skap.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/01_S_ba.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/01_S_ba.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/01_stub.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/01_stub.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/prozor1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/prozor1.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/reljef.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/reljef.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/sp_luk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/sp_luk.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/sponza.3ds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/sponza.3ds -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/x01_st.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/x01_st.jpg -------------------------------------------------------------------------------- /src/Rasterizr/Resources/TextureAddressMode.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Resources 2 | { 3 | public enum TextureAddressMode 4 | { 5 | Wrap, 6 | Mirror, 7 | Clamp, 8 | Border, 9 | MirrorOnce 10 | } 11 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/ISample.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | 3 | namespace Rasterizr.Studio.Modules.SampleBrowser 4 | { 5 | public interface ISample : IScreen 6 | { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ISampleMetadata.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Studio.Modules.SampleBrowser.Samples 2 | { 3 | public interface ISampleMetadata 4 | { 5 | int SortOrder { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/01_S_kap.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/01_S_kap.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/01_St_kp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/01_St_kp.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/kamen-stup.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/kamen-stup.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/vrata_ko.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/vrata_ko.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/vrata_kr.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Sponza/vrata_kr.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/TechDemos/ITechDemoMetadata.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Studio.Modules.SampleBrowser.TechDemos 2 | { 3 | public interface ITechDemoMetadata 4 | { 5 | int SortOrder { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /src/Rasterizr/Util/SerializedVertexBufferBinding.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Util 2 | { 3 | internal class SerializedVertexBufferBinding 4 | { 5 | public int Buffer; 6 | public int Offset; 7 | public int Stride; 8 | } 9 | } -------------------------------------------------------------------------------- /src/Rasterizr/Comparison.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr 2 | { 3 | public enum Comparison 4 | { 5 | Never, 6 | Less, 7 | Equal, 8 | LessEqual, 9 | Greater, 10 | NotEqual, 11 | GreaterEqual, 12 | Always 13 | } 14 | } -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit/Models/TextureLoadHandler.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Rasterizr.Resources; 3 | 4 | namespace Rasterizr.Toolkit.Models 5 | { 6 | public delegate Texture2D TextureLoadHandler(Device device, Stream stream); 7 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/Rasterizer/FragmentQuadLocation.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.Rasterizer 2 | { 3 | public enum FragmentQuadLocation 4 | { 5 | TopLeft, 6 | TopRight, 7 | BottomLeft, 8 | BottomRight 9 | } 10 | } -------------------------------------------------------------------------------- /src/Rasterizr/SampleDescription.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr 2 | { 3 | public struct SampleDescription 4 | { 5 | public int Count; 6 | 7 | public SampleDescription(int count) 8 | { 9 | Count = count; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/MiniCubeTexture/GeneticaMortarlessBlocks.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/Samples/MiniCubeTexture/GeneticaMortarlessBlocks.jpg -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/TechDemos/Resources/TextureMipmapping/window_28.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/TechDemos/Resources/TextureMipmapping/window_28.jpg -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/BlendOperation.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.OutputMerger 2 | { 3 | public enum BlendOperation 4 | { 5 | Add, 6 | Subtract, 7 | ReverseSubtract, 8 | Minimum, 9 | Maximum 10 | } 11 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/ShaderResourceViewExtendedBufferFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rasterizr.Pipeline 4 | { 5 | [Flags] 6 | public enum ShaderResourceViewExtendedBufferFlags 7 | { 8 | None, 9 | Raw, 10 | } 11 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/TechDemos/Resources/TextureSampling/CorrodedTiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tgjones/rasterizr/HEAD/src/Rasterizr.Studio/Modules/SampleBrowser/TechDemos/Resources/TextureSampling/CorrodedTiles.png -------------------------------------------------------------------------------- /src/Rasterizr/Diagnostics/PixelExclusionReason.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Diagnostics 2 | { 3 | public enum PixelExclusionReason 4 | { 5 | NotExcluded, 6 | FailedDepthTest, 7 | FailedScissorTest, 8 | FailedStencilTest 9 | } 10 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/DepthStencilClearFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rasterizr.Pipeline.OutputMerger 4 | { 5 | [Flags] 6 | public enum DepthStencilClearFlags 7 | { 8 | Depth = 1, 9 | Stencil = 2 10 | } 11 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace Rasterizr.Studio 4 | { 5 | /// 6 | /// Interaction logic for App.xaml 7 | /// 8 | public partial class App : Application 9 | { 10 | 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Rasterizr.Diagnostics.Logging/ObjectModel/PixelEventCollection.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.ObjectModel; 2 | 3 | namespace Rasterizr.Diagnostics.Logging.ObjectModel 4 | { 5 | public class PixelEventCollection : Collection 6 | { 7 | 8 | } 9 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Rasterizr/ISwapChainPresenter.cs: -------------------------------------------------------------------------------- 1 | using SlimShader; 2 | 3 | namespace Rasterizr 4 | { 5 | public interface ISwapChainPresenter 6 | { 7 | void Initialize(int width, int height); 8 | void Present(Number4[] colors); 9 | } 10 | } -------------------------------------------------------------------------------- /src/Rasterizr/Resources/Texture1DDescription.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Resources 2 | { 3 | public struct Texture1DDescription 4 | { 5 | public int Width; 6 | public int MipLevels; 7 | public int ArraySize; 8 | public BindFlags BindFlags; 9 | } 10 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/DepthStencilViewFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rasterizr.Pipeline.OutputMerger 4 | { 5 | [Flags] 6 | public enum DepthStencilViewFlags 7 | { 8 | None = 0, 9 | ReadOnlyDepth = 1, 10 | ReadOnlyStencil = 2 11 | } 12 | } -------------------------------------------------------------------------------- /src/Rasterizr/Resources/Texture3DDescription.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Resources 2 | { 3 | public struct Texture3DDescription 4 | { 5 | public int Width; 6 | public int Height; 7 | public int Depth; 8 | public int MipLevels; 9 | public BindFlags BindFlags; 10 | } 11 | } -------------------------------------------------------------------------------- /src/Rasterizr/Resources/Texture2DDescription.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Resources 2 | { 3 | public struct Texture2DDescription 4 | { 5 | public int Width; 6 | public int Height; 7 | public int MipLevels; 8 | public int ArraySize; 9 | public BindFlags BindFlags; 10 | } 11 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/TechDemos/TechDemoViewModel.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | 3 | namespace Rasterizr.Studio.Modules.SampleBrowser.TechDemos 4 | { 5 | public abstract class TechDemoViewModel : Screen, ISample 6 | { 7 | public abstract string Category { get; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/PixelShader/PixelShader.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.PixelShader 2 | { 3 | public class PixelShader : ShaderBase 4 | { 5 | internal PixelShader(Device device, byte[] shaderBytecode) 6 | : base(device, shaderBytecode) 7 | { 8 | 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/VertexShader/VertexShader.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.VertexShader 2 | { 3 | public class VertexShader : ShaderBase 4 | { 5 | internal VertexShader(Device device, byte[] shaderBytecode) 6 | : base(device, shaderBytecode) 7 | { 8 | 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/GeometryShader/GeometryShader.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.GeometryShader 2 | { 3 | public class GeometryShader : ShaderBase 4 | { 5 | internal GeometryShader(Device device, byte[] shaderBytecode) 6 | : base(device, shaderBytecode) 7 | { 8 | 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/InputAssembler/InputAssemblerVertexOutput.cs: -------------------------------------------------------------------------------- 1 | using SlimShader; 2 | 3 | namespace Rasterizr.Pipeline.InputAssembler 4 | { 5 | internal struct InputAssemblerVertexOutput 6 | { 7 | public int VertexID; 8 | public int InstanceID; 9 | public Number4[] Data; 10 | } 11 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/StencilOperation.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.OutputMerger 2 | { 3 | public enum StencilOperation 4 | { 5 | Keep, 6 | Zero, 7 | Replace, 8 | IncrementAndClamp, 9 | DecrementAndClamp, 10 | Invert, 11 | Increment, 12 | Decrement 13 | } 14 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/UnorderedAccessView.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | 3 | namespace Rasterizr.Pipeline 4 | { 5 | public class UnorderedAccessView : ResourceView 6 | { 7 | public UnorderedAccessView(Device device, Resource resource) 8 | : base(device, resource) 9 | { 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Rasterizr.Tests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Rasterizr.Platform.WindowsForms/RenderForm.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | 3 | namespace Rasterizr.Platform.WindowsForms 4 | { 5 | public class RenderForm : Form 6 | { 7 | public RenderForm(string text) 8 | { 9 | Text = text; 10 | } 11 | 12 | public RenderForm() 13 | { 14 | 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Rasterizr/Diagnostics/SimpleEvent.cs: -------------------------------------------------------------------------------- 1 | using SlimShader; 2 | 3 | namespace Rasterizr.Diagnostics 4 | { 5 | public class SimpleEvent : PixelEvent 6 | { 7 | public Number4 Result { get; private set; } 8 | 9 | public SimpleEvent(Number4 result) 10 | { 11 | Result = result; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/ColorWriteMaskFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rasterizr.Pipeline.OutputMerger 4 | { 5 | [Flags] 6 | public enum ColorWriteMaskFlags : byte 7 | { 8 | Red = 1, 9 | Green = 2, 10 | Blue = 4, 11 | Alpha = 8, 12 | 13 | All = Red | Green | Blue | Alpha 14 | } 15 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/DepthStencilViewDimension.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.OutputMerger 2 | { 3 | public enum DepthStencilViewDimension 4 | { 5 | Unknown, 6 | Texture1D, 7 | Texture1DArray, 8 | Texture2D, 9 | Texture2DArray, 10 | Texture2DMultisampled, 11 | Texture2DMultisampledArray 12 | } 13 | } -------------------------------------------------------------------------------- /src/Rasterizr/Resources/BufferDescription.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Resources 2 | { 3 | public struct BufferDescription 4 | { 5 | public int SizeInBytes; 6 | public BindFlags BindFlags; 7 | 8 | public BufferDescription(BindFlags bindFlags) 9 | { 10 | SizeInBytes = 0; 11 | BindFlags = bindFlags; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Views/SampleBrowserView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace Rasterizr.Studio.Modules.SampleBrowser.Views 4 | { 5 | public partial class SampleBrowserView : UserControl 6 | { 7 | public SampleBrowserView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsEventList/Module.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using Gemini.Framework; 3 | 4 | namespace Rasterizr.Studio.Modules.GraphicsEventList 5 | { 6 | [Export(typeof(IModule))] 7 | public class Module : ModuleBase 8 | { 9 | public override void Initialize() 10 | { 11 | 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/ViewModels/DrawPixelHistoryEventPartViewModel.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | 3 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels 4 | { 5 | public abstract class DrawPixelHistoryEventPartViewModel : PropertyChangedBase 6 | { 7 | public abstract string Name { get; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/RenderTargetViewDimension.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.OutputMerger 2 | { 3 | public enum RenderTargetViewDimension 4 | { 5 | Unknown, 6 | Texture1D, 7 | Texture1DArray, 8 | Texture2D, 9 | Texture2DArray, 10 | Texture2DMultisampled, 11 | Texture2DMultisampledArray, 12 | Texture3D, 13 | } 14 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/InputAssembler/InputAssemblerPrimitiveOutput.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Pipeline.VertexShader; 2 | 3 | namespace Rasterizr.Pipeline.InputAssembler 4 | { 5 | internal struct InputAssemblerPrimitiveOutput 6 | { 7 | public int PrimitiveID; 8 | public uint RenderTargetArrayIndex; 9 | public VertexShaderOutput[] Vertices; 10 | } 11 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/DepthStencilOperationDescription.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.OutputMerger 2 | { 3 | public struct DepthStencilOperationDescription 4 | { 5 | public StencilOperation FailOperation; 6 | public StencilOperation DepthFailOperation; 7 | public StencilOperation PassOperation; 8 | public Comparison Comparison; 9 | } 10 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/Rasterizer/Sample.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.Rasterizer 2 | { 3 | public struct Sample 4 | { 5 | /// 6 | /// Gets or sets a flag which indicates whether this sample location 7 | /// is covered by the polygon being rasterized. 8 | /// 9 | public bool Covered; 10 | 11 | public float Depth; 12 | } 13 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/ShaderResourceViewDimension.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline 2 | { 3 | public enum ShaderResourceViewDimension 4 | { 5 | Unknown, 6 | Texture1D, 7 | Texture1DArray, 8 | Texture2D, 9 | Texture2DArray, 10 | Texture2DMultisampled, 11 | Texture2DMultisampledArray, 12 | Texture3D, 13 | TextureCube, 14 | TextureCubeArray 15 | } 16 | } -------------------------------------------------------------------------------- /src/Rasterizr/Resources/BindFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rasterizr.Resources 4 | { 5 | [Flags] 6 | public enum BindFlags 7 | { 8 | None = 0, 9 | VertexBuffer = 1, 10 | IndexBuffer = 2, 11 | ConstantBuffer = 4, 12 | ShaderResource = 8, 13 | StreamOutput = 16, 14 | RenderTarget = 32, 15 | DepthStencil = 64, 16 | UnorderedAccess = 128 17 | } 18 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/Rasterizer/Primitives/BarycentricCoordinates.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.Rasterizer.Primitives 2 | { 3 | internal struct BarycentricCoordinates 4 | { 5 | public float Alpha; 6 | public float Beta; 7 | public float Gamma; 8 | 9 | public bool IsOutsideTriangle 10 | { 11 | get { return (Alpha < 0 || Beta < 0 || Gamma < 0); } 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/VertexShader/VertexShaderOutput.cs: -------------------------------------------------------------------------------- 1 | using SlimShader; 2 | 3 | namespace Rasterizr.Pipeline.VertexShader 4 | { 5 | internal struct VertexShaderOutput 6 | { 7 | public bool IsStripCut; 8 | public int VertexID; 9 | public int InstanceID; 10 | public Number4 Position; 11 | public Number4[] InputData; 12 | public Number4[] OutputData; 13 | } 14 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/EnvironmentMapping/teapot.mtl: -------------------------------------------------------------------------------- 1 | # 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware 2 | # File Created: 23.05.2013 22:34:37 3 | 4 | newmtl wire_108008136 5 | Ns 32 6 | d 1 7 | Tr 0 8 | Tf 1 1 1 9 | illum 2 10 | Ka 0.4235 0.0314 0.5333 11 | Kd 0.4235 0.0314 0.5333 12 | Ks 0.3500 0.3500 0.3500 13 | map_Ka white.bmp 14 | map_Kd white.bmp 15 | -------------------------------------------------------------------------------- /src/Rasterizr.Diagnostics.Logging/ObjectModel/TracefileFrame.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Rasterizr.Diagnostics.Logging.ObjectModel 4 | { 5 | public class TracefileFrame 6 | { 7 | public int Number { get; set; } 8 | public List Events { get; set; } 9 | 10 | public TracefileFrame() 11 | { 12 | Events = new List(); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Framework/Controls/NearestNeighborImage.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Media; 2 | 3 | namespace Rasterizr.Studio.Framework.Controls 4 | { 5 | public class NearestNeighborImage : System.Windows.Controls.Image 6 | { 7 | protected override void OnRender(DrawingContext dc) 8 | { 9 | VisualBitmapScalingMode = BitmapScalingMode.NearestNeighbor; 10 | base.OnRender(dc); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Views/PixelResults/ColorResultView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.Views.PixelResults 4 | { 5 | public partial class ColorResultView : UserControl 6 | { 7 | public ColorResultView() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Rasterizr/RawSwapChainPresenter.cs: -------------------------------------------------------------------------------- 1 | using SlimShader; 2 | 3 | namespace Rasterizr 4 | { 5 | public class RawSwapChainPresenter : ISwapChainPresenter 6 | { 7 | public Number4[] Data { get; private set; } 8 | 9 | void ISwapChainPresenter.Initialize(int width, int height) { } 10 | 11 | void ISwapChainPresenter.Present(Number4[] colors) 12 | { 13 | Data = colors; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Rasterizr/SwapChainDescription.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr 2 | { 3 | public struct SwapChainDescription 4 | { 5 | public int Width; 6 | public int Height; 7 | public SampleDescription SampleDescription; 8 | 9 | public SwapChainDescription(int width, int height) 10 | { 11 | Width = width; 12 | Height = height; 13 | SampleDescription = new SampleDescription(1); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Rasterizr/Math/Point.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Rasterizr.Math 4 | { 5 | [StructLayout(LayoutKind.Sequential)] 6 | internal struct Point 7 | { 8 | public static int SizeInBytes 9 | { 10 | get { return sizeof(float) * 2; } 11 | } 12 | 13 | public float X; 14 | public float Y; 15 | 16 | public Point(float x, float y) 17 | { 18 | X = x; 19 | Y = y; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/ViewModels/PixelHistoryEventViewModelBase.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels.PixelResults; 3 | 4 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels 5 | { 6 | public abstract class PixelHistoryEventViewModelBase : PropertyChangedBase 7 | { 8 | public abstract PixelResultViewModel Result { get; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/InputAssembler/IndexBufferBinding.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | 3 | namespace Rasterizr.Pipeline.InputAssembler 4 | { 5 | public struct IndexBufferBinding 6 | { 7 | public Buffer Buffer; 8 | public Format Format; 9 | public int Offset; 10 | 11 | public IndexBufferBinding(Buffer buffer, Format format, int offset) 12 | { 13 | Buffer = buffer; 14 | Format = format; 15 | Offset = offset; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/InputAssembler/VertexBufferBinding.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | 3 | namespace Rasterizr.Pipeline.InputAssembler 4 | { 5 | public struct VertexBufferBinding 6 | { 7 | public Buffer Buffer; 8 | public int Offset; 9 | public int Stride; 10 | 11 | public VertexBufferBinding(Buffer buffer, int offset, int stride) 12 | { 13 | Buffer = buffer; 14 | Offset = offset; 15 | Stride = stride; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/ResourceView.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | 3 | namespace Rasterizr.Pipeline 4 | { 5 | public abstract class ResourceView : DeviceChild 6 | { 7 | private readonly Resource _resource; 8 | 9 | public Resource Resource 10 | { 11 | get { return _resource; } 12 | } 13 | 14 | internal ResourceView(Device device, Resource resource) 15 | : base(device) 16 | { 17 | _resource = resource; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/InputAssembler/PrimitiveTopology.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.InputAssembler 2 | { 3 | public enum PrimitiveTopology 4 | { 5 | Undefined, 6 | PointList, 7 | LineList, 8 | LineStrip, 9 | TriangleList, 10 | TriangleStrip, 11 | LineListWithAdjacency, 12 | LineStripWithAdjacency, 13 | TriangleListWithAdjacency, 14 | TriangleStripWithAdjacency 15 | } 16 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/Rasterizer/ShaderOutputInputBinding.cs: -------------------------------------------------------------------------------- 1 | using SlimShader.Chunks.Common; 2 | using SlimShader.Chunks.Shex; 3 | using SlimShader.Chunks.Xsgn; 4 | 5 | namespace Rasterizr.Pipeline.Rasterizer 6 | { 7 | internal class ShaderOutputInputBinding 8 | { 9 | public int Register; 10 | public ComponentMask ComponentMask; 11 | public InterpolationMode InterpolationMode; 12 | public Name SystemValueType; 13 | } 14 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Views/GraphicsPixelHistoryView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.Views 4 | { 5 | /// 6 | /// Interaction logic for GraphicsPixelHistoryView.xaml 7 | /// 8 | public partial class GraphicsPixelHistoryView : UserControl 9 | { 10 | public GraphicsPixelHistoryView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Design/DesignTimeColorViewModel.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.Design 5 | { 6 | public class DesignTimeColorViewModel : ColorViewModel 7 | { 8 | public DesignTimeColorViewModel() 9 | : base(new Number4(0.3f, 0.234235443f, 1.0f, 0.0f)) 10 | { 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Rasterizr/DeviceChild.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr 2 | { 3 | public abstract class DeviceChild 4 | { 5 | private readonly Device _device; 6 | private readonly int _id; 7 | 8 | public Device Device 9 | { 10 | get { return _device; } 11 | } 12 | 13 | public int ID 14 | { 15 | get { return _id; } 16 | } 17 | 18 | protected DeviceChild(Device device) 19 | { 20 | _device = device; 21 | _id = device.RegisterDeviceChild(this); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Framework/Int32Point.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Rasterizr.Studio.Framework 4 | { 5 | [StructLayout(LayoutKind.Sequential)] 6 | public struct Int32Point 7 | { 8 | public int X; 9 | public int Y; 10 | 11 | public Int32Point(int x, int y) 12 | { 13 | X = x; 14 | Y = y; 15 | } 16 | 17 | public override string ToString() 18 | { 19 | return string.Format("{0}, {1}", X, Y); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsObjectTable/Views/InputLayoutView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace Rasterizr.Studio.Modules.GraphicsObjectTable.Views 4 | { 5 | /// 6 | /// Interaction logic for InputLayoutView.xaml 7 | /// 8 | public partial class InputLayoutView : UserControl 9 | { 10 | public InputLayoutView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit/Number4Extensions.cs: -------------------------------------------------------------------------------- 1 | using SlimShader; 2 | 3 | namespace Rasterizr.Toolkit 4 | { 5 | public static class Number4Extensions 6 | { 7 | public static Color ToColor(this Number4 value) 8 | { 9 | return new Color( 10 | (byte) (value.R * 255.0f), 11 | (byte) (value.G * 255.0f), 12 | (byte) (value.B * 255.0f), 13 | (byte) (value.A * 255.0f)); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/TechDemos/Resources/TextureSampling/TextureSamplingView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace Rasterizr.Studio.Modules.SampleBrowser.TechDemos.Resources.TextureSampling 4 | { 5 | /// 6 | /// Interaction logic for TextureSamplingView.xaml 7 | /// 8 | public partial class TextureSamplingView : UserControl 9 | { 10 | public TextureSamplingView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/ShaderBase.cs: -------------------------------------------------------------------------------- 1 | using SlimShader; 2 | 3 | namespace Rasterizr.Pipeline 4 | { 5 | public class ShaderBase : DeviceChild 6 | { 7 | private readonly BytecodeContainer _shaderBytecode; 8 | 9 | public BytecodeContainer Bytecode 10 | { 11 | get { return _shaderBytecode; } 12 | } 13 | 14 | public ShaderBase(Device device, byte[] shaderBytecode) 15 | : base(device) 16 | { 17 | _shaderBytecode = BytecodeContainer.Parse(shaderBytecode); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Design/DesignTimeColorResultViewModel.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels.PixelResults; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.Design 5 | { 6 | public class DesignTimeColorResultViewModel : ColorResultViewModel 7 | { 8 | public DesignTimeColorResultViewModel() 9 | : base(new Number4(0, 0.2f, 0.3f, 0.4f)) 10 | { 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/Rasterizer/FragmentQuad.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.Rasterizer 2 | { 3 | /// 4 | /// Stores 2x2 fragments. Used by the rasterizer to process quads of fragments, instead 5 | /// of individual fragments, so that the pixel shader can access partial derivatives. 6 | /// 7 | internal struct FragmentQuad 8 | { 9 | public Fragment Fragment0; 10 | public Fragment Fragment1; 11 | public Fragment Fragment2; 12 | public Fragment Fragment3; 13 | } 14 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/Rasterizer/RasterizerState.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.Rasterizer 2 | { 3 | public class RasterizerState : DeviceChild 4 | { 5 | private readonly RasterizerStateDescription _description; 6 | 7 | public RasterizerStateDescription Description 8 | { 9 | get { return _description; } 10 | } 11 | 12 | internal RasterizerState(Device device, RasterizerStateDescription description) 13 | : base(device) 14 | { 15 | _description = description; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/TechDemos/Resources/TextureMipmapping/TextureMipmappingView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace Rasterizr.Studio.Modules.SampleBrowser.TechDemos.Resources.TextureMipmapping 4 | { 5 | /// 6 | /// Interaction logic for TextureMipmappingView.xaml 7 | /// 8 | public partial class TextureMipmappingView : UserControl 9 | { 10 | public TextureMipmappingView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit/Color3F.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Rasterizr.Toolkit 4 | { 5 | [StructLayout(LayoutKind.Sequential)] 6 | public struct Color3F 7 | { 8 | public static int SizeInBytes 9 | { 10 | get { return sizeof(float) * 3; } 11 | } 12 | 13 | public float Red; 14 | public float Green; 15 | public float Blue; 16 | 17 | public Color3F(float red, float green, float blue) 18 | { 19 | Red = red; 20 | Green = green; 21 | Blue = blue; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsDebugging/PixelChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Rasterizr.Studio.Framework; 3 | 4 | namespace Rasterizr.Studio.Modules.GraphicsDebugging 5 | { 6 | public class PixelChangedEventArgs : EventArgs 7 | { 8 | private readonly Int32Point _selectedPixel; 9 | 10 | public Int32Point SelectedPixel 11 | { 12 | get { return _selectedPixel; } 13 | } 14 | 15 | public PixelChangedEventArgs(Int32Point selectedPixel) 16 | { 17 | _selectedPixel = selectedPixel; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Views/PixelResults/ExcludedPixelResultView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.Views.PixelResults 4 | { 5 | /// 6 | /// Interaction logic for ExcludedDrawResultView.xaml 7 | /// 8 | public partial class ExcludedPixelResultView : UserControl 9 | { 10 | public ExcludedPixelResultView() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/RenderTargetBlendDescription.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.OutputMerger 2 | { 3 | public struct RenderTargetBlendDescription 4 | { 5 | public bool IsBlendEnabled; 6 | public BlendOption SourceBlend; 7 | public BlendOption DestinationBlend; 8 | public BlendOperation BlendOperation; 9 | public BlendOption SourceAlphaBlend; 10 | public BlendOption DestinationAlphaBlend; 11 | public BlendOperation AlphaBlendOperation; 12 | public ColorWriteMaskFlags RenderTargetWriteMask; 13 | } 14 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsObjectTable/ViewModels/ShaderViewModel.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Pipeline; 2 | 3 | namespace Rasterizr.Studio.Modules.GraphicsObjectTable.ViewModels 4 | { 5 | public class ShaderViewModel 6 | { 7 | private readonly ShaderBase _shader; 8 | 9 | public string Disassembly 10 | { 11 | get { return _shader.Bytecode.ToString(); } 12 | } 13 | 14 | public ShaderViewModel(ShaderBase shader) 15 | { 16 | _shader = shader; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Rasterizr/DiagnosticEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rasterizr 4 | { 5 | public class DiagnosticEventArgs : EventArgs 6 | { 7 | private readonly object[] _arguments; 8 | 9 | public object[] Arguments 10 | { 11 | get { return _arguments; } 12 | } 13 | 14 | public DiagnosticEventArgs(params object[] arguments) 15 | { 16 | _arguments = arguments; 17 | } 18 | } 19 | 20 | public delegate void DiagnosticEventHandler(object sender, DiagnosticEventArgs args); 21 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/BlendOption.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.OutputMerger 2 | { 3 | public enum BlendOption 4 | { 5 | Zero, 6 | One, 7 | SourceColor, 8 | InverseSourceColor, 9 | SourceAlpha, 10 | InverseSourceAlpha, 11 | DestinationAlpha, 12 | InverseDestinationAlpha, 13 | DestinationColor, 14 | InverseDestinationColor, 15 | SourceAlphaSaturate, 16 | BlendFactor, 17 | InverseBlendFactor, 18 | SecondarySourceColor, 19 | InverseSecondarySourceColor, 20 | SecondarySourceAlpha, 21 | InverseSecondarySourceAlpha 22 | } 23 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/TracefileViewer/Design/DesignTimeTracefileViewerViewModel.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Studio.Modules.GraphicsDebugging.Design; 2 | using Rasterizr.Studio.Modules.TracefileViewer.ViewModels; 3 | 4 | namespace Rasterizr.Studio.Modules.TracefileViewer.Design 5 | { 6 | public class DesignTimeTracefileViewerViewModel : TracefileViewerViewModel 7 | { 8 | public DesignTimeTracefileViewerViewModel() 9 | : base(new DesignTimeSelectionService(), "test.trace", new DesignTimeTracefile()) 10 | { 11 | HasHoverPixel = true; 12 | HasSelectedPixel = true; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/Rasterizr.sln.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | <data><IncludeFilters /><ExcludeFilters /></data> 3 | <data /> -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Design/DesignTimeSimplePixelHistoryEventViewModel.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Diagnostics; 2 | using Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels; 3 | using SlimShader; 4 | 5 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.Design 6 | { 7 | public class DesignTimeSimplePixelHistoryEventViewModel : SimplePixelHistoryEventViewModel 8 | { 9 | public DesignTimeSimplePixelHistoryEventViewModel() 10 | : base(new SimpleEvent(new Number4(0.3f, 0.234235443f, 1.0f, 0.0f))) 11 | { 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Rasterizr.Tests/TestHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace Rasterizr.Tests 6 | { 7 | internal static class TestHelper 8 | { 9 | public static byte[] GetByteArray(params float[] values) 10 | { 11 | return values.SelectMany(BitConverter.GetBytes).ToArray(); 12 | } 13 | 14 | public static byte[] MergeByteArrays(params byte[][] byteArrays) 15 | { 16 | var result = new List(); 17 | foreach (var byteArray in byteArrays) 18 | result.AddRange(byteArray); 19 | return result.ToArray(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/ViewModels/PixelResults/ColorResultViewModel.cs: -------------------------------------------------------------------------------- 1 | using SlimShader; 2 | 3 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels.PixelResults 4 | { 5 | public class ColorResultViewModel : PixelResultViewModel 6 | { 7 | private readonly ColorViewModel _result; 8 | 9 | public ColorViewModel Result 10 | { 11 | get { return _result; } 12 | } 13 | 14 | public ColorResultViewModel(Number4 color) 15 | { 16 | _result = new ColorViewModel(color); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/ViewModels/SampleCategoryViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Caliburn.Micro; 3 | 4 | namespace Rasterizr.Studio.Modules.SampleBrowser.ViewModels 5 | { 6 | public class SampleCategoryViewModel : Conductor.Collection.OneActive 7 | { 8 | public SampleCategoryViewModel(string name, IEnumerable samples) 9 | { 10 | ((IActivate) this).Activate(); 11 | 12 | DisplayName = name; 13 | Items.AddRange(samples); 14 | ActivateItem(Items[0]); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /tools/MSBuild.Fxc/MSBuild.Fxc.sln.DotSettings: -------------------------------------------------------------------------------- 1 | 2 | <data><IncludeFilters /><ExcludeFilters /></data> 3 | <data /> -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Design/DesignTimeOutputMergerDrawPixelHistoryEventPartViewModel.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels; 2 | 3 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.Design 4 | { 5 | public class DesignTimeOutputMergerDrawPixelHistoryEventPartViewModel : OutputMergerDrawPixelHistoryEventPartViewModel 6 | { 7 | public DesignTimeOutputMergerDrawPixelHistoryEventPartViewModel() 8 | : base(DesignTimeDrawPixelHistoryEventViewModel.CreateDrawEvent()) 9 | { 10 | 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/SampleBase.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Media.Imaging; 2 | 3 | namespace Rasterizr.Studio.Modules.SampleBrowser.Samples 4 | { 5 | public abstract class SampleBase 6 | { 7 | public abstract string Name { get; } 8 | 9 | /// 10 | /// In a derived class, implements logic to initialize the sample. 11 | /// 12 | public abstract WriteableBitmap Initialize(Device device); 13 | 14 | /// 15 | /// In a derived class, implements logic to render the sample. 16 | /// 17 | public virtual void Draw(float time) 18 | { 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsDebugging/Design/DesignTimeTracefile.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Diagnostics; 2 | using Rasterizr.Diagnostics.Logging.ObjectModel; 3 | 4 | namespace Rasterizr.Studio.Modules.GraphicsDebugging.Design 5 | { 6 | public class DesignTimeTracefile : Tracefile 7 | { 8 | public DesignTimeTracefile() 9 | { 10 | Frames.Add( 11 | new TracefileFrame 12 | { 13 | Number = 1, 14 | Events = 15 | { 16 | new TracefileEvent 17 | { 18 | Number = 1, 19 | OperationType = OperationType.InputAssemblerStageSetVertexBuffers 20 | } 21 | } 22 | }); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/SampleView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | using Caliburn.Micro; 3 | 4 | namespace Rasterizr.Studio.Modules.SampleBrowser.Samples 5 | { 6 | /// 7 | /// Interaction logic for SampleView.xaml 8 | /// 9 | public partial class SampleView : UserControl 10 | { 11 | public SampleView() 12 | { 13 | InitializeComponent(); 14 | 15 | IsVisibleChanged += (sender, e) => 16 | { 17 | if (IsVisible) 18 | ((IActivate) DataContext).Activate(); 19 | else 20 | ((IDeactivate) DataContext).Deactivate(false); 21 | }; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Rasterizr/Resources/Resource.cs: -------------------------------------------------------------------------------- 1 | using SlimShader; 2 | 3 | namespace Rasterizr.Resources 4 | { 5 | public abstract class Resource : DeviceChild 6 | { 7 | internal interface ISubresource 8 | { 9 | void Clear(ref Number4 value); 10 | } 11 | 12 | public static int CalculateSubresource(int mipSlice, int arraySlice, int mipLevels) 13 | { 14 | return mipSlice + (arraySlice * mipLevels); 15 | } 16 | 17 | internal abstract ResourceType ResourceType { get; } 18 | internal abstract int Size { get; } 19 | 20 | protected Resource(Device device) 21 | : base(device) 22 | { 23 | 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /tools/MSBuild.Fxc/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | [assembly: AssemblyTitle("MSBuild.Fxc")] 5 | [assembly: AssemblyDescription("")] 6 | [assembly: AssemblyConfiguration("")] 7 | [assembly: AssemblyCompany("")] 8 | [assembly: AssemblyProduct("MSBuild.Fxc")] 9 | [assembly: AssemblyCopyright("Copyright © 2012")] 10 | [assembly: AssemblyTrademark("")] 11 | [assembly: AssemblyCulture("")] 12 | [assembly: ComVisible(false)] 13 | [assembly: Guid("14442afd-4a3a-48b3-9025-07bc7d0d8f19")] 14 | [assembly: AssemblyVersion("1.0.0.0")] 15 | [assembly: AssemblyFileVersion("1.0.0.0")] 16 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/ViewModels/PixelResults/ExcludedPixelResultViewModel.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Diagnostics; 2 | 3 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels.PixelResults 4 | { 5 | public class ExcludedPixelResultViewModel : PixelResultViewModel 6 | { 7 | private readonly DrawEvent _event; 8 | 9 | public PixelExclusionReason ExclusionReason 10 | { 11 | get { return _event.ExclusionReason; } 12 | } 13 | 14 | public ExcludedPixelResultViewModel(DrawEvent @event) 15 | { 16 | _event = @event; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsDebugging/TracefileEventChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Rasterizr.Studio.Modules.GraphicsDebugging.ViewModels; 3 | 4 | namespace Rasterizr.Studio.Modules.GraphicsDebugging 5 | { 6 | public class TracefileEventChangedEventArgs : EventArgs 7 | { 8 | private readonly TracefileEventViewModel _tracefileEventViewModel; 9 | 10 | public TracefileEventViewModel TracefileFrameViewModel 11 | { 12 | get { return _tracefileEventViewModel; } 13 | } 14 | 15 | public TracefileEventChangedEventArgs(TracefileEventViewModel tracefileEventViewModel) 16 | { 17 | _tracefileEventViewModel = tracefileEventViewModel; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsDebugging/TracefileFrameChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Rasterizr.Studio.Modules.GraphicsDebugging.ViewModels; 3 | 4 | namespace Rasterizr.Studio.Modules.GraphicsDebugging 5 | { 6 | public class TracefileFrameChangedEventArgs : EventArgs 7 | { 8 | private readonly TracefileFrameViewModel _tracefileFrameViewModel; 9 | 10 | public TracefileFrameViewModel TracefileFrameViewModel 11 | { 12 | get { return _tracefileFrameViewModel; } 13 | } 14 | 15 | public TracefileFrameChangedEventArgs(TracefileFrameViewModel tracefileFrameViewModel) 16 | { 17 | _tracefileFrameViewModel = tracefileFrameViewModel; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Rasterizr/Resources/Filter.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Resources 2 | { 3 | public enum Filter 4 | { 5 | MinMagMipPoint, 6 | MinMagPointMipLinear, 7 | MinPointMagLinearMipPoint, 8 | MinPointMagMipLinear, 9 | MinLinearMagMipPoint, 10 | MinLinearMagPointMipLinear, 11 | MinMagLinearMipPoint, 12 | MinMagMipLinear, 13 | Anisotropic, 14 | ComparisonMinMagMipPoint, 15 | ComparisonMinMagPointMipLinear, 16 | ComparisonMinPointMagLinearMipPoint, 17 | ComparisonMinPointMagMipLinear, 18 | ComparisonMinLinearMagMipPoint, 19 | ComparisonMinLinearMagPointMipLinear, 20 | ComparisonMinMagLinearMipPoint, 21 | ComparisonMinMagMipLinear, 22 | ComparisonAnisotropic, 23 | } 24 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/InputAssembler/InputAssemblerVertexEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rasterizr.Pipeline.InputAssembler 4 | { 5 | internal class InputAssemblerVertexEventArgs : EventArgs 6 | { 7 | private readonly InputAssemblerVertexOutput _vertex; 8 | 9 | public InputAssemblerVertexOutput Vertex 10 | { 11 | get { return _vertex; } 12 | } 13 | 14 | public InputAssemblerVertexEventArgs(InputAssemblerVertexOutput vertex) 15 | { 16 | _vertex = vertex; 17 | } 18 | } 19 | 20 | internal delegate void InputAssemblerVertexEventHandler(object sender, InputAssemblerVertexEventArgs args); 21 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsDebugging/ISelectionService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Rasterizr.Studio.Framework; 3 | using Rasterizr.Studio.Modules.GraphicsDebugging.ViewModels; 4 | 5 | namespace Rasterizr.Studio.Modules.GraphicsDebugging 6 | { 7 | public interface ISelectionService 8 | { 9 | event EventHandler SelectedFrameChanged; 10 | event EventHandler SelectedEventChanged; 11 | event EventHandler SelectedPixelChanged; 12 | 13 | TracefileFrameViewModel SelectedFrame { get; set; } 14 | TracefileEventViewModel SelectedEvent { get; set; } 15 | Int32Point SelectedPixel { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Controls/ItemToCollectionConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.Controls 6 | { 7 | public class ItemToCollectionConverter : IValueConverter 8 | { 9 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 10 | { 11 | return new[] { value }; 12 | } 13 | 14 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | throw new NotImplementedException(); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Views/PixelResults/ExcludedPixelResultView.xaml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/Rasterizer/Samples.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rasterizr.Pipeline.Rasterizer 4 | { 5 | public struct Samples 6 | { 7 | public bool AnyCovered; 8 | public Sample Sample0; 9 | public Sample Sample1; 10 | public Sample Sample2; 11 | public Sample Sample3; 12 | 13 | public Sample this[int index] 14 | { 15 | get 16 | { 17 | switch (index) 18 | { 19 | case 0: 20 | return Sample0; 21 | case 1 : 22 | return Sample1; 23 | case 2 : 24 | return Sample2; 25 | case 3 : 26 | return Sample3; 27 | default : 28 | throw new ArgumentOutOfRangeException("index"); 29 | } 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/PixelShader/Pixel.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Pipeline.Rasterizer; 2 | using Rasterizr.Pipeline.VertexShader; 3 | using SlimShader; 4 | 5 | namespace Rasterizr.Pipeline.PixelShader 6 | { 7 | internal struct Pixel 8 | { 9 | public VertexShaderOutput[] Vertices; 10 | public int X; 11 | public int Y; 12 | public Number4 Color; 13 | public Samples Samples; 14 | public int PrimitiveID; 15 | public uint RenderTargetArrayIndex; 16 | 17 | public Pixel(int x, int y) 18 | { 19 | Vertices = null; 20 | X = x; 21 | Y = y; 22 | Color = new Number4(); 23 | Samples = new Samples(); 24 | PrimitiveID = 0; 25 | RenderTargetArrayIndex = 0; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/SampleClock.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace Rasterizr.Studio.Modules.SampleBrowser.Samples 4 | { 5 | internal class SampleClock 6 | { 7 | private readonly Stopwatch _stopwatch; 8 | 9 | internal float ManuallySteppedTime { get; set; } 10 | 11 | public float TotalTime 12 | { 13 | get { return ManuallySteppedTime + _stopwatch.ElapsedMilliseconds * 0.001f; } 14 | } 15 | 16 | public SampleClock() 17 | { 18 | _stopwatch = new Stopwatch(); 19 | } 20 | 21 | public void Start() 22 | { 23 | _stopwatch.Start(); 24 | } 25 | 26 | public void Stop() 27 | { 28 | _stopwatch.Stop(); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Rasterizr/Util/Interop.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rasterizr.Util 4 | { 5 | internal static class Interop 6 | { 7 | public static unsafe void Read(void* pSrc, T[] data, int offset, int countInBytes) 8 | where T : struct 9 | { 10 | throw new NotImplementedException(); 11 | } 12 | 13 | public static int SizeOf() 14 | { 15 | throw new NotImplementedException(); 16 | } 17 | 18 | public static unsafe void* Write(void* pDest, ref T data) where T : struct 19 | { 20 | throw new NotImplementedException(); 21 | } 22 | 23 | public static unsafe void Write(void* pDest, T[] data, int offset, int count) 24 | where T : struct 25 | { 26 | throw new NotImplementedException(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/ViewModels/PixelResults/PixelResultViewModel.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using Rasterizr.Diagnostics; 3 | 4 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels.PixelResults 5 | { 6 | public abstract class PixelResultViewModel : PropertyChangedBase 7 | { 8 | public static PixelResultViewModel Create(DrawEvent @event) 9 | { 10 | switch (@event.ExclusionReason) 11 | { 12 | case PixelExclusionReason.NotExcluded: 13 | return new ColorResultViewModel(@event.Result.Value); 14 | default: 15 | return new ExcludedPixelResultViewModel(@event); 16 | } 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Rasterizr.Tests/Pipeline/OutputMerger/DepthStencilStateTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using Rasterizr.Pipeline.OutputMerger; 3 | 4 | namespace Rasterizr.Tests.Pipeline.OutputMerger 5 | { 6 | [TestFixture] 7 | public class DepthStencilStateTests 8 | { 9 | [Test] 10 | public void DefaultDepthStencilStateIsValid() 11 | { 12 | // Arrange. 13 | var device = new Device(); 14 | var depthStencilState = new DepthStencilState(device, DepthStencilStateDescription.Default); 15 | 16 | // Act / Assert. 17 | Assert.That(depthStencilState.DepthTestPasses(0.3f, 0.5f), Is.True); 18 | Assert.That(depthStencilState.DepthTestPasses(0.5f, 0.5f), Is.False); 19 | Assert.That(depthStencilState.DepthTestPasses(0.7f, 0.5f), Is.False); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit/VertexPositionColor.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using Rasterizr.Pipeline.InputAssembler; 3 | using SharpDX; 4 | 5 | namespace Rasterizr.Toolkit 6 | { 7 | [StructLayout(LayoutKind.Sequential)] 8 | public struct VertexPositionColor 9 | { 10 | public Vector3 Position; 11 | public Color4F Color; 12 | 13 | public VertexPositionColor(Vector3 position, Color4F color) 14 | { 15 | Position = position; 16 | Color = color; 17 | } 18 | 19 | public static InputElement[] InputElements 20 | { 21 | get 22 | { 23 | return new[] 24 | { 25 | new InputElement("POSITION", 0, Format.R32G32B32_Float, 0), 26 | new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 0) 27 | }; 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsDebugging/Design/DesignTimeSelectionService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Rasterizr.Studio.Framework; 3 | using Rasterizr.Studio.Modules.GraphicsDebugging.ViewModels; 4 | 5 | namespace Rasterizr.Studio.Modules.GraphicsDebugging.Design 6 | { 7 | public class DesignTimeSelectionService : ISelectionService 8 | { 9 | public event EventHandler SelectedFrameChanged; 10 | public event EventHandler SelectedEventChanged; 11 | public event EventHandler SelectedPixelChanged; 12 | public TracefileFrameViewModel SelectedFrame { get; set; } 13 | public TracefileEventViewModel SelectedEvent { get; set; } 14 | public Int32Point SelectedPixel { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/App.xaml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/ShaderResourceView.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | using SlimShader.VirtualMachine.Resources; 3 | 4 | namespace Rasterizr.Pipeline 5 | { 6 | public partial class ShaderResourceView : ResourceView 7 | { 8 | private readonly ShaderResourceViewDescription _description; 9 | private readonly InnerResourceView _innerView; 10 | 11 | internal ITexture InnerView 12 | { 13 | get { return _innerView; } 14 | } 15 | 16 | internal ShaderResourceView(Device device, Resource resource, ShaderResourceViewDescription? description) 17 | : base(device, resource) 18 | { 19 | _description = description.GetValueOrDefault(ShaderResourceViewDescription.CreateDefault(resource)); 20 | _innerView = InnerResourceView.Create(resource, _description); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Controls/NullToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.Controls 7 | { 8 | public class NullToVisibilityConverter : IValueConverter 9 | { 10 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 11 | { 12 | if (value == null) 13 | return Visibility.Hidden; 14 | return Visibility.Visible; 15 | } 16 | 17 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | throw new NotImplementedException(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Rasterizr.Diagnostics.Logging/ObjectModel/TracefileEvent.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Rasterizr.Pipeline.InputAssembler; 3 | 4 | namespace Rasterizr.Diagnostics.Logging.ObjectModel 5 | { 6 | public class TracefileEvent 7 | { 8 | public int Number { get; set; } 9 | public OperationType OperationType { get; set; } 10 | public TracefileEventArgumentCollection Arguments { get; set; } 11 | 12 | internal List InputAssemblerOutputs { get; set; } 13 | internal List PixelEvents { get; set; } 14 | 15 | public TracefileEvent() 16 | { 17 | Arguments = new TracefileEventArgumentCollection(); 18 | InputAssemblerOutputs = new List(); 19 | PixelEvents = new List(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsEventList/Views/GraphicsEventListView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | 15 | namespace Rasterizr.Studio.Modules.GraphicsEventList.Views 16 | { 17 | /// 18 | /// Interaction logic for GraphicsEventListView.xaml 19 | /// 20 | public partial class GraphicsEventListView : UserControl 21 | { 22 | public GraphicsEventListView() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/ViewModels/ColorViewModel.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels 5 | { 6 | public class ColorViewModel : PropertyChangedBase 7 | { 8 | private readonly Number4 _color; 9 | 10 | public Number4 Color 11 | { 12 | get { return _color; } 13 | } 14 | 15 | public float Red 16 | { 17 | get { return _color.R; } 18 | } 19 | 20 | public float Blue 21 | { 22 | get { return _color.B; } 23 | } 24 | 25 | public float Green 26 | { 27 | get { return _color.G; } 28 | } 29 | 30 | public float Alpha 31 | { 32 | get { return _color.A; } 33 | } 34 | 35 | public ColorViewModel(Number4 color) 36 | { 37 | _color = color; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/TechDemos/Resources/TextureMipmapping/MipMapViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Media.Imaging; 2 | using Caliburn.Micro; 3 | 4 | namespace Rasterizr.Studio.Modules.SampleBrowser.TechDemos.Resources.TextureMipmapping 5 | { 6 | public class MipMapViewModel : PropertyChangedBase 7 | { 8 | private readonly WriteableBitmap _bitmap; 9 | public WriteableBitmap Bitmap 10 | { 11 | get { return _bitmap; } 12 | } 13 | 14 | private readonly string _description; 15 | public string Description 16 | { 17 | get { return _description; } 18 | } 19 | 20 | public MipMapViewModel(WriteableBitmap bitmap, int level) 21 | { 22 | _bitmap = bitmap; 23 | _description = string.Format("Mip level {0}: {1} x {2}", level, bitmap.PixelWidth, bitmap.PixelHeight); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Shamelessly stolen from http://gist.github.com/114476 2 | # .gitignore for .NET projects 3 | # Thanks to Derick Bailey 4 | # http://www.lostechies.com/blogs/derickbailey/archive/2009/05/18/a-net-c-developer-s-gitignore-file.aspx 5 | # Additional Thanks to 6 | # - Alexey Abramov 7 | 8 | # Standard VS.NET and ReSharper Foo 9 | obj 10 | bin 11 | Bin 12 | *.csproj.user 13 | *ReSharper* 14 | *resharper* 15 | *.dotCover 16 | *.suo 17 | *.cache 18 | Thumbs.db 19 | 20 | # NuGet Packages Directory 21 | packages 22 | 23 | # Other useful stuff 24 | *.bak 25 | *.cache 26 | *.log 27 | *.swp 28 | *.user 29 | _compareTemp 30 | _notes 31 | aspnet_client 32 | httpd.parse.errors 33 | 34 | # Office Temp Files 35 | ~$* 36 | 37 | # If you have a deploy folder 38 | # deploy 39 | # deploy/* 40 | 41 | # Exclude ALL DLLs? ( 42 | # *.dll -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsDebugging/ViewModels/TracefileViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using Caliburn.Micro; 4 | using Rasterizr.Diagnostics.Logging.ObjectModel; 5 | 6 | namespace Rasterizr.Studio.Modules.GraphicsDebugging.ViewModels 7 | { 8 | public class TracefileViewModel : PropertyChangedBase 9 | { 10 | private readonly Tracefile _tracefile; 11 | private readonly IList _frames; 12 | 13 | public IList Frames 14 | { 15 | get { return _frames; } 16 | } 17 | 18 | public TracefileViewModel(ISelectionService selectionService, Tracefile tracefile) 19 | { 20 | _tracefile = tracefile; 21 | _frames = _tracefile.Frames.Select(x => new TracefileFrameViewModel(selectionService, x)).ToList(); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit/VertexPositionTexture.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using Rasterizr.Pipeline.InputAssembler; 3 | using SharpDX; 4 | 5 | namespace Rasterizr.Toolkit 6 | { 7 | [StructLayout(LayoutKind.Sequential)] 8 | public struct VertexPositionTexture 9 | { 10 | public Vector3 Position; 11 | public Vector3 TextureCoordinate; 12 | 13 | public VertexPositionTexture(Vector3 position, Vector3 textureCoordinate) 14 | { 15 | Position = position; 16 | TextureCoordinate = textureCoordinate; 17 | } 18 | 19 | public static InputElement[] InputElements 20 | { 21 | get 22 | { 23 | return new[] 24 | { 25 | new InputElement("POSITION", 0, Format.R32G32B32_Float, 0), 26 | new InputElement("TEXCOORD", 0, Format.R32G32_Float, 0) 27 | }; 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsDebugging/ViewModels/TracefileEventViewModel.cs: -------------------------------------------------------------------------------- 1 | using Caliburn.Micro; 2 | using Rasterizr.Diagnostics; 3 | using Rasterizr.Diagnostics.Logging.ObjectModel; 4 | 5 | namespace Rasterizr.Studio.Modules.GraphicsDebugging.ViewModels 6 | { 7 | public class TracefileEventViewModel : PropertyChangedBase 8 | { 9 | private readonly TracefileEvent _tracefileEvent; 10 | 11 | internal TracefileEvent Model 12 | { 13 | get { return _tracefileEvent; } 14 | } 15 | 16 | public int Number 17 | { 18 | get { return _tracefileEvent.Number; } 19 | } 20 | 21 | public OperationType OperationType 22 | { 23 | get { return _tracefileEvent.OperationType; } 24 | } 25 | 26 | public TracefileEventViewModel(TracefileEvent tracefileEvent) 27 | { 28 | _tracefileEvent = tracefileEvent; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsObjectTable/Views/ShaderView.xaml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Views/ColorView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.Views 17 | { 18 | /// 19 | /// Interaction logic for ColorView.xaml 20 | /// 21 | public partial class ColorView : UserControl 22 | { 23 | public ColorView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsObjectTable/Views/BufferView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Rasterizr.Studio.Modules.GraphicsObjectTable.Views 17 | { 18 | /// 19 | /// Interaction logic for BufferView.xaml 20 | /// 21 | public partial class BufferView : UserControl 22 | { 23 | public BufferView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsObjectTable/Views/ShaderView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Rasterizr.Studio.Modules.GraphicsObjectTable.Views 17 | { 18 | /// 19 | /// Interaction logic for ShaderView.xaml 20 | /// 21 | public partial class ShaderView : UserControl 22 | { 23 | public ShaderView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsDebugging/Views/TracefileEventView.xaml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsObjectTable/Views/Texture2DView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Rasterizr.Studio.Modules.GraphicsObjectTable.Views 17 | { 18 | /// 19 | /// Interaction logic for Texture2DView.xaml 20 | /// 21 | public partial class Texture2DView : UserControl 22 | { 23 | public Texture2DView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Rasterizr/ComparisonUtility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rasterizr 4 | { 5 | internal static class ComparisonUtility 6 | { 7 | public static bool DoComparison(Comparison func, float source, float dest) 8 | { 9 | switch (func) 10 | { 11 | case Comparison.Never: 12 | return false; 13 | case Comparison.Less: 14 | return (source < dest); 15 | case Comparison.Equal: 16 | return (source == dest); 17 | case Comparison.LessEqual: 18 | return (source <= dest); 19 | case Comparison.Greater: 20 | return (source > dest); 21 | case Comparison.NotEqual: 22 | return (source != dest); 23 | case Comparison.GreaterEqual: 24 | return (source >= dest); 25 | case Comparison.Always: 26 | return true; 27 | default: 28 | throw new ArgumentOutOfRangeException("func"); 29 | } 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsObjectTable/Views/BlendStateView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Rasterizr.Studio.Modules.GraphicsObjectTable.Views 17 | { 18 | /// 19 | /// Interaction logic for BlendStateView.xaml 20 | /// 21 | public partial class BlendStateView : UserControl 22 | { 23 | public BlendStateView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/ViewModels/SimplePixelHistoryEventViewModel.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Diagnostics; 2 | using Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels.PixelResults; 3 | 4 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels 5 | { 6 | public class SimplePixelHistoryEventViewModel : PixelHistoryEventViewModelBase 7 | { 8 | private readonly ColorResultViewModel _result; 9 | 10 | public override PixelResultViewModel Result 11 | { 12 | get { return _result; } 13 | } 14 | 15 | public ColorViewModel Color 16 | { 17 | get { return _result.Result;} 18 | } 19 | 20 | public SimplePixelHistoryEventViewModel(SimpleEvent @event) 21 | { 22 | _result = new ColorResultViewModel(@event.Result); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsDebugging/Views/TracefileEventView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Rasterizr.Studio.Modules.GraphicsDebugging.Views 17 | { 18 | /// 19 | /// Interaction logic for TracefileEventView.xaml 20 | /// 21 | public partial class TracefileEventView : UserControl 22 | { 23 | public TracefileEventView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit/Color4.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Toolkit 5 | { 6 | [StructLayout(LayoutKind.Sequential, Pack = 4)] 7 | public struct Color 8 | { 9 | public static readonly int SizeInBytes = sizeof(byte) * 4; 10 | 11 | public static Color Black 12 | { 13 | get { return new Color(0, 0, 0, 255); } 14 | } 15 | 16 | public static Color White 17 | { 18 | get { return new Color(255, 255, 255, 255); } 19 | } 20 | 21 | public byte R; 22 | public byte G; 23 | public byte B; 24 | public byte A; 25 | 26 | public Color(byte r, byte g, byte b, byte a) 27 | { 28 | R = r; 29 | G = g; 30 | B = b; 31 | A = a; 32 | } 33 | 34 | public Number4 ToNumber4() 35 | { 36 | return new Number4( 37 | R / 255.0f, 38 | G / 255.0f, 39 | B / 255.0f, 40 | A / 255.0f); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsObjectTable/Views/GraphicsObjectDocumentView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Rasterizr.Studio.Modules.GraphicsObjectTable.Views 17 | { 18 | /// 19 | /// Interaction logic for GraphicsObjectDocumentView.xaml 20 | /// 21 | public partial class GraphicsObjectDocumentView : UserControl 22 | { 23 | public GraphicsObjectDocumentView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPipelineStages/Views/GraphicsPipelineStagesView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Rasterizr.Studio.Modules.GraphicsPipelineStages.Views 17 | { 18 | /// 19 | /// Interaction logic for GraphicsPipelineStagesView.xaml 20 | /// 21 | public partial class GraphicsPipelineStagesView : UserControl 22 | { 23 | public GraphicsPipelineStagesView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Views/SimplePixelHistoryEventView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.Views 17 | { 18 | /// 19 | /// Interaction logic for SimplePixelHistoryEventView.xaml 20 | /// 21 | public partial class SimplePixelHistoryEventView : UserControl 22 | { 23 | public SimplePixelHistoryEventView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Rasterizr/Util/DiagnosticUtilities.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace Rasterizr.Util 5 | { 6 | internal static class DiagnosticUtilities 7 | { 8 | public static void RaiseEvent(object sender, DiagnosticEventHandler @event, params object[] arguments) 9 | { 10 | if (@event != null) 11 | @event(sender, new DiagnosticEventArgs(arguments)); 12 | } 13 | 14 | public static int GetID(DeviceChild deviceChild) 15 | { 16 | if (deviceChild == null) 17 | return -1; 18 | return deviceChild.ID; 19 | } 20 | 21 | public static int[] GetIDs(IEnumerable deviceChildren) 22 | { 23 | if (deviceChildren == null) 24 | return new int[0]; 25 | 26 | return deviceChildren.Select(GetID).ToArray(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Framework/Converters/ColorToBrushConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Data; 3 | using System.Windows.Media; 4 | using Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels; 5 | using Rasterizr.Toolkit; 6 | 7 | namespace Rasterizr.Studio.Framework.Converters 8 | { 9 | public class ColorToBrushConverter : IValueConverter 10 | { 11 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 12 | { 13 | if (value == null) 14 | return null; 15 | 16 | var color = ((ColorViewModel) value).Color.ToColor(); 17 | return new SolidColorBrush(System.Windows.Media.Color.FromArgb( 18 | color.A, color.R, color.G, color.B)); 19 | } 20 | 21 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 22 | { 23 | throw new NotImplementedException(); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsObjectTable/Views/BufferView.xaml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit/ProceduralTextures.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | 3 | namespace Rasterizr.Toolkit 4 | { 5 | public static class ProceduralTextures 6 | { 7 | public static Texture2D CreateCheckerboard(Device device, int width, int height) 8 | { 9 | var texture = device.CreateTexture2D(new Texture2DDescription 10 | { 11 | Width = width, 12 | Height = height, 13 | ArraySize = 1 14 | }); 15 | var data = new Color4[width * height]; 16 | bool black = false; 17 | for (int y = 0; y < height; y++) 18 | { 19 | for (int x = 0; x < width; x++) 20 | { 21 | data[(y * width) + x] = (black) ? new Color4(0, 0, 0, 1) : new Color4(1, 1, 1, 1); 22 | if (x % 8 == 0) 23 | black = !black; 24 | } 25 | if (y % 8 == 0) 26 | black = !black; 27 | } 28 | device.ImmediateContext.SetTextureData(texture, 0, data); 29 | return texture; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Rasterizr.Tests/Resources/BufferTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using Rasterizr.Resources; 3 | using SharpDX; 4 | using Utilities = Rasterizr.Util.Utilities; 5 | 6 | namespace Rasterizr.Tests.Resources 7 | { 8 | [TestFixture] 9 | public class BufferTests 10 | { 11 | [Test] 12 | public void CanSetAndGetMatrix() 13 | { 14 | // Arrange. 15 | var device = new Device(); 16 | var description = new BufferDescription 17 | { 18 | SizeInBytes = Utilities.SizeOf() 19 | }; 20 | var buffer = new Buffer(device, description); 21 | var matrix = Matrix.LookAtRH(new Vector3(1, 2, 3), Vector3.ForwardRH, Vector3.Up); 22 | 23 | // Act. 24 | device.ImmediateContext.SetBufferData(buffer, ref matrix); 25 | 26 | Matrix retrievedMatrix; 27 | buffer.GetData(out retrievedMatrix, 0, Utilities.SizeOf()); 28 | 29 | // Assert. 30 | Assert.That(retrievedMatrix, Is.EqualTo(matrix)); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Views/OutputMergerDrawPixelHistoryEventPartView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.Views 17 | { 18 | /// 19 | /// Interaction logic for OutputMergerDrawPixelHistoryEventPartView.xaml 20 | /// 21 | public partial class OutputMergerDrawPixelHistoryEventPartView : UserControl 22 | { 23 | public OutputMergerDrawPixelHistoryEventPartView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Views/VertexShaderDrawPixelHistoryEventPartView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.Views 17 | { 18 | /// 19 | /// Interaction logic for VertexShaderDrawPixelHistoryEventPartView.xaml 20 | /// 21 | public partial class VertexShaderDrawPixelHistoryEventPartView : UserControl 22 | { 23 | public VertexShaderDrawPixelHistoryEventPartView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/Startup/Module.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Composition; 4 | using Caliburn.Micro; 5 | using Gemini.Framework; 6 | using Rasterizr.Studio.Modules.GraphicsEventList.ViewModels; 7 | using Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels; 8 | using Rasterizr.Studio.Modules.SampleBrowser.ViewModels; 9 | 10 | namespace Rasterizr.Studio.Modules.Startup 11 | { 12 | [Export(typeof(IModule))] 13 | public class Module : ModuleBase 14 | { 15 | public override IEnumerable DefaultTools 16 | { 17 | get 18 | { 19 | yield return typeof(GraphicsEventListViewModel); 20 | yield return typeof(GraphicsPixelHistoryViewModel); 21 | } 22 | } 23 | 24 | public override void Initialize() 25 | { 26 | MainWindow.Title = "Rasterizr Studio"; 27 | Shell.OpenDocument(IoC.Get()); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit/VertexPositionColorTexture.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using Rasterizr.Pipeline.InputAssembler; 3 | using SharpDX; 4 | 5 | namespace Rasterizr.Toolkit 6 | { 7 | [StructLayout(LayoutKind.Sequential)] 8 | public struct VertexPositionColorTexture 9 | { 10 | public Vector3 Position; 11 | public Color4F Color; 12 | public Vector2 TextureCoordinate; 13 | 14 | public VertexPositionColorTexture(Vector3 position, Color4F color, Vector2 textureCoordinate) 15 | { 16 | Position = position; 17 | Color = color; 18 | TextureCoordinate = textureCoordinate; 19 | } 20 | 21 | public static InputElement[] InputElements 22 | { 23 | get 24 | { 25 | return new[] 26 | { 27 | new InputElement("POSITION", 0, Format.R32G32B32_Float, 0), 28 | new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 0), 29 | new InputElement("TEXCOORD", 0, Format.R32G32_Float, 0) 30 | }; 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /tools/MSBuild.Fxc/MSBuild.Fxc.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSBuild.Fxc", "MSBuild.Fxc.csproj", "{753B3C22-7DC1-4DB9-BE7B-DA534ACF3C5A}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {753B3C22-7DC1-4DB9-BE7B-DA534ACF3C5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {753B3C22-7DC1-4DB9-BE7B-DA534ACF3C5A}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {753B3C22-7DC1-4DB9-BE7B-DA534ACF3C5A}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {753B3C22-7DC1-4DB9-BE7B-DA534ACF3C5A}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsEventList/Design/DesignTimeGraphicsEventListViewModel.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Diagnostics; 2 | using Rasterizr.Diagnostics.Logging.ObjectModel; 3 | using Rasterizr.Studio.Modules.GraphicsDebugging.Design; 4 | using Rasterizr.Studio.Modules.GraphicsDebugging.ViewModels; 5 | using Rasterizr.Studio.Modules.GraphicsEventList.ViewModels; 6 | 7 | namespace Rasterizr.Studio.Modules.GraphicsEventList.Design 8 | { 9 | public class DesignTimeGraphicsEventListViewModel : GraphicsEventListViewModel 10 | { 11 | public DesignTimeGraphicsEventListViewModel() 12 | : base(new DesignTimeSelectionService()) 13 | { 14 | Events.Add(new TracefileEventViewModel(new TracefileEvent 15 | { 16 | Number = 1, 17 | OperationType = OperationType.InputAssemblerStageSetVertexBuffers 18 | })); 19 | Events.Add(new TracefileEventViewModel(new TracefileEvent 20 | { 21 | Number = 2, 22 | OperationType = OperationType.DeviceContextDraw 23 | })); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Views/InputAssemblerDrawPixelHistoryEventPartView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.Views 17 | { 18 | /// 19 | /// Interaction logic for InputAssemblerDrawPixelHistoryEventPartView.xaml 20 | /// 21 | public partial class InputAssemblerDrawPixelHistoryEventPartView : UserControl 22 | { 23 | public InputAssemblerDrawPixelHistoryEventPartView() 24 | { 25 | InitializeComponent(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/InputAssembler/InstancedVertexBufferIndex.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.InputAssembler 2 | { 3 | internal class InstancedVertexBufferIndex : VertexBufferIndex 4 | { 5 | private readonly int _stepRate; 6 | private int _steps; 7 | private int _index; 8 | 9 | public override InputClassification InputDataClass 10 | { 11 | get { return InputClassification.PerInstanceData; } 12 | } 13 | 14 | public InstancedVertexBufferIndex( 15 | int instanceDataStepRate, 16 | VertexBufferBinding binding, 17 | int startLocation) 18 | : base(binding, startLocation) 19 | { 20 | _stepRate = instanceDataStepRate; 21 | } 22 | 23 | protected override int GetNextIndex(InputClassification inputDataClass, int index) 24 | { 25 | if (_stepRate == 0 || inputDataClass == InputClassification.PerVertexData) 26 | return index; 27 | if (++_steps == _stepRate) 28 | { 29 | _steps = 0; 30 | _index++; 31 | } 32 | return _index; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/DepthStencilState.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.OutputMerger 2 | { 3 | public class DepthStencilState : DeviceChild 4 | { 5 | private readonly DepthStencilStateDescription _description; 6 | private readonly bool _isDepthEnabled; 7 | private readonly Comparison _depthComparison; 8 | 9 | public DepthStencilStateDescription Description 10 | { 11 | get { return _description; } 12 | } 13 | 14 | internal DepthStencilState(Device device, DepthStencilStateDescription description) 15 | : base(device) 16 | { 17 | _description = description; 18 | _isDepthEnabled = description.IsDepthEnabled; 19 | _depthComparison = description.DepthComparison; 20 | } 21 | 22 | internal bool DepthTestPasses(float newDepth, float currentDepth) 23 | { 24 | if (!_isDepthEnabled) 25 | return true; 26 | 27 | return ComparisonUtility.DoComparison( 28 | _depthComparison, 29 | newDepth, currentDepth); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Rasterizr/Util/ConversionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Rasterizr.Pipeline.InputAssembler; 3 | using SlimShader; 4 | 5 | namespace Rasterizr.Util 6 | { 7 | internal static class ConversionExtensions 8 | { 9 | public static PrimitiveTopology ToPrimitiveTopology(this SlimShader.Chunks.Common.PrimitiveTopology primitiveTopology) 10 | { 11 | switch (primitiveTopology) 12 | { 13 | case SlimShader.Chunks.Common.PrimitiveTopology.PointList: 14 | return PrimitiveTopology.PointList; 15 | case SlimShader.Chunks.Common.PrimitiveTopology.LineStrip: 16 | return PrimitiveTopology.LineStrip; 17 | case SlimShader.Chunks.Common.PrimitiveTopology.TriangleStrip: 18 | return PrimitiveTopology.TriangleStrip; 19 | default: 20 | throw new ArgumentOutOfRangeException("primitiveTopology"); 21 | } 22 | } 23 | 24 | public static Number4 ToNumber4(this Color4 color) 25 | { 26 | return new Number4(color.R, color.G, color.B, color.A); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/Rasterizr/Diagnostics/DrawEvent.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Pipeline.InputAssembler; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Diagnostics 5 | { 6 | public class DrawEvent : PixelEvent 7 | { 8 | public PrimitiveTopology PrimitiveTopology { get; set; } 9 | public DrawEventVertex[] Vertices { get; set; } 10 | public int PrimitiveID { get; set; } 11 | public int X { get; set; } 12 | public int Y { get; set; } 13 | public PixelExclusionReason ExclusionReason { get; set; } 14 | public Number4 Previous { get; set; } 15 | public Number4 PixelShader { get; set; } 16 | public Number4? Result { get; set; } 17 | } 18 | 19 | public class DrawEventVertex 20 | { 21 | public int VertexID { get; set; } 22 | public DrawEventVertexData[] PreVertexShaderData { get; set; } 23 | public DrawEventVertexData[] PostVertexShaderData { get; set; } 24 | } 25 | 26 | public class DrawEventVertexData 27 | { 28 | public string Semantic { get; set; } 29 | public string Value { get; set; } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/Rasterizer/Fragment.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Pipeline.VertexShader; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Pipeline.Rasterizer 5 | { 6 | internal struct Fragment 7 | { 8 | public VertexShaderOutput[] Vertices; 9 | public int PrimitiveID; 10 | public uint RenderTargetArrayIndex; 11 | public int X; 12 | public int Y; 13 | public FragmentQuadLocation QuadLocation; 14 | public bool IsInsideViewport; 15 | public Samples Samples; 16 | public Number4[] Data; 17 | 18 | public Fragment(VertexShaderOutput[] vertices, 19 | int primitiveID, uint renderTargetArrayIndex, 20 | int x, int y, 21 | FragmentQuadLocation quadLocation, 22 | bool isInsideViewport) 23 | { 24 | Vertices = vertices; 25 | PrimitiveID = primitiveID; 26 | RenderTargetArrayIndex = renderTargetArrayIndex; 27 | X = x; 28 | Y = y; 29 | QuadLocation = quadLocation; 30 | IsInsideViewport = isInsideViewport; 31 | Samples = new Samples(); 32 | Data = null; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/ShaderResourceView.Texture2DView.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | using SlimShader.VirtualMachine.Resources; 3 | 4 | namespace Rasterizr.Pipeline 5 | { 6 | public partial class ShaderResourceView 7 | { 8 | private class Texture2DView : InnerResourceView 9 | { 10 | private readonly Texture2D.Texture2DSubresource[] _subresources; 11 | 12 | public override int MipMapCount 13 | { 14 | get { return _subresources.Length; } 15 | } 16 | 17 | public Texture2DView(Texture2D resource, ShaderResourceViewDescription.Texture2DResource description) 18 | { 19 | _subresources = new Texture2D.Texture2DSubresource[description.MipLevels]; 20 | for (int i = description.MostDetailedMip; i < description.MostDetailedMip + description.MipLevels; i++) 21 | _subresources[i] = resource.GetSubresource(0, i); 22 | } 23 | 24 | public override ITextureMipMap GetMipMap(int arraySlice, int mipLevel) 25 | { 26 | return _subresources[mipLevel]; 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Rasterizr/Math/MathUtility.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Math 2 | { 3 | internal static class MathUtility 4 | { 5 | /// 6 | /// Clamps a value to an interval. 7 | /// 8 | /// The input parameter. 9 | /// The lower clamp threshold. 10 | /// The upper clamp threshold. 11 | /// The clamped value. 12 | public static int Clamp(int value, int min, int max) 13 | { 14 | value = (value > max) ? max : value; 15 | value = (value < min) ? min : value; 16 | return value; 17 | } 18 | 19 | public static int CeilingToInt(float f) 20 | { 21 | return (int) System.Math.Ceiling(f); 22 | } 23 | 24 | public static int FloorToInt(float f) 25 | { 26 | return (int) System.Math.Floor(f); 27 | } 28 | 29 | public static float Log2(float d) 30 | { 31 | return (float) System.Math.Log(d, 2.0f); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/Rasterizr/Resources/SamplerStateDescription.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Resources 2 | { 3 | public struct SamplerStateDescription 4 | { 5 | public static SamplerStateDescription Default 6 | { 7 | get 8 | { 9 | return new SamplerStateDescription 10 | { 11 | Filter = Filter.MinMagMipLinear, 12 | AddressU = TextureAddressMode.Clamp, 13 | AddressV = TextureAddressMode.Clamp, 14 | AddressW = TextureAddressMode.Clamp, 15 | MinimumLod = -float.MaxValue, 16 | MaximumLod = float.MaxValue, 17 | MipLodBias = 0.0f, 18 | MaximumAnisotropy = 16, 19 | ComparisonFunction = Comparison.Never, 20 | BorderColor = Color4.White 21 | }; 22 | } 23 | } 24 | 25 | public Filter Filter; 26 | public TextureAddressMode AddressU; 27 | public TextureAddressMode AddressV; 28 | public TextureAddressMode AddressW; 29 | public float MinimumLod; 30 | public float MaximumLod; 31 | public float MipLodBias; 32 | public int MaximumAnisotropy; 33 | public Comparison ComparisonFunction; 34 | public Color4 BorderColor; 35 | } 36 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Bootstrapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Caliburn.Micro; 3 | using Gemini; 4 | using Gemini.Modules.Shell.ViewModels; 5 | 6 | namespace Rasterizr.Studio 7 | { 8 | public class Bootstrapper : AppBootstrapper 9 | { 10 | protected override void Configure() 11 | { 12 | var defaultLocator = ViewLocator.LocateTypeForModelType; 13 | ViewLocator.LocateTypeForModelType = (modelType, displayLocation, context) => 14 | { 15 | var viewType = defaultLocator(modelType, displayLocation, context); 16 | while (viewType == null && modelType != typeof(object)) 17 | { 18 | modelType = modelType.BaseType; 19 | viewType = defaultLocator(modelType, displayLocation, context); 20 | } 21 | return viewType; 22 | }; 23 | 24 | base.Configure(); 25 | } 26 | } 27 | 28 | public class TestBootstrapper : Caliburn.Micro.Bootstrapper 29 | { 30 | 31 | } 32 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/FpsCounter.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Studio.Modules.SampleBrowser.Samples 2 | { 3 | internal class FpsCounter 4 | { 5 | private readonly SampleClock _clock; 6 | private float _lastElapsedTime; 7 | private float _frameAccumulator; 8 | private int _frameCount; 9 | 10 | public float FramesPerSecond { get; private set; } 11 | 12 | public FpsCounter(SampleClock clock) 13 | { 14 | _clock = clock; 15 | } 16 | 17 | public void Update() 18 | { 19 | var thisTime = _clock.TotalTime; 20 | var deltaTime = thisTime - _lastElapsedTime; 21 | _lastElapsedTime = thisTime; 22 | 23 | _frameAccumulator += deltaTime; 24 | ++_frameCount; 25 | if (_frameAccumulator >= 1.0f) 26 | { 27 | FramesPerSecond = _frameCount / _frameAccumulator; 28 | _frameAccumulator = 0.0f; 29 | _frameCount = 0; 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsObjectTable/Views/GraphicsObjectDocumentView.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/Rasterizr.Tests/Pipeline/OutputMerger/BlendStateTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using Rasterizr.Pipeline.OutputMerger; 3 | using SlimShader; 4 | 5 | namespace Rasterizr.Tests.Pipeline.OutputMerger 6 | { 7 | [TestFixture] 8 | public class BlendStateTests 9 | { 10 | [Test] 11 | public void AlphaBlendStateIsValid() 12 | { 13 | // Arrange. 14 | var device = new Device(); 15 | var blendState = new BlendState(device, BlendStateDescription.AlphaBlend); 16 | var source = new Number4(1.0f, 0.0f, 0.0f, 0.3f); 17 | var destination = new Number4(0.0f, 1.0f, 0.0f, 0.4f); 18 | var blendFactor = new Number4(); 19 | 20 | // Act. 21 | var result = blendState.DoBlend(0, 22 | ref source, ref destination, 23 | ref blendFactor); 24 | 25 | // Assert. 26 | Assert.That(result.R, Is.EqualTo(1.0f).Within(0.01f)); 27 | Assert.That(result.G, Is.EqualTo(0.7f).Within(0.01f)); 28 | Assert.That(result.B, Is.EqualTo(0.0f).Within(0.01f)); 29 | Assert.That(result.A, Is.EqualTo(0.3f + (1 - 0.3f) * 0.4f).Within(0.01f)); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Controls/PixelHistoryEventTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | using Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels; 6 | 7 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.Controls 8 | { 9 | public class PixelHistoryEventTemplateSelector : DataTemplateSelector 10 | { 11 | public DataTemplate SimpleEventTemplate { get; set; } 12 | public DataTemplate DrawEventTemplate { get; set; } 13 | 14 | public override DataTemplate SelectTemplate(object item, DependencyObject container) 15 | { 16 | var @event = (PixelHistoryEventViewModel) item; 17 | var subEvent = @event.PixelHistoryEvents.First(); 18 | 19 | if (subEvent is SimplePixelHistoryEventViewModel) 20 | return SimpleEventTemplate; 21 | if (subEvent is DrawPixelHistoryEventViewModel) 22 | return DrawEventTemplate; 23 | throw new ArgumentException(); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/RenderTargetView.Texture1DView.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Pipeline.OutputMerger 5 | { 6 | public partial class RenderTargetView 7 | { 8 | private class Texture1DView : InnerResourceView 9 | { 10 | private readonly Texture1D.Texture1DSubresource _subresource; 11 | 12 | public Texture1DView(Texture1D resource, RenderTargetViewDescription.Texture1DResource description) 13 | { 14 | _subresource = resource.GetSubresource(0, description.MipSlice); 15 | } 16 | 17 | public override Number4 GetData(uint arrayIndex, int x, int y, int sampleIndex) 18 | { 19 | return _subresource.GetData(x); 20 | } 21 | 22 | public override void SetData(uint arrayIndex, int x, int y, int sampleIndex, ref Number4 value) 23 | { 24 | _subresource.SetData(x, ref value); 25 | } 26 | 27 | public override void Clear(ref Number4 color) 28 | { 29 | _subresource.Clear(ref color); 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Module.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.Composition; 3 | using System.Linq; 4 | using Caliburn.Micro; 5 | using Gemini.Framework; 6 | using Gemini.Framework.Results; 7 | using Gemini.Modules.MainMenu.Models; 8 | using Rasterizr.Studio.Modules.SampleBrowser.ViewModels; 9 | using SlimShader.VirtualMachine; 10 | using SlimShader.VirtualMachine.Jitter; 11 | 12 | namespace Rasterizr.Studio.Modules.SampleBrowser 13 | { 14 | [Export(typeof(IModule))] 15 | public class Module : ModuleBase 16 | { 17 | public override void Initialize() 18 | { 19 | VirtualMachine.ShaderExecutor = new JitShaderExecutor(); 20 | 21 | var fileMenuItem = Shell.MainMenu.First(mi => mi.Name == "File"); 22 | fileMenuItem.Children.Insert(0, new MenuItem("Open Sample Browser", OpenSampleBrowser)); 23 | } 24 | 25 | private static IEnumerable OpenSampleBrowser() 26 | { 27 | yield return Show.Document(IoC.Get()); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/RenderTargetView.Texture2DView.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Pipeline.OutputMerger 5 | { 6 | public partial class RenderTargetView 7 | { 8 | private class Texture2DView : InnerResourceView 9 | { 10 | private readonly Texture2D.Texture2DSubresource _subresource; 11 | 12 | public Texture2DView(Texture2D resource, RenderTargetViewDescription.Texture2DResource description) 13 | { 14 | _subresource = resource.GetSubresource(0, description.MipSlice); 15 | } 16 | 17 | public override Number4 GetData(uint arrayIndex, int x, int y, int sampleIndex) 18 | { 19 | return _subresource.GetData(x, y); 20 | } 21 | 22 | public override void SetData(uint arrayIndex, int x, int y, int sampleIndex, ref Number4 value) 23 | { 24 | _subresource.SetData(x, y, ref value); 25 | } 26 | 27 | public override void Clear(ref Number4 color) 28 | { 29 | _subresource.Clear(ref color); 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/Rasterizer/Viewport.cs: -------------------------------------------------------------------------------- 1 | using SlimShader; 2 | 3 | namespace Rasterizr.Pipeline.Rasterizer 4 | { 5 | public struct Viewport 6 | { 7 | public int TopLeftX; 8 | public int TopLeftY; 9 | public int Width; 10 | public int Height; 11 | public float MinDepth; 12 | public float MaxDepth; 13 | 14 | public Viewport(int x, int y, int width, int height, float minZ, float maxZ) 15 | { 16 | TopLeftX = x; 17 | TopLeftY = y; 18 | Width = width; 19 | Height = height; 20 | MinDepth = minZ; 21 | MaxDepth = maxZ; 22 | } 23 | 24 | /// 25 | /// Converts from clip space to screen space. 26 | /// Formulae from http://msdn.microsoft.com/en-us/library/bb205126(v=vs.85).aspx 27 | /// 28 | public void MapClipSpaceToScreenSpace(ref Number4 position) 29 | { 30 | position.X = (position.X + 1) * Width * 0.5f + TopLeftX; 31 | position.Y = (1 - position.Y) * Height * 0.5f + TopLeftY; 32 | position.Z = MinDepth + position.Z * (MaxDepth - MinDepth); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/Rasterizr.Diagnostics.Logging/ObjectModel/Tracefile.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using Newtonsoft.Json; 4 | 5 | namespace Rasterizr.Diagnostics.Logging.ObjectModel 6 | { 7 | public class Tracefile 8 | { 9 | private static readonly JsonSerializerSettings SerializerSettings; 10 | 11 | static Tracefile() 12 | { 13 | SerializerSettings = new JsonSerializerSettings 14 | { 15 | ConstructorHandling = ConstructorHandling.Default, 16 | Formatting = Formatting.Indented, 17 | TypeNameHandling = TypeNameHandling.Auto 18 | }; 19 | } 20 | 21 | public List Frames { get; set; } 22 | 23 | public Tracefile() 24 | { 25 | Frames = new List(); 26 | } 27 | 28 | public static Tracefile FromTextReader(TextReader textReader) 29 | { 30 | return JsonConvert.DeserializeObject(textReader.ReadToEnd(), SerializerSettings); 31 | } 32 | 33 | public void Save(TextWriter textWriter) 34 | { 35 | textWriter.Write(JsonConvert.SerializeObject(this, SerializerSettings)); 36 | textWriter.Flush(); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsObjectTable/Views/GraphicsObjectTableView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | using System.Windows.Input; 3 | using Caliburn.Micro; 4 | using Gemini.Framework.Services; 5 | using Rasterizr.Studio.Modules.GraphicsObjectTable.ViewModels; 6 | 7 | namespace Rasterizr.Studio.Modules.GraphicsObjectTable.Views 8 | { 9 | public partial class GraphicsObjectTableView : UserControl 10 | { 11 | public GraphicsObjectTableView() 12 | { 13 | InitializeComponent(); 14 | } 15 | 16 | private void OnDataGridMouseDoubleClick(object sender, MouseButtonEventArgs e) 17 | { 18 | var grid = sender as DataGrid; 19 | if (grid != null && grid.SelectedItems != null && grid.SelectedItems.Count == 1) 20 | { 21 | var row = (DataGridRow) grid.ItemContainerGenerator.ContainerFromItem(grid.SelectedItem); 22 | var vm = (GraphicsObjectViewModel) row.DataContext; 23 | IoC.Get().OpenDocument(new GraphicsObjectDocumentViewModel(vm)); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Views/PixelResults/ColorResultView.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 15 | 16 | -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit/VertexPositionNormalTexture.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | using Rasterizr.Pipeline.InputAssembler; 3 | using SharpDX; 4 | 5 | namespace Rasterizr.Toolkit 6 | { 7 | [StructLayout(LayoutKind.Sequential)] 8 | public struct VertexPositionNormalTexture 9 | { 10 | public Vector3 Position; 11 | public Vector3 Normal; 12 | public Vector2 TextureCoordinate; 13 | 14 | public VertexPositionNormalTexture(Vector3 position, Vector3 normal, Vector2 textureCoordinate) 15 | { 16 | Position = position; 17 | Normal = normal; 18 | TextureCoordinate = textureCoordinate; 19 | } 20 | 21 | public static int SizeInBytes 22 | { 23 | get { return Vector3.SizeInBytes + Vector3.SizeInBytes + Vector2.SizeInBytes; } 24 | } 25 | 26 | public static InputElement[] InputElements 27 | { 28 | get 29 | { 30 | return new[] 31 | { 32 | new InputElement("POSITION", 0, Format.R32G32B32_Float, 0), 33 | new InputElement("NORMAL", 0, Format.R32G32B32_Float, 0), 34 | new InputElement("TEXCOORD", 0, Format.R32G32_Float, 0) 35 | }; 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/TracefileViewer/EditorProvider.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.Composition; 2 | using System.IO; 3 | using Gemini.Framework; 4 | using Gemini.Framework.Services; 5 | using Rasterizr.Diagnostics.Logging.ObjectModel; 6 | using Rasterizr.Studio.Modules.GraphicsDebugging; 7 | using Rasterizr.Studio.Modules.TracefileViewer.ViewModels; 8 | 9 | namespace Rasterizr.Studio.Modules.TracefileViewer 10 | { 11 | [Export(typeof(IEditorProvider))] 12 | public class EditorProvider : IEditorProvider 13 | { 14 | private readonly ISelectionService _selectionService; 15 | 16 | [ImportingConstructor] 17 | public EditorProvider(ISelectionService selectionService) 18 | { 19 | _selectionService = selectionService; 20 | } 21 | 22 | public bool Handles(string path) 23 | { 24 | return Path.GetExtension(path).ToLower() == ".rlog"; 25 | } 26 | 27 | public IDocument Create(string path) 28 | { 29 | using (var reader = new StreamReader(File.OpenRead(path))) 30 | { 31 | var tracefile = Tracefile.FromTextReader(reader); 32 | return new TracefileViewerViewModel(_selectionService, path, tracefile); 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/InputAssembler/IndexedVertexBufferIndex.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.InputAssembler 2 | { 3 | internal class IndexedVertexBufferIndex : VertexBufferIndex 4 | { 5 | private readonly IndexBufferBinding _indexBufferBinding; 6 | private readonly int _offset; 7 | 8 | public IndexedVertexBufferIndex( 9 | IndexBufferBinding indexBufferBinding, int startIndexLocation, 10 | VertexBufferBinding vertexBufferBinding, int startVertexLocation) 11 | : base(vertexBufferBinding, startVertexLocation) 12 | { 13 | _indexBufferBinding = indexBufferBinding; 14 | _offset = indexBufferBinding.Offset + (startIndexLocation * FormatHelper.SizeOfInBytes(indexBufferBinding.Format)); 15 | } 16 | 17 | protected override int GetIndex(int index) 18 | { 19 | if (_indexBufferBinding.Format == Format.R32_UInt) 20 | { 21 | var data = new uint[1]; 22 | _indexBufferBinding.Buffer.GetData(data, _offset + (index * 4), 4); 23 | return (int)data[0]; 24 | } 25 | else 26 | { 27 | var data = new ushort[1]; 28 | _indexBufferBinding.Buffer.GetData(data, _offset + (index * 2), 2); 29 | return data[0]; 30 | } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsObjectTable/ViewModels/BufferViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using Rasterizr.Resources; 4 | 5 | namespace Rasterizr.Studio.Modules.GraphicsObjectTable.ViewModels 6 | { 7 | public class BufferViewModel 8 | { 9 | private readonly Buffer _buffer; 10 | 11 | public IEnumerable Data 12 | { 13 | get { return _buffer.Data.Select((d, i) => new BufferDatumViewModel(i, d)); } 14 | } 15 | 16 | public BufferViewModel(Buffer buffer) 17 | { 18 | _buffer = buffer; 19 | } 20 | } 21 | 22 | public class BufferDatumViewModel 23 | { 24 | private readonly int _index; 25 | private readonly byte _value; 26 | 27 | public int Index 28 | { 29 | get { return _index; } 30 | } 31 | 32 | public string Value 33 | { 34 | get { return _value.ToString(); } 35 | } 36 | 37 | public BufferDatumViewModel(int index, byte value) 38 | { 39 | _index = index; 40 | _value = value; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/ModelLoading.fx: -------------------------------------------------------------------------------- 1 | struct VS_IN 2 | { 3 | float3 position : POSITION; 4 | float3 normal : NORMAL; 5 | float2 uv : TEXCOORD; 6 | }; 7 | 8 | struct PS_IN 9 | { 10 | float4 position : SV_POSITION; 11 | float3 normal : TEXCOORD0; 12 | float2 uv : TEXCOORD1; 13 | }; 14 | 15 | cbuffer VertexConstantData 16 | { 17 | float4x4 WorldViewProjection; 18 | float4x4 World; 19 | } 20 | 21 | cbuffer PixelConstantData 22 | { 23 | float4 LightDirection; 24 | } 25 | 26 | Texture2D DiffuseTexture; 27 | SamplerState DiffuseSampler; 28 | 29 | PS_IN VS(VS_IN input) 30 | { 31 | PS_IN output = (PS_IN) 0; 32 | 33 | output.position = mul(float4(input.position, 1), WorldViewProjection); 34 | output.normal = mul(input.normal, (float3x3) World); 35 | output.uv = input.uv; 36 | 37 | return output; 38 | } 39 | 40 | float4 PS(PS_IN input) : SV_Target 41 | { 42 | float3 L = LightDirection.xyz; 43 | float3 N = normalize(input.normal); 44 | 45 | float3 diffuseTex = DiffuseTexture.Sample(DiffuseSampler, input.uv).xyz; 46 | 47 | float3 diffuse = diffuseTex * saturate(dot(N, L)); 48 | 49 | return float4(diffuse, 1); 50 | } 51 | -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/DepthStencilView.Texture2DView.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Pipeline.OutputMerger 5 | { 6 | public partial class DepthStencilView 7 | { 8 | private class Texture2DView : InnerResourceView 9 | { 10 | private readonly Texture2D.Texture2DSubresource _subresource; 11 | 12 | public Texture2DView(Texture2D resource, DepthStencilViewDescription.Texture2DResource description) 13 | { 14 | _subresource = resource.GetSubresource(0, description.MipSlice); 15 | } 16 | 17 | public override float GetData(uint arrayIndex, int x, int y, int sampleIndex) 18 | { 19 | return _subresource.GetData(x, y).R; 20 | } 21 | 22 | public override void SetData(uint arrayIndex, int x, int y, int sampleIndex, float value) 23 | { 24 | var color = new Number4(value, 0, 0, 0); 25 | _subresource.SetData(x, y, ref color); 26 | } 27 | 28 | public override void Clear(float depth) 29 | { 30 | var color = new Number4(depth, 0, 0, 0); 31 | _subresource.Clear(ref color); 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.18213 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace Rasterizr.Studio.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/Rasterizer/Primitives/Vector3ForCulling.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.Rasterizer.Primitives 2 | { 3 | internal struct Vector3ForCulling 4 | { 5 | public float X; 6 | public float Y; 7 | public float Z; 8 | 9 | public Vector3ForCulling(float x, float y, float z) 10 | { 11 | X = x; 12 | Y = y; 13 | Z = z; 14 | } 15 | 16 | /// 17 | /// Converts the vector into a unit vector. 18 | /// 19 | public void Normalize() 20 | { 21 | var length = (float) System.Math.Sqrt((X * X) + (Y * Y) + (Z * Z)); 22 | var inv = 1.0f / length; 23 | X *= inv; 24 | Y *= inv; 25 | Z *= inv; 26 | } 27 | 28 | /// 29 | /// Calculates the cross-product, but only of the Z component, 30 | /// because that's all we need in order to do backface culling. 31 | /// 32 | public static float CrossZ(ref Vector3ForCulling left, ref Vector3ForCulling right) 33 | { 34 | return (left.X * right.Y) - (left.Y * right.X); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/TechDemos/Resources/TextureSampling/TextureSamplingView.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Themes/Generic.xaml: -------------------------------------------------------------------------------- 1 | 4 | 23 | 24 | 27 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsEventList/Views/GraphicsEventListView.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/DepthStencilView.Texture1DView.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Pipeline.OutputMerger 5 | { 6 | public partial class DepthStencilView 7 | { 8 | private class Texture1DView : InnerResourceView 9 | { 10 | private readonly Texture1D.Texture1DSubresource _subresource; 11 | 12 | public Texture1DView(Texture1D resource, DepthStencilViewDescription.Texture1DResource description) 13 | { 14 | _subresource = resource.GetSubresource(0, description.MipSlice); 15 | } 16 | 17 | public override float GetData(uint arrayIndex, int x, int y, int sampleIndex) 18 | { 19 | return _subresource.GetData(x).R; 20 | } 21 | 22 | public override void SetData(uint arrayIndex, int x, int y, int sampleIndex, float value) 23 | { 24 | var color = new Number4(value, 0, 0, 0); 25 | _subresource.SetData(x, ref color); 26 | } 27 | 28 | public override void Clear(float depth) 29 | { 30 | var color = new Number4(depth, 0, 0, 0); 31 | _subresource.Clear(ref color); 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /src/Rasterizr/SwapChain.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | 3 | namespace Rasterizr 4 | { 5 | public class SwapChain : DeviceChild 6 | { 7 | private readonly SwapChainDescription _description; 8 | private readonly ISwapChainPresenter _presenter; 9 | private readonly Texture2D _backBuffer; 10 | 11 | public SwapChainDescription Description 12 | { 13 | get { return _description; } 14 | } 15 | 16 | internal SwapChain(Device device, SwapChainDescription description, ISwapChainPresenter presenter) 17 | : base(device) 18 | { 19 | _description = description; 20 | 21 | presenter.Initialize(description.Width, description.Height); 22 | _presenter = presenter; 23 | 24 | _backBuffer = new Texture2D(device, new Texture2DDescription 25 | { 26 | Width = description.Width, 27 | Height = description.Height, 28 | MipLevels = 1, 29 | ArraySize = 1 30 | }); 31 | } 32 | 33 | public Texture2D GetBuffer(int index) 34 | { 35 | return _backBuffer; 36 | } 37 | 38 | internal void Present() 39 | { 40 | // TODO: Resolve multi-sampled back buffer. 41 | var resolvedColors = _backBuffer.GetData(0, 0); 42 | _presenter.Present(resolvedColors); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/RenderTargetView.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Pipeline.OutputMerger 5 | { 6 | public partial class RenderTargetView : ResourceView 7 | { 8 | private readonly RenderTargetViewDescription _description; 9 | private readonly InnerResourceView _innerView; 10 | 11 | public RenderTargetViewDescription Description 12 | { 13 | get { return _description; } 14 | } 15 | 16 | internal RenderTargetView(Device device, Resource resource, RenderTargetViewDescription? description) 17 | : base(device, resource) 18 | { 19 | _description = description.GetValueOrDefault(RenderTargetViewDescription.CreateDefault(resource)); 20 | _innerView = InnerResourceView.Create(resource, _description); 21 | } 22 | 23 | internal Number4 GetColor(uint arrayIndex, int x, int y, int sampleIndex) 24 | { 25 | return _innerView.GetData(arrayIndex, x, y, sampleIndex); 26 | } 27 | 28 | internal void SetColor(uint arrayIndex, int x, int y, int sampleIndex, ref Number4 color) 29 | { 30 | _innerView.SetData(arrayIndex, x, y, sampleIndex, ref color); 31 | } 32 | 33 | internal void Clear(ref Number4 color) 34 | { 35 | _innerView.Clear(ref color); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/InputAssembler/VertexBufferIndex.cs: -------------------------------------------------------------------------------- 1 | using SlimShader; 2 | 3 | namespace Rasterizr.Pipeline.InputAssembler 4 | { 5 | internal class VertexBufferIndex 6 | { 7 | private readonly VertexBufferBinding _binding; 8 | private readonly int _offset; 9 | private int _index; 10 | 11 | public virtual InputClassification InputDataClass 12 | { 13 | get { return InputClassification.PerVertexData; } 14 | } 15 | 16 | public VertexBufferIndex(VertexBufferBinding binding, int startLocation) 17 | { 18 | _binding = binding; 19 | _offset = binding.Offset + (startLocation * binding.Stride); 20 | } 21 | 22 | public void GetData(Number4[] dst, int dstOffset, int offset, int count) 23 | { 24 | _binding.Buffer.GetData(dstOffset, dst, _offset + (GetIndex(_index) * _binding.Stride) + offset, count); 25 | } 26 | 27 | protected virtual int GetIndex(int index) 28 | { 29 | return index; 30 | } 31 | 32 | public void Increment(InputClassification inputDataClass) 33 | { 34 | _index = GetNextIndex(inputDataClass, _index); 35 | } 36 | 37 | protected virtual int GetNextIndex(InputClassification inputDataClass, int index) 38 | { 39 | return index + 1; 40 | } 41 | 42 | public void Reset() 43 | { 44 | _index = 0; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/Rasterizr/Resources/TextureBase.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Util; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Resources 5 | { 6 | public abstract class TextureBase : Resource 7 | { 8 | internal abstract class TextureSubresource : ISubresource 9 | { 10 | internal readonly Number4[] Data; 11 | 12 | internal int Size 13 | { 14 | get { return Data.Length * Utilities.SizeOf(); } 15 | } 16 | 17 | protected TextureSubresource(int numElements) 18 | { 19 | Data = new Number4[numElements]; 20 | } 21 | 22 | public void Clear(ref Number4 value) 23 | { 24 | for (var i = 0; i < Data.Length; i++) 25 | Data[i] = value; 26 | } 27 | } 28 | 29 | internal static void CalculateArrayMipSlice(int subresource, int mipLevels, out int mipSlice, out int arraySlice) 30 | { 31 | mipSlice = subresource % mipLevels; 32 | arraySlice = (subresource - mipSlice) / mipLevels; 33 | } 34 | 35 | protected TextureBase(Device device) 36 | : base(device) 37 | { 38 | 39 | } 40 | 41 | public abstract Color4[] GetData(int subresource); 42 | 43 | internal abstract void SetData(int subresource, Color4[] data); 44 | internal abstract void GenerateMips(); 45 | } 46 | } -------------------------------------------------------------------------------- /src/Rasterizr.Tests/Resources/Texture1DTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using Rasterizr.Resources; 3 | 4 | namespace Rasterizr.Tests.Resources 5 | { 6 | [TestFixture] 7 | public class Texture1DTests 8 | { 9 | [Test] 10 | public void TextureHasCorrectNumberOfMipMapLevels() 11 | { 12 | // Arrange. 13 | var texture = new Texture1D(new Device(), new Texture1DDescription 14 | { 15 | Width = 32, 16 | ArraySize = 1 17 | }); 18 | int width, numberOfLevels; 19 | 20 | // Act. 21 | texture.GetDimensions(0, out width, out numberOfLevels); 22 | 23 | // Assert. 24 | Assert.That(width, Is.EqualTo(32)); 25 | Assert.That(numberOfLevels, Is.EqualTo(6)); 26 | } 27 | 28 | [TestCase(0, 64)] 29 | [TestCase(1, 32)] 30 | [TestCase(2, 16)] 31 | [TestCase(3, 8)] 32 | [TestCase(4, 4)] 33 | [TestCase(5, 2)] 34 | [TestCase(6, 1)] 35 | public void MipMapsHaveCorrectDimensions(int mipLevel, int expectedWidth) 36 | { 37 | // Arrange. 38 | var texture = new Texture1D(new Device(), new Texture1DDescription 39 | { 40 | Width = 64, 41 | ArraySize = 1 42 | }); 43 | 44 | // Act / Assert. 45 | int actualWidth; 46 | texture.GetDimensions(mipLevel, out actualWidth); 47 | Assert.That(actualWidth, Is.EqualTo(expectedWidth)); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/TracefileViewer/Views/TracefileViewerView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | using System.Windows.Input; 3 | using Rasterizr.Studio.Framework; 4 | using Rasterizr.Studio.Modules.TracefileViewer.ViewModels; 5 | 6 | namespace Rasterizr.Studio.Modules.TracefileViewer.Views 7 | { 8 | /// 9 | /// Interaction logic for TracefileView.xaml 10 | /// 11 | public partial class TracefileViewerView : UserControl 12 | { 13 | public TracefileViewerView() 14 | { 15 | InitializeComponent(); 16 | } 17 | 18 | private void OnFrameImageMouseMove(object sender, MouseEventArgs e) 19 | { 20 | var vm = (TracefileViewerViewModel) DataContext; 21 | var position = e.GetPosition(FrameImage); 22 | vm.HoverPixel = new Int32Point((int) position.X, (int) position.Y); 23 | } 24 | 25 | private void OnFrameImageMouseDown(object sender, MouseButtonEventArgs e) 26 | { 27 | var vm = (TracefileViewerViewModel)DataContext; 28 | var position = e.GetPosition(FrameImage); 29 | vm.SelectedPixel = new Int32Point((int)position.X, (int)position.Y); 30 | } 31 | 32 | private void OnFrameImageMouseLeave(object sender, MouseEventArgs e) 33 | { 34 | var vm = (TracefileViewerViewModel)DataContext; 35 | vm.HasHoverPixel = false; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Rasterizr.Platform.WindowsForms/WindowsFormsSwapChainPresenter.cs: -------------------------------------------------------------------------------- 1 | using System.Drawing; 2 | using System.Drawing.Imaging; 3 | using System.Windows.Forms; 4 | using SlimShader; 5 | using Point = System.Drawing.Point; 6 | 7 | namespace Rasterizr.Platform.WindowsForms 8 | { 9 | public class WindowsFormsSwapChainPresenter : ISwapChainPresenter 10 | { 11 | private readonly int _width, _height; 12 | private readonly Bitmap _bitmap; 13 | private readonly Graphics _graphics; 14 | 15 | public WindowsFormsSwapChainPresenter(Form window) 16 | { 17 | _width = window.ClientSize.Width; 18 | _height = window.ClientSize.Height; 19 | _bitmap = new Bitmap(_width, _height, PixelFormat.Format24bppRgb); 20 | _graphics = window.CreateGraphics(); 21 | } 22 | 23 | void ISwapChainPresenter.Initialize(int width, int height) { } 24 | 25 | void ISwapChainPresenter.Present(Number4[] colors) 26 | { 27 | // TODO: Convert Color4F[] to byte[] in R8G8B8A8 format. 28 | var bitmapData = _bitmap.LockBits(new Rectangle(0, 0, _width, _height), 29 | ImageLockMode.WriteOnly, _bitmap.PixelFormat); 30 | 31 | //Marshal.Copy(colors, 0, bitmapData.Scan0, _width * _height * 3); 32 | 33 | _bitmap.UnlockBits(bitmapData); 34 | 35 | _graphics.DrawImage(_bitmap, Point.Empty); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/SampleBrowser/Samples/ModelLoading/Car/car.mtl: -------------------------------------------------------------------------------- 1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware 2 | # File Created: 22.09.2009 21:19:11 3 | 4 | newmtl Material__25 5 | Ns 10.0000 6 | Ni 1.5000 7 | d 1.0000 8 | Tr 1.0000 9 | Tf 1.0000 1.0000 1.0000 10 | illum 2 11 | Ka 0.0000 0.0000 0.0000 12 | Kd 1.0000 1.0000 1.0000 13 | Ks 0.0000 0.0000 0.0000 14 | Ke 0.0000 0.0000 0.0000 15 | map_Ka C:\Users\RobyDX\Desktop\rendbmesh_3ds\images\body.bmp 16 | map_Kd C:\Users\RobyDX\Desktop\rendbmesh_3ds\images\body.bmp 17 | 18 | newmtl Material__26 19 | Ns 10.0000 20 | Ni 1.5000 21 | d 1.0000 22 | Tr 1.0000 23 | Tf 1.0000 1.0000 1.0000 24 | illum 2 25 | Ka 0.0000 0.0000 0.0000 26 | Kd 1.0000 1.0000 1.0000 27 | Ks 0.0000 0.0000 0.0000 28 | Ke 0.0000 0.0000 0.0000 29 | map_Ka C:\Users\RobyDX\Desktop\rendbmesh_3ds\images\turret.bmp 30 | map_Kd C:\Users\RobyDX\Desktop\rendbmesh_3ds\images\turret.bmp 31 | 32 | newmtl Material__27 33 | Ns 10.0000 34 | Ni 1.5000 35 | d 1.0000 36 | Tr 1.0000 37 | Tf 1.0000 1.0000 1.0000 38 | illum 2 39 | Ka 0.0000 0.0000 0.0000 40 | Kd 1.0000 1.0000 1.0000 41 | Ks 0.0000 0.0000 0.0000 42 | Ke 0.0000 0.0000 0.0000 43 | map_Ka C:\Users\RobyDX\Desktop\rendbmesh_3ds\images\wheel.bmp 44 | map_Kd C:\Users\RobyDX\Desktop\rendbmesh_3ds\images\wheel.bmp 45 | -------------------------------------------------------------------------------- /src/Rasterizr.Diagnostics.Logging/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Resources; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("Rasterizr.Diagnostics.Logging")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("Rasterizr.Diagnostics.Logging")] 14 | [assembly: AssemblyCopyright("Copyright © 2012")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: NeutralResourcesLanguage("en")] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Build and Revision Numbers 27 | // by using the '*' as shown below: 28 | // [assembly: AssemblyVersion("1.0.*")] 29 | [assembly: AssemblyVersion("1.0.0.0")] 30 | [assembly: AssemblyFileVersion("1.0.0.0")] 31 | 32 | [assembly: InternalsVisibleTo("Rasterizr.Studio")] -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Framework/Controls/WriteableBitmapImage.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Media; 4 | using System.Windows.Media.Imaging; 5 | 6 | namespace Rasterizr.Studio.Framework.Controls 7 | { 8 | public class WriteableBitmapImage : Image 9 | { 10 | #region Dependency properties 11 | 12 | public static readonly DependencyProperty WriteableBitmapProperty = DependencyProperty.Register("WriteableBitmap", typeof(WriteableBitmap), typeof(WriteableBitmapImage)); 13 | 14 | public WriteableBitmap WriteableBitmap 15 | { 16 | get { return (WriteableBitmap) GetValue(WriteableBitmapProperty); } 17 | set { SetValue(WriteableBitmapProperty, value); } 18 | } 19 | 20 | #endregion 21 | 22 | private Size _size; 23 | 24 | protected override Size MeasureOverride(Size constraint) 25 | { 26 | // Fill available space. 27 | return constraint; 28 | } 29 | 30 | protected override Size ArrangeOverride(Size arrangeSize) 31 | { 32 | // If size has changed, recreate bitmap. 33 | if (arrangeSize != _size) 34 | { 35 | WriteableBitmap = new WriteableBitmap( 36 | (int) arrangeSize.Width, (int) arrangeSize.Height, 37 | 96, 96, PixelFormats.Bgra32, null); 38 | Source = WriteableBitmap; 39 | _size = arrangeSize; 40 | } 41 | return arrangeSize; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/VertexShader/VertexShaderStage.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Rasterizr.Pipeline.InputAssembler; 3 | using SlimShader.Chunks.Xsgn; 4 | 5 | namespace Rasterizr.Pipeline.VertexShader 6 | { 7 | public class VertexShaderStage : CommonShaderStage 8 | { 9 | private int? _outputPositionRegister; 10 | 11 | public VertexShaderStage(Device device) 12 | : base(device) 13 | { 14 | 15 | } 16 | 17 | protected override void OnShaderChanged(VertexShader shader) 18 | { 19 | _outputPositionRegister = GetSystemValueRegister(Name.Position); 20 | base.OnShaderChanged(shader); 21 | } 22 | 23 | internal IEnumerable Execute(IEnumerable inputs) 24 | { 25 | SetShaderConstants(); 26 | 27 | foreach (var input in inputs) 28 | { 29 | SetShaderInputs(0, 0, input.Data); 30 | VirtualMachine.Execute(); 31 | var outputs = GetShaderOutputs(0); 32 | 33 | var result = new VertexShaderOutput 34 | { 35 | VertexID = input.VertexID, 36 | InstanceID = input.InstanceID, 37 | InputData = input.Data, 38 | OutputData = outputs 39 | }; 40 | if (_outputPositionRegister != null) 41 | result.Position = outputs[_outputPositionRegister.Value]; 42 | 43 | yield return result; 44 | } 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/Rasterizer/MultiSamplingUtility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Rasterizr.Math; 3 | 4 | namespace Rasterizr.Pipeline.Rasterizer 5 | { 6 | internal static class MultiSamplingUtility 7 | { 8 | public static Point GetSamplePosition(int multiSampleCount, int x, int y, int sampleIndex) 9 | { 10 | switch (multiSampleCount) 11 | { 12 | case 1: 13 | return new Point(x + 0.5f, y + 0.5f); 14 | case 2: 15 | switch (sampleIndex) 16 | { 17 | case 0: 18 | return new Point(x + 0.25f, y + 0.25f); 19 | case 1: 20 | return new Point(x + 0.75f, y + 0.75f); 21 | default: 22 | throw new InvalidOperationException(); 23 | } 24 | case 4: 25 | switch (sampleIndex) 26 | { 27 | case 0: 28 | return new Point(x + 0.31f, y + 0.11f); 29 | case 1: 30 | return new Point(x + 0.88f, y + 0.31f); 31 | case 2: 32 | return new Point(x + 0.68f, y + 0.88f); 33 | case 3: 34 | return new Point(x + 0.11f, y + 0.68f); 35 | default: 36 | throw new InvalidOperationException(); 37 | } 38 | default: 39 | throw new ArgumentOutOfRangeException("multiSampleCount"); 40 | } 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/ViewModels/VertexShaderDrawPixelHistoryEventPartViewModel.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Diagnostics; 2 | 3 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels 4 | { 5 | public class VertexShaderDrawPixelHistoryEventPartViewModel : DrawPixelHistoryEventPartViewModel 6 | { 7 | private readonly DrawEvent _event; 8 | 9 | public override string Name 10 | { 11 | get { return "Vertex Shader"; } 12 | } 13 | 14 | public DrawEventVertex[] Vertices 15 | { 16 | get { return _event.Vertices; } 17 | } 18 | 19 | public VertexShaderDrawPixelHistoryEventPartViewModel(DrawEvent @event) 20 | { 21 | _event = @event; 22 | } 23 | } 24 | 25 | public class InputAssemblerDrawPixelHistoryEventPartViewModel : DrawPixelHistoryEventPartViewModel 26 | { 27 | private readonly DrawEvent _event; 28 | 29 | public override string Name 30 | { 31 | get { return "Input Assembler"; } 32 | } 33 | 34 | public DrawEventVertex[] Vertices 35 | { 36 | get { return _event.Vertices; } 37 | } 38 | 39 | public InputAssemblerDrawPixelHistoryEventPartViewModel(DrawEvent @event) 40 | { 41 | _event = @event; 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit/Models/ModelMesh.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Pipeline; 2 | using Rasterizr.Pipeline.InputAssembler; 3 | using Rasterizr.Resources; 4 | using SlimShader.Chunks.Xsgn; 5 | using Buffer = Rasterizr.Resources.Buffer; 6 | 7 | namespace Rasterizr.Toolkit.Models 8 | { 9 | public class ModelMesh 10 | { 11 | public InputElement[] InputElements { get; set; } 12 | public InputLayout InputLayout { get; set; } 13 | public int VertexSize { get; set; } 14 | public Buffer VertexBuffer { get; set; } 15 | public Buffer IndexBuffer { get; set; } 16 | public int VertexCount { get; set; } 17 | public int IndexCount { get; set; } 18 | public int PrimitiveCount { get; set; } 19 | public PrimitiveTopology PrimitiveTopology { get; set; } 20 | public Texture2D DiffuseTexture { get; set; } 21 | public ShaderResourceView DiffuseTextureView { get; set; } 22 | 23 | public void AddTextureDiffuse(Device device, Texture2D texture) 24 | { 25 | DiffuseTexture = texture; 26 | DiffuseTextureView = device.CreateShaderResourceView(DiffuseTexture); 27 | } 28 | 29 | public void SetInputLayout(Device device, InputSignatureChunk inputSignature) 30 | { 31 | InputLayout = device.CreateInputLayout(InputElements, inputSignature); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/RenderTargetView.Texture1DArrayView.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Pipeline.OutputMerger 5 | { 6 | public partial class RenderTargetView 7 | { 8 | private class Texture1DArrayView : InnerResourceView 9 | { 10 | private readonly Texture1D.Texture1DSubresource[] _subresources; 11 | 12 | public Texture1DArrayView(Texture1D resource, RenderTargetViewDescription.Texture1DArrayResource description) 13 | { 14 | _subresources = new Texture1D.Texture1DSubresource[description.ArraySize]; 15 | for (int i = description.FirstArraySlice; i < description.FirstArraySlice + description.ArraySize; i++) 16 | _subresources[i] = resource.GetSubresource(i, description.MipSlice); 17 | } 18 | 19 | public override Number4 GetData(uint arrayIndex, int x, int y, int sampleIndex) 20 | { 21 | return _subresources[arrayIndex].GetData(x); 22 | } 23 | 24 | public override void SetData(uint arrayIndex, int x, int y, int sampleIndex, ref Number4 value) 25 | { 26 | _subresources[arrayIndex].SetData(x, ref value); 27 | } 28 | 29 | public override void Clear(ref Number4 color) 30 | { 31 | foreach (var subresource in _subresources) 32 | subresource.Clear(ref color); 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/RenderTargetView.Texture2DArrayView.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Pipeline.OutputMerger 5 | { 6 | public partial class RenderTargetView 7 | { 8 | private class Texture2DArrayView : InnerResourceView 9 | { 10 | private readonly Texture2D.Texture2DSubresource[] _subresources; 11 | 12 | public Texture2DArrayView(Texture2D resource, RenderTargetViewDescription.Texture2DArrayResource description) 13 | { 14 | _subresources = new Texture2D.Texture2DSubresource[description.ArraySize]; 15 | for (int i = description.FirstArraySlice; i < description.FirstArraySlice + description.ArraySize; i++) 16 | _subresources[i] = resource.GetSubresource(i, description.MipSlice); 17 | } 18 | 19 | public override Number4 GetData(uint arrayIndex, int x, int y, int sampleIndex) 20 | { 21 | return _subresources[arrayIndex].GetData(x, y); 22 | } 23 | 24 | public override void SetData(uint arrayIndex, int x, int y, int sampleIndex, ref Number4 value) 25 | { 26 | _subresources[arrayIndex].SetData(x, y, ref value); 27 | } 28 | 29 | public override void Clear(ref Number4 color) 30 | { 31 | foreach (var subresource in _subresources) 32 | subresource.Clear(ref color); 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /tools/MSBuild.Fxc/ShaderProfileInfo.cs: -------------------------------------------------------------------------------- 1 | namespace MSBuild.Fxc 2 | { 3 | using System; 4 | using System.Linq; 5 | 6 | internal class ShaderProfileInfo 7 | { 8 | public readonly string Name; 9 | public readonly string Prefix; 10 | public readonly string[] Versions; 11 | public readonly string DefaultVersion; 12 | 13 | public ShaderProfileInfo(string name, string prefix, params string[] versions) 14 | { 15 | if (name == null) throw new ArgumentNullException("name"); 16 | if (prefix == null) throw new ArgumentNullException("prefix"); 17 | //if (versions.Length < 1) 18 | Name = name; 19 | Prefix = prefix; 20 | Versions = versions; 21 | DefaultVersion = versions[0]; 22 | } 23 | 24 | public string BuildShaderProfileString(string overrideVersion, string filename) 25 | { 26 | var version = (!string.IsNullOrEmpty(overrideVersion)) 27 | ? Versions.FirstOrDefault(x => x == overrideVersion) 28 | : Versions.FirstOrDefault(filename.Contains); 29 | if (version == null) 30 | throw new Exception("No version found in '" + Name + "' for Profile '" + overrideVersion + "' and filename '" + filename + "'."); 31 | return string.Format("{0}_{1}", Prefix, version); 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/InputAssembler/InputElement.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.InputAssembler 2 | { 3 | public struct InputElement 4 | { 5 | public static int AppendAligned 6 | { 7 | get { return -1; } 8 | } 9 | 10 | public string SemanticName; 11 | public int SemanticIndex; 12 | public Format Format; 13 | public int InputSlot; 14 | public int AlignedByteOffset; 15 | public InputClassification InputSlotClass; 16 | public int InstanceDataStepRate; 17 | 18 | public InputElement(string semanticName, int semanticIndex, Format format, int inputSlot, int alignedByteOffset, 19 | InputClassification inputSlotClass, int instanceDataStepRate) 20 | { 21 | SemanticName = semanticName; 22 | SemanticIndex = semanticIndex; 23 | Format = format; 24 | InputSlot = inputSlot; 25 | AlignedByteOffset = alignedByteOffset; 26 | InputSlotClass = inputSlotClass; 27 | InstanceDataStepRate = instanceDataStepRate; 28 | } 29 | 30 | public InputElement(string semanticName, int semanticIndex, Format format, int inputSlot, int alignedByteOffset) 31 | : this(semanticName, semanticIndex, format, inputSlot, alignedByteOffset, InputClassification.PerVertexData, 0) 32 | { 33 | 34 | } 35 | 36 | public InputElement(string semanticName, int semanticIndex, Format format, int inputSlot) 37 | : this(semanticName, semanticIndex, format, inputSlot, AppendAligned) 38 | { 39 | 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/DepthStencilStateDescription.cs: -------------------------------------------------------------------------------- 1 | namespace Rasterizr.Pipeline.OutputMerger 2 | { 3 | public struct DepthStencilStateDescription 4 | { 5 | public static DepthStencilStateDescription Default 6 | { 7 | get { return new DepthStencilStateDescription(true, DepthWriteMask.All); } 8 | } 9 | 10 | public static DepthStencilStateDescription DepthRead 11 | { 12 | get { return new DepthStencilStateDescription(true, DepthWriteMask.Zero); } 13 | } 14 | 15 | public static DepthStencilStateDescription None 16 | { 17 | get { return new DepthStencilStateDescription(false, DepthWriteMask.Zero); } 18 | } 19 | 20 | public bool IsDepthEnabled; 21 | public DepthWriteMask DepthWriteMask; 22 | public Comparison DepthComparison; 23 | public bool IsStencilEnabled; 24 | public byte StencilReadMask; 25 | public byte StencilWriteMask; 26 | public DepthStencilOperationDescription FrontFace; 27 | public DepthStencilOperationDescription BackFace; 28 | 29 | public DepthStencilStateDescription(bool isDepthEnabled, DepthWriteMask depthWriteMask) 30 | { 31 | IsDepthEnabled = isDepthEnabled; 32 | DepthWriteMask = depthWriteMask; 33 | DepthComparison = Comparison.Less; 34 | IsStencilEnabled = false; 35 | StencilReadMask = 0; 36 | StencilWriteMask = 0; 37 | FrontFace = new DepthStencilOperationDescription(); 38 | BackFace = new DepthStencilOperationDescription(); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit/Models/ConversionExtensions.cs: -------------------------------------------------------------------------------- 1 | using SharpDX; 2 | 3 | namespace Rasterizr.Toolkit.Models 4 | { 5 | internal static class ConversionExtensions 6 | { 7 | public static Matrix ToMatrix(this Assimp.Matrix4x4 mat) 8 | { 9 | var m = new Matrix(); 10 | m.M11 = mat.A1; 11 | m.M12 = mat.A2; 12 | m.M13 = mat.A3; 13 | m.M14 = mat.A4; 14 | m.M21 = mat.B1; 15 | m.M22 = mat.B2; 16 | m.M23 = mat.B3; 17 | m.M24 = mat.B4; 18 | m.M31 = mat.C1; 19 | m.M32 = mat.C2; 20 | m.M33 = mat.C3; 21 | m.M34 = mat.C4; 22 | m.M41 = mat.D1; 23 | m.M42 = mat.D2; 24 | m.M43 = mat.D3; 25 | m.M44 = mat.D4; 26 | return m; 27 | } 28 | 29 | public static Vector3 ToVector3(this Assimp.Vector3D vec) 30 | { 31 | Vector3 v; 32 | v.X = vec.X; 33 | v.Y = vec.Y; 34 | v.Z = vec.Z; 35 | return v; 36 | } 37 | 38 | public static Color ToColor(this Assimp.Color4D color) 39 | { 40 | Color c; 41 | c.R = (byte) (color.R * 255); 42 | c.G = (byte) (color.G * 255); 43 | c.B = (byte) (color.B * 255); 44 | c.A = (byte) (color.A * 255); 45 | return c; 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /src/Rasterizr/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Resources; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("Rasterizr")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("Rasterizr")] 14 | [assembly: AssemblyCopyright("Copyright © 2012")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: NeutralResourcesLanguage("en")] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Build and Revision Numbers 27 | // by using the '*' as shown below: 28 | // [assembly: AssemblyVersion("1.0.*")] 29 | [assembly: AssemblyVersion("1.0.0.0")] 30 | [assembly: AssemblyFileVersion("1.0.0.0")] 31 | 32 | [assembly: InternalsVisibleTo("Rasterizr.Diagnostics.Logging")] 33 | [assembly: InternalsVisibleTo("Rasterizr.Platform.Wpf")] 34 | [assembly: InternalsVisibleTo("Rasterizr.Studio")] 35 | [assembly: InternalsVisibleTo("Rasterizr.Tests")] -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/Views/PixelHistoryResources.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 12 | 13 | 18 | 19 | 24 | 25 | 29 | -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/Rasterizer/Primitives/PrimitiveRasterizerFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Rasterizr.Pipeline.InputAssembler; 3 | 4 | namespace Rasterizr.Pipeline.Rasterizer.Primitives 5 | { 6 | internal static class PrimitiveRasterizerFactory 7 | { 8 | public static PrimitiveRasterizer CreateRasterizer( 9 | PrimitiveTopology primitiveTopology, 10 | RasterizerStateDescription rasterizerState, 11 | int multiSampleCount, 12 | ShaderOutputInputBindings outputInputBindings, 13 | ref Viewport viewport, 14 | Func fragmentQuadFilter) 15 | { 16 | switch (primitiveTopology) 17 | { 18 | case PrimitiveTopology.PointList: 19 | throw new NotImplementedException(); 20 | case PrimitiveTopology.LineList: 21 | case PrimitiveTopology.LineStrip: 22 | throw new NotImplementedException(); 23 | case PrimitiveTopology.TriangleList: 24 | case PrimitiveTopology.TriangleStrip: 25 | return new TriangleRasterizer( 26 | rasterizerState, multiSampleCount, 27 | outputInputBindings, ref viewport, 28 | fragmentQuadFilter); 29 | default: 30 | throw new ArgumentOutOfRangeException("primitiveTopology"); 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/RenderTargetView.Texture3DView.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Pipeline.OutputMerger 5 | { 6 | public partial class RenderTargetView 7 | { 8 | private class Texture3DView : InnerResourceView 9 | { 10 | private readonly Texture3D.Texture3DSubresource _subresource; 11 | private readonly int _firstDepthSlice; 12 | private readonly int _depthSliceCount; 13 | 14 | public Texture3DView(Texture3D resource, RenderTargetViewDescription.Texture3DResource description) 15 | { 16 | _subresource = resource.GetSubresource(description.MipSlice); 17 | _firstDepthSlice = description.FirstDepthSlice; 18 | _depthSliceCount = description.DepthSliceCount; 19 | } 20 | 21 | public override Number4 GetData(uint arrayIndex, int x, int y, int sampleIndex) 22 | { 23 | return _subresource.GetData(x, y, (int) (_firstDepthSlice + arrayIndex)); 24 | } 25 | 26 | public override void SetData(uint arrayIndex, int x, int y, int sampleIndex, ref Number4 value) 27 | { 28 | _subresource.SetData(x, y, (int) (_firstDepthSlice + arrayIndex), ref value); 29 | } 30 | 31 | public override void Clear(ref Number4 color) 32 | { 33 | // TODO 34 | //for (int i = _firstDepthSlice; i < _firstDepthSlice + _depthSliceCount; i++) 35 | // FormatHelper.Clear(subresource, format, ref color); 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/DepthStencilView.Texture1DArrayView.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Pipeline.OutputMerger 5 | { 6 | public partial class DepthStencilView 7 | { 8 | private class Texture1DArrayView : InnerResourceView 9 | { 10 | private readonly Texture1D.Texture1DSubresource[] _subresources; 11 | 12 | public Texture1DArrayView(Texture1D resource, DepthStencilViewDescription.Texture1DArrayResource description) 13 | { 14 | _subresources = new Texture1D.Texture1DSubresource[description.ArraySize]; 15 | for (int i = description.FirstArraySlice; i < description.FirstArraySlice + description.ArraySize; i++) 16 | _subresources[i] = resource.GetSubresource(i, description.MipSlice); 17 | } 18 | 19 | public override float GetData(uint arrayIndex, int x, int y, int sampleIndex) 20 | { 21 | return _subresources[arrayIndex].GetData(x).R; 22 | } 23 | 24 | public override void SetData(uint arrayIndex, int x, int y, int sampleIndex, float value) 25 | { 26 | var color = new Number4(value, 0, 0, 0); 27 | _subresources[arrayIndex].SetData(x, ref color); 28 | } 29 | 30 | public override void Clear(float depth) 31 | { 32 | var color = new Number4(depth, 0, 0, 0); 33 | foreach (var subresource in _subresources) 34 | subresource.Clear(ref color); 35 | } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/DepthStencilView.Texture2DArrayView.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Resources; 2 | using SlimShader; 3 | 4 | namespace Rasterizr.Pipeline.OutputMerger 5 | { 6 | public partial class DepthStencilView 7 | { 8 | private class Texture2DArrayView : InnerResourceView 9 | { 10 | private readonly Texture2D.Texture2DSubresource[] _subresources; 11 | 12 | public Texture2DArrayView(Texture2D resource, DepthStencilViewDescription.Texture2DArrayResource description) 13 | { 14 | _subresources = new Texture2D.Texture2DSubresource[description.ArraySize]; 15 | for (int i = description.FirstArraySlice; i < description.FirstArraySlice + description.ArraySize; i++) 16 | _subresources[i] = resource.GetSubresource(i, description.MipSlice); 17 | } 18 | 19 | public override float GetData(uint arrayIndex, int x, int y, int sampleIndex) 20 | { 21 | return _subresources[arrayIndex].GetData(x, y).R; 22 | } 23 | 24 | public override void SetData(uint arrayIndex, int x, int y, int sampleIndex, float value) 25 | { 26 | var color = new Number4(value, 0, 0, 0); 27 | _subresources[arrayIndex].SetData(x, y, ref color); 28 | } 29 | 30 | public override void Clear(float depth) 31 | { 32 | var color = new Number4(depth, 0, 0, 0); 33 | foreach (var subresource in _subresources) 34 | subresource.Clear(ref color); 35 | } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/Weavers/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Weavers")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Weavers")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("445f43e0-ff74-45dc-b38b-39ffe5e2d3ba")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/DepthStencilView.InnerResourceView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Rasterizr.Resources; 3 | 4 | namespace Rasterizr.Pipeline.OutputMerger 5 | { 6 | public partial class DepthStencilView 7 | { 8 | private abstract class InnerResourceView 9 | { 10 | public abstract float GetData(uint arrayIndex, int x, int y, int sampleIndex); 11 | public abstract void SetData(uint arrayIndex, int x, int y, int sampleIndex, float value); 12 | public abstract void Clear(float depth); 13 | 14 | public static InnerResourceView Create(Resource resource, DepthStencilViewDescription description) 15 | { 16 | switch (description.Dimension) 17 | { 18 | case DepthStencilViewDimension.Texture1D: 19 | return new Texture1DView((Texture1D) resource, description.Texture1D); 20 | case DepthStencilViewDimension.Texture1DArray: 21 | return new Texture1DArrayView((Texture1D) resource, description.Texture1DArray); 22 | case DepthStencilViewDimension.Texture2D: 23 | return new Texture2DView((Texture2D) resource, description.Texture2D); 24 | case DepthStencilViewDimension.Texture2DArray: 25 | return new Texture2DArrayView((Texture2D) resource, description.Texture2DArray); 26 | case DepthStencilViewDimension.Texture2DMultisampled: 27 | throw new NotImplementedException(); 28 | case DepthStencilViewDimension.Texture2DMultisampledArray: 29 | throw new NotImplementedException(); 30 | default: 31 | throw new ArgumentOutOfRangeException(); 32 | } 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/OutputMerger/DepthStencilView.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Rasterizr.Resources; 3 | 4 | namespace Rasterizr.Pipeline.OutputMerger 5 | { 6 | public partial class DepthStencilView : ResourceView 7 | { 8 | private readonly DepthStencilViewDescription _description; 9 | private readonly InnerResourceView _innerView; 10 | 11 | public DepthStencilViewDescription Description 12 | { 13 | get { return _description; } 14 | } 15 | 16 | internal DepthStencilView(Device device, Resource resource, DepthStencilViewDescription? description) 17 | : base(device, resource) 18 | { 19 | switch (resource.ResourceType) 20 | { 21 | case ResourceType.Buffer: 22 | throw new ArgumentException("Invalid resource type for depth stencil view: " + resource.ResourceType); 23 | } 24 | 25 | _description = description.GetValueOrDefault(DepthStencilViewDescription.CreateDefault(resource)); 26 | _innerView = InnerResourceView.Create(resource, _description); 27 | } 28 | 29 | internal float GetDepth(uint arrayIndex, int x, int y, int sampleIndex) 30 | { 31 | return _innerView.GetData(arrayIndex, x, y, sampleIndex); 32 | } 33 | 34 | internal void SetDepth(uint arrayIndex, int x, int y, int sampleIndex, float depth) 35 | { 36 | _innerView.SetData(arrayIndex, x, y, sampleIndex, depth); 37 | } 38 | 39 | internal void Clear(DepthStencilClearFlags clearFlags, float depth, byte stencil) 40 | { 41 | if (clearFlags.HasFlag(DepthStencilClearFlags.Depth)) 42 | _innerView.Clear(depth); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/Rasterizr/Resources/Buffer.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Util; 2 | 3 | namespace Rasterizr.Resources 4 | { 5 | public class Buffer : Resource 6 | { 7 | private readonly byte[] _data; 8 | 9 | internal override ResourceType ResourceType 10 | { 11 | get { return ResourceType.Buffer; } 12 | } 13 | 14 | internal override int Size 15 | { 16 | get { return _data.Length; } 17 | } 18 | 19 | internal byte[] Data 20 | { 21 | get { return _data; } 22 | } 23 | 24 | internal Buffer(Device device, BufferDescription description) 25 | : base(device) 26 | { 27 | _data = new byte[description.SizeInBytes]; 28 | } 29 | 30 | internal void GetData(int dataOffset, T[] data, int startIndex, int countInBytes) 31 | where T : struct 32 | { 33 | Utilities.FromByteArray(data, dataOffset, _data, startIndex, countInBytes); 34 | } 35 | 36 | internal void GetData(T[] data, int startIndex, int countInBytes) 37 | where T : struct 38 | { 39 | GetData(0, data, startIndex, countInBytes); 40 | } 41 | 42 | internal void GetData(out T data, int startIndex, int countInBytes) 43 | where T : struct 44 | { 45 | Utilities.FromByteArray(out data, _data, startIndex, countInBytes); 46 | } 47 | 48 | internal void GetData(T[] data) 49 | where T : struct 50 | { 51 | GetData(data, 0, _data.Length * Utilities.SizeOf()); 52 | } 53 | 54 | internal void SetData(byte[] data, int offsetInBytes = 0) 55 | { 56 | Utilities.ToByteArray(data, _data, offsetInBytes); 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /src/Rasterizr.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Rasterizr.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Rasterizr.Tests")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("46a8847a-09f6-4997-9ce4-f60b511b85bc")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPipelineStages/Views/GraphicsPipelineStagesView.xaml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsObjectTable/Views/InputLayoutView.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/Rasterizr.Diagnostics.Logging/ObjectModel/TracefileEventArgumentCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.Linq; 5 | 6 | namespace Rasterizr.Diagnostics.Logging.ObjectModel 7 | { 8 | public class TracefileEventArgumentCollection : Collection 9 | { 10 | public TracefileEventArgumentCollection(IList list) 11 | : base(list) 12 | { 13 | 14 | } 15 | 16 | public TracefileEventArgumentCollection() 17 | { 18 | 19 | } 20 | 21 | public T Get(int index) 22 | { 23 | var type = typeof(T); 24 | if (this[index] == null) 25 | return default(T); 26 | 27 | if (this[index].GetType() != type) 28 | { 29 | if (type.IsEnum) 30 | type = typeof(int); 31 | return (T) Convert.ChangeType(this[index], type); 32 | } 33 | return (T) this[index]; 34 | } 35 | 36 | public T Get(Device device, int index) 37 | where T : DeviceChild 38 | { 39 | var id = Get(index); 40 | return GetDeviceChild(device, id); 41 | } 42 | 43 | public T[] GetArray(Device device, int index) 44 | where T : DeviceChild 45 | { 46 | var ids = Get(index); 47 | return ids.Select(x => GetDeviceChild(device, x)).ToArray(); 48 | } 49 | 50 | private static T GetDeviceChild(Device device, int id) 51 | where T : DeviceChild 52 | { 53 | if (id == -1) 54 | return null; 55 | return device.GetDeviceChild(id); 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /src/Rasterizr.Platform.Wpf/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Rasterizr.Platform.Wpf")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Rasterizr.Platform.Wpf")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("8b0089bc-80fe-4658-ba2a-d6f33a71d4e5")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Rasterizr.Toolkit.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Rasterizr.Toolkit.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Rasterizr.Toolkit.Tests")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("3b9ab444-2c40-4f18-abc2-26706dc4c4eb")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsDebugging/Module.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel.Composition; 3 | using System.Linq; 4 | using Caliburn.Micro; 5 | using Gemini.Framework; 6 | using Gemini.Framework.Results; 7 | using Gemini.Modules.MainMenu.Models; 8 | using Rasterizr.Studio.Modules.GraphicsEventList.ViewModels; 9 | using Rasterizr.Studio.Modules.GraphicsObjectTable.ViewModels; 10 | using Rasterizr.Studio.Modules.GraphicsPipelineStages.ViewModels; 11 | using Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels; 12 | 13 | namespace Rasterizr.Studio.Modules.GraphicsDebugging 14 | { 15 | [Export(typeof(IModule))] 16 | public class Module : ModuleBase 17 | { 18 | public override void Initialize() 19 | { 20 | var viewMenuItem = Shell.MainMenu.First(mi => mi.Name == "View"); 21 | var graphicsMenuItem = new MenuItem("Graphics"); 22 | viewMenuItem.Children.Add(graphicsMenuItem); 23 | viewMenuItem.Children.Add(new MenuItemSeparator()); 24 | 25 | graphicsMenuItem.Add(new MenuItem("Graphics Event List", OpenTool)); 26 | graphicsMenuItem.Add(new MenuItem("Graphics Pixel History", OpenTool)); 27 | graphicsMenuItem.Add(new MenuItem("Graphics Pipeline Stages", OpenTool)); 28 | graphicsMenuItem.Add(new MenuItem("Graphics Object Table", OpenTool)); 29 | } 30 | 31 | private static IEnumerable OpenTool() 32 | where TTool : Tool 33 | { 34 | yield return Show.Tool(IoC.Get()); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/ViewModels/OutputMergerDrawPixelHistoryEventPartViewModel.cs: -------------------------------------------------------------------------------- 1 | using Rasterizr.Diagnostics; 2 | using Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels.PixelResults; 3 | 4 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels 5 | { 6 | public class OutputMergerDrawPixelHistoryEventPartViewModel : DrawPixelHistoryEventPartViewModel 7 | { 8 | private readonly DrawEvent _event; 9 | 10 | public override string Name 11 | { 12 | get { return "Output Merger"; } 13 | } 14 | 15 | public PixelExclusionReason ExclusionReason 16 | { 17 | get { return _event.ExclusionReason; } 18 | } 19 | 20 | public ColorViewModel Previous 21 | { 22 | get { return new ColorViewModel(_event.Previous); } 23 | } 24 | 25 | public ColorViewModel PixelShader 26 | { 27 | get { return new ColorViewModel(_event.PixelShader); } 28 | } 29 | 30 | public PixelResultViewModel Result 31 | { 32 | get { return PixelResultViewModel.Create(_event); } 33 | } 34 | 35 | public ColorViewModel FinalColor 36 | { 37 | get 38 | { 39 | if (_event.Result == null) 40 | return null; 41 | return new ColorViewModel(_event.Result.Value); 42 | } 43 | } 44 | 45 | public OutputMergerDrawPixelHistoryEventPartViewModel(DrawEvent @event) 46 | { 47 | _event = @event; 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /src/Rasterizr.Platform.WindowsForms/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Rasterizr.Platform.WindowsForms")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Rasterizr.Platform.WindowsForms")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a7ed6639-e109-43c4-98ee-2362dee1e24e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/ViewModels/DrawPixelHistoryEventViewModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Rasterizr.Diagnostics; 3 | using Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels.PixelResults; 4 | 5 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels 6 | { 7 | public class DrawPixelHistoryEventViewModel : PixelHistoryEventViewModelBase 8 | { 9 | private readonly List _parts; 10 | private readonly DrawEvent _event; 11 | 12 | public string Name 13 | { 14 | get { return string.Format("Triangle {0}", _event.PrimitiveID); } 15 | } 16 | 17 | public override PixelResultViewModel Result 18 | { 19 | get { return PixelResultViewModel.Create(_event); } 20 | } 21 | 22 | public PixelExclusionReason ExclusionReason 23 | { 24 | get { return _event.ExclusionReason; } 25 | } 26 | 27 | public IEnumerable Parts 28 | { 29 | get { return _parts; } 30 | } 31 | 32 | public DrawPixelHistoryEventViewModel(DrawEvent @event) 33 | { 34 | _parts = new List 35 | { 36 | new InputAssemblerDrawPixelHistoryEventPartViewModel(@event), 37 | new VertexShaderDrawPixelHistoryEventPartViewModel(@event), 38 | new OutputMergerDrawPixelHistoryEventPartViewModel(@event) 39 | }; 40 | _event = @event; 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/Rasterizr.Studio/Modules/GraphicsPixelHistory/ViewModels/PixelHistoryEventViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Rasterizr.Diagnostics; 5 | using Rasterizr.Diagnostics.Logging.ObjectModel; 6 | using Rasterizr.Studio.Modules.GraphicsDebugging.ViewModels; 7 | using Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels.PixelResults; 8 | 9 | namespace Rasterizr.Studio.Modules.GraphicsPixelHistory.ViewModels 10 | { 11 | public class PixelHistoryEventViewModel : TracefileEventViewModel 12 | { 13 | private readonly List _pixelHistoryEvents; 14 | private readonly PixelResultViewModel _result; 15 | 16 | public PixelResultViewModel Result 17 | { 18 | get { return _result; } 19 | } 20 | 21 | public IEnumerable PixelHistoryEvents 22 | { 23 | get { return _pixelHistoryEvents; } 24 | } 25 | 26 | public PixelHistoryEventViewModel(TracefileEvent tracefileEvent) 27 | : base(tracefileEvent) 28 | { 29 | _pixelHistoryEvents = tracefileEvent.PixelEvents.Select(x => 30 | { 31 | if (x is SimpleEvent) 32 | return new SimplePixelHistoryEventViewModel((SimpleEvent) x); 33 | if (x is DrawEvent) 34 | return new DrawPixelHistoryEventViewModel((DrawEvent) x); 35 | throw new ArgumentOutOfRangeException(); 36 | }).ToList(); 37 | 38 | _result = (_pixelHistoryEvents.LastOrDefault(x => x.Result is ColorResultViewModel) ?? _pixelHistoryEvents.Last()).Result; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/Rasterizr/Pipeline/Rasterizer/RasterizerStateDescription.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.Contracts; 2 | 3 | namespace Rasterizr.Pipeline.Rasterizer 4 | { 5 | public struct RasterizerStateDescription 6 | { 7 | public static RasterizerStateDescription Default 8 | { 9 | get 10 | { 11 | return new RasterizerStateDescription 12 | { 13 | FillMode = FillMode.Solid, 14 | CullMode = CullMode.Back, 15 | IsFrontCounterClockwise = false, 16 | DepthBias = 0, 17 | SlopeScaledDepthBias = 0.0f, 18 | DepthBiasClamp = 0.0f, 19 | IsDepthClipEnabled = true, 20 | IsScissorEnabled = false, 21 | IsMultisampleEnabled = false, 22 | IsAntialiasedLineEnabled = false 23 | }; 24 | } 25 | } 26 | 27 | public FillMode FillMode; 28 | public CullMode CullMode; 29 | public bool IsFrontCounterClockwise; 30 | public int DepthBias; 31 | public float SlopeScaledDepthBias; 32 | public float DepthBiasClamp; 33 | public bool IsDepthClipEnabled; 34 | public bool IsScissorEnabled; 35 | public bool IsMultisampleEnabled; 36 | public bool IsAntialiasedLineEnabled; 37 | 38 | [Pure] 39 | internal bool ShouldCull(bool counterClockwise) 40 | { 41 | // If triangle is CW, then cull if: 42 | // (a) front faces are CW and we should cull front faces. 43 | // (b) front faces are CCW and we should cull back faces. 44 | return (IsFrontCounterClockwise == counterClockwise && CullMode == CullMode.Front) 45 | || (IsFrontCounterClockwise != counterClockwise && CullMode == CullMode.Back); 46 | } 47 | } 48 | } --------------------------------------------------------------------------------