public bool Init(ERHIType type, CRenderSystemDesc desc) { mRHIType = type; if (mCoreObject.Pointer != IntPtr.Zero) { return(false); } unsafe { mCoreObject = SDK_CreateRenderSystem(type, &desc); } return(true); }
public bool GfxInitEngine(ERHIType type, UInt32 Adapter, IntPtr window, bool createDebugLayer = false) { mCoreObject = SDK_GfxEngine_NewObject(); CRenderSystemDesc desc; desc.CreateDebugLayer = vBOOL.FromBoolean(createDebugLayer); desc.WindowHandle = window; if (false == RenderSystem.Init(type, desc)) { return(false); } var deviceNum = RenderSystem.GetContextNumber(); if (Adapter >= deviceNum) { return(false); } var deviceDesc = RenderSystem.GetContextDesc(Adapter); var devName = deviceDesc.DeviceNameString; mRenderContext = RenderSystem.CreateRenderContext(Adapter, window, createDebugLayer); if (mRenderContext == null) { return(false); } Profiler.Log.WriteLine(Profiler.ELogTag.Info, "Graphics", $"GPU MaxShaderModel = {mRenderContext.DeviceShaderModel}"); if (CRenderContext.ShaderModel > mRenderContext.DeviceShaderModel) { Profiler.Log.WriteLine(Profiler.ELogTag.Info, "Graphics", $"GPU不能提供选择的ShaderModel,将自动降低: {CRenderContext.ShaderModel}到{mRenderContext.DeviceShaderModel}"); CRenderContext.ShaderModel = mRenderContext.DeviceShaderModel; } mDesc.RHIType = type; SDK_GfxEngine_Init(mCoreObject, type, RenderSystem.CoreObject, RenderContext.CoreObject, FileManager.ProjectContent, FileManager.EngineContent, FileManager.EditorContent); mDefaultLayoutDesc = new CInputLayoutDesc(); return(true); }
public extern static vBOOL SDK_GfxEngine_Init(NativePointer self, ERHIType type, CRenderSystem.NativePointer rs, CRenderContext.NativePointer rc, string contentPath, string enginePath, string editorPath);
public extern static unsafe NativePointer SDK_CreateRenderSystem(ERHIType type, CRenderSystemDesc *desc);