public CDomainShader(ICDevice device, CShaderReflection reflection) : base(device, reflection) { glShadersToGeometry = new TightConcurrentDictionary<TesselationLayout, TesselationEvaluationShader>(TesselationLayout.Equal); glShadersToPixel = new TightConcurrentDictionary<TesselationLayout, TesselationEvaluationShader>(TesselationLayout.Equal); domain = Reflection.GetTesselationDomain(); }
public CGeometryShader(ICDevice device, CShaderReflection reflection) : base(device, reflection) { maxVertexCount = Reflection.GetMaxVertexCount(); inputPrimitiveType = Reflection.GetGeometryInputPrimitiveType(); outputPrimitiveType = Reflection.GetGeometryOutputPrimitiveType(); }
private CTextureSurface(ICDevice device, ResourceDimension dimension, Texture2DDescription description, SubresourceData[] initialData, Action<CTextureSurface> onRelease) : base(device, dimension, description, t => onRelease((CTextureSurface)t)) { CreateNative(); if (initialData != null) throw new NotSupportedException("Initial newData is not supported for render target and depth-stencil resources by D3D9 implementation of Beholder"); }
public CHullShader(ICDevice device, CShaderReflection reflection) : base(device, reflection) { domain = reflection.GetTesselationDomain(); partitioning = reflection.GetTesselationPartitioning(); outputTopology = reflection.GetTesselationOutputTopology(); outputControlPoints = reflection.GetOutputControlPoints(); maxTesselationFactor = reflection.GetMaxTesselationFactor(); }
// IICDeviceBrowserDelegate Interface public void DidAddDevice(ICDeviceBrowser browser, ICDevice device, bool moreComing) { Console.WriteLine($"{nameof (DidAddDevice)}: {device}"); if (device.Type.HasFlag(ICDeviceType.Scanner)) { WillChangeValue("Scanners"); Scanners.Add(device); DidChangeValue("Scanners"); device.Delegate = this; } }
protected CTexture(ICDevice device, ResourceDimension dimension, Texture2DDescription description, Action<CTexture> onDispose) { this.device = device; this.dimension = dimension; this.desc = description; this.onDispose = onDispose; if (desc.BindFlags.HasFlag(BindFlags.RenderTarget)) rtvs = new List<CRenderTargetView>(); if (desc.BindFlags.HasFlag(BindFlags.DepthStencil)) dsvs = new List<CDepthStencilView>(); if (desc.BindFlags.HasFlag(BindFlags.ShaderResource)) srvs = new List<CShaderResourceView>(); }
public CTextureSurface(ICDevice device, Texture1DDescription description, SubresourceData[] initialData, Action<CTextureSurface> onRelease) : this(device, ResourceDimension.Texture1D, new Texture2DDescription { Width = description.Width, Height = 1, MipLevels = description.MipLevels, ArraySize = description.ArraySize, FormatID = description.FormatID, Sampling = Sampling.NoMultisampling, Usage = description.Usage, BindFlags = description.BindFlags, ExtraFlags = description.ExtraFlags, MiscFlags = description.MiscFlags }, initialData, onRelease) { }
public CPixelShader(ICDevice device, CShaderReflection reflection) : base(device, reflection) { profile = ParseProfile(reflection.Profile); var text = GenerateText(); try { var bytecode = ShaderBytecode.Compile(text, "main", ProfileToString(profile), ShaderFlags.PackMatrixColumnMajor | ShaderFlags.OptimizationLevel3); d3dShader = new PixelShader(device.D3DDevice, bytecode); bytecode.Dispose(); } catch (Exception e) { throw new ArgumentException(string.Format("Failed to compile a pixel shader '{0}'\r\n--- Code ---\r\n{1}\r\n--- Errors ---\r\n{2}", Name, text, e.Message), e); } }
public CPixelShader(ICDevice device, CShaderReflection reflection) : base(device, reflection) { Profile = ParseProfile(Reflection.Profile); var text = GenerateText<CPixelShader>(WriteIOAndCode); CompilationResult bytecode; try { bytecode = ShaderBytecode.Compile(text, "main", ProfileToString(Profile), ShaderFlags.PackMatrixColumnMajor | ShaderFlags.OptimizationLevel3, EffectFlags.None, Name); } catch (Exception e) { throw new ArgumentException(string.Format("Failed to compile a pixel shader '{0}'\r\n--- Code ---\r\n{1}\r\n--- Errors ---\r\n{2}", Name, text, e.Message), e); } D3DPixelShader = new PixelShader(device.D3DDevice, bytecode); }
public CVertexShader(ICDevice device, CShaderReflection reflection) : base(device, reflection) { Profile = ParseProfile(Reflection.Profile); var text = GenerateText<CVertexShader>(WriteIOAndCode); try { Bytecode = ShaderBytecode.Compile(text, "main", ProfileToString(Profile), ShaderFlags.PackMatrixColumnMajor | ShaderFlags.OptimizationLevel3, EffectFlags.None, Name); } catch (Exception e) { throw new ArgumentException(string.Format("Failed to compile a vertex shader '{0}'\r\n--- Code ---\r\n{1}\r\n--- Errors ---\r\n{2}", Name, text, e.Message), e); } D3DVertexShader = new VertexShader(device.D3DDevice, Bytecode); D3DInputElementsDraft = CreateVertexElementsDraft(reflection); }
public SwapChainSurfaces(ICDevice device, int width, int height, ref SwapChainDescription implicitSwapChainDescription) { this.device = device; var glContext = device.GetCurrentContext(); texture2DDescription = new Texture2DDescription { ArraySize = 1, ExtraFlags = ExtraFlags.None, Usage = Usage.Default, MipLevels = 1, MiscFlags = MiscFlags.None }; OnReset(glContext, width, height, ref implicitSwapChainDescription); }
public CGeometryShader(ICDevice device, CShaderReflection reflection) : base(device, reflection) { Profile = ParseProfile(reflection.Profile); MaxVertexCount = reflection.GetMaxVertexCount(); InputPrimitiveType = reflection.GetGeometryInputPrimitiveType(); OutputPrimitiveType = reflection.GetGeometryOutputPrimitiveType(); var text = GenerateText<CGeometryShader>(WriteIOAndCode); CompilationResult bytecode; try { bytecode = ShaderBytecode.Compile(text, "main", ProfileToString(Profile), ShaderFlags.PackMatrixColumnMajor | ShaderFlags.OptimizationLevel3, EffectFlags.None, Name); } catch (Exception e) { throw new ArgumentException(string.Format("Failed to compile a geometry shader '{0}'\r\n--- Code ---\r\n{1}\r\n--- Errors ---\r\n{2}", Name, text, e.Message), e); } D3DGeometryShader = new GeometryShader(device.D3DDevice, bytecode); }
public void DidReceiveStatusInformation(ICDevice device, NSDictionary <NSString, NSObject> status) { Console.WriteLine($"{nameof (DidReceiveStatusInformation)}: {device} Status: {status}"); var state = status[ICStatusNotificationKeys.NotificationKey] as NSString; if (state == ICScannerStatus.WarmingUp) { ProgressIndicator.IsDisplayedWhenStopped = true; ProgressIndicator.Indeterminate = true; ProgressIndicator.StartAnimation(null); StatusText.StringValue = status[ICStatusNotificationKeys.LocalizedNotificationKey] as NSString; } else if (state == ICScannerStatus.WarmUpDone) { StatusText.StringValue = string.Empty; ProgressIndicator.StopAnimation(null); ProgressIndicator.Indeterminate = false; ProgressIndicator.IsDisplayedWhenStopped = false; } }
public CHullShader(ICDevice device, CShaderReflection reflection) : base(device, reflection) { Profile = ParseProfile(reflection.Profile); Domain = reflection.GetTesselationDomain(); Partitioning = reflection.GetTesselationPartitioning(); OutputTopology = reflection.GetTesselationOutputTopology(); InputControlPoints = reflection.GetInputControlPoints(); OutputControlPoints = reflection.GetOutputControlPoints(); MaxTesselationFactor = reflection.GetMaxTesselationFactor(); var text = GenerateText<CHullShader>(WriteIOAndCode); CompilationResult bytecode; try { bytecode = ShaderBytecode.Compile(text, "main", ProfileToString(Profile), ShaderFlags.PackMatrixColumnMajor | ShaderFlags.OptimizationLevel3, EffectFlags.None, Name); } catch (Exception e) { throw new ArgumentException(string.Format("Failed to compile a hull shader '{0}'\r\n--- Code ---\r\n{1}\r\n--- Errors ---\r\n{2}", Name, text, e.Message), e); } D3DHullShader = new HullShader(device.D3DDevice, bytecode); }
public void DeviceDidChangeSharingState(ICDeviceBrowser browser, ICDevice device) => Console.WriteLine($"{nameof (DeviceDidChangeSharingState)}: {device}");
public void RequestsSelectDevice(ICDeviceBrowser browser, ICDevice device) => Console.WriteLine($"{nameof (RequestsSelectDevice)}: {device}");
public CTextureSurface(ICDevice device, Texture2DDescription description, SubresourceData[] initialData, Action<CTextureSurface> onRelease) : this(device, ResourceDimension.Texture2D, description, initialData, onRelease) { }
public void DidRemoveDevice(ICDeviceBrowser browser, ICDevice device, bool moreGoing) { Console.WriteLine($"{nameof (DidRemoveDevice)}: {device}"); ScannersController.RemoveObject(device); }
public void DidEncounterError(ICDevice device, NSError error) => Console.WriteLine($"{nameof (DidEncounterError)}: {device} Error: {error}");
public void DidReceiveButtonPress(ICDevice device, string buttonType) => Console.WriteLine($"{nameof (DidReceiveButtonPress)}: {device} Button: {buttonType}");
public void DidChangeName(ICDevice device) => Console.WriteLine($"{nameof (DidChangeName)}: {device}");
public CPixelShader(ICDevice device, CShaderReflection reflection) : base(device, reflection) { }
public void DidCloseSession(ICDevice device, NSError error) => Console.WriteLine($"{nameof (DidCloseSession)}: {device} Error: {error}");
public void DidBecomeReady(ICDevice device) { var scanner = device as ICScannerDevice; var availabeTypes = scanner.AvailableFunctionalUnitTypes; var functionalUnit = scanner.SelectedFunctionalUnit; Console.WriteLine($"{nameof (DidBecomeReady)}: {scanner}"); FunctionalUnitMenu.RemoveAllItems(); FunctionalUnitMenu.Enabled = false; if (availabeTypes.Length > 0) { var menu = new NSMenu(); FunctionalUnitMenu.Enabled = true; foreach (var item in availabeTypes) { NSMenuItem menuItem; switch ((ICScannerFunctionalUnitType)item.Int32Value) { case ICScannerFunctionalUnitType.Flatbed: menuItem = new NSMenuItem("Flatbed", "", SelectFunctionalUnit) { Tag = (nint)(long)ICScannerFunctionalUnitType.Flatbed }; menu.AddItem(menuItem); break; case ICScannerFunctionalUnitType.PositiveTransparency: menuItem = new NSMenuItem("PositiveTransparency", "", SelectFunctionalUnit) { Tag = (nint)(long)ICScannerFunctionalUnitType.PositiveTransparency }; menu.AddItem(menuItem); break; case ICScannerFunctionalUnitType.NegativeTransparency: menuItem = new NSMenuItem("NegativeTransparency", "", SelectFunctionalUnit) { Tag = (nint)(long)ICScannerFunctionalUnitType.NegativeTransparency }; menu.AddItem(menuItem); break; case ICScannerFunctionalUnitType.DocumentFeeder: menuItem = new NSMenuItem("DocumentFeeder", "", SelectFunctionalUnit) { Tag = (nint)(long)ICScannerFunctionalUnitType.DocumentFeeder }; menu.AddItem(menuItem); break; } } FunctionalUnitMenu.Menu = menu; } Console.WriteLine($"observeValueForKeyPath - functionalUnit: {functionalUnit}"); if (functionalUnit != null) { FunctionalUnitMenu.SelectItemWithTag((nint)(long)functionalUnit.Type); } }
// IICDeviceBrowser Interface public void DidRemoveDevice(ICDevice device) { Console.WriteLine($"{nameof (DidRemoveDevice)}: {device}"); ScannersController.RemoveObject(device); }
public CComputeShader(ICDevice device, CShaderReflection reflection) : base(device, reflection) { }
public CVertexShader(ICDevice device, CShaderReflection reflection) : base(device, reflection) { attributeNames = Reflection.Input.Where(v => v.IsUsed && !v.IsSystem).Select(v => OutputPrefixForStage(ShaderStage.Vertex) + v.Semantic).ToArray(); }