public static extern InteropBool ShaderManager_CreateInputLayout( IntPtr failReason, DeviceHandle deviceHandle, ShaderHandle vertexShaderHandle, InputElementDesc[] inputElementDescArr, uint inputElementDescArrLen, IntPtr outInputLayoutPtr // InputLayoutHandle* );
internal unsafe Shader(ShaderType typeKey, string fileName, IShaderResourceBinding[] resourceBindings) { if (fileName == null) { throw new ArgumentNullException("fileName"); } if (resourceBindings == null) { throw new ArgumentNullException("resourceBindings"); } string filePath = Path.Combine(LosgapSystem.InstallationDirectory.FullName, fileName); if (!IOUtils.IsValidFilePath(filePath)) { throw new ArgumentException("Invalid shader file path: " + filePath, "fileName"); } ShaderHandle handle; InteropUtils.CallNative(NativeMethods.ShaderManager_LoadShader, RenderingModule.Device, filePath, typeKey, (IntPtr)(&handle) ).ThrowOnFailure(); Handle = handle; this.typeKey = typeKey; Name = Path.GetFileNameWithoutExtension(fileName); try { if (resourceBindings.Any(bind => bind == null)) { throw new ArgumentNullException("One or more provided shader resource bindings were null.", null as Exception); } ResourceBindings = resourceBindings; ConstantBufferBindings = ResourceBindings .OfType <ConstantBufferBinding>() .ToArray(); TextureSamplerBindings = ResourceBindings .OfType <TextureSamplerBinding>() .ToArray(); ResourceViewBindings = ResourceBindings .OfType <ResourceViewBinding>() .ToArray(); NumConstantBufferSlots = ConstantBufferBindings.Any() ? ConstantBufferBindings.Max(bind => bind.SlotIndex) + 1U : 0U; NumTextureSamplerSlots = TextureSamplerBindings.Any() ? TextureSamplerBindings.Max(bind => bind.SlotIndex) + 1U : 0U; NumResourceViewSlots = ResourceViewBindings.Any() ? ResourceViewBindings.Max(bind => bind.SlotIndex) + 1U : 0U; ResourceBindings.ForEach(res => bindingIdentMap.Add(res.Identifier, res)); TestForBindingClashes(); } catch { Dispose(); throw; } }
public static extern InteropBool ShaderManager_UnloadShader( IntPtr failReason, ShaderHandle shaderHandle, ShaderType type );