internal static unsafe void InitSubsystemsOnce() { InitializeBlendStates(); InitializeRasterizerStates(); SamplerStates.InitOnce(); MyTextures.InitOnce(); }
internal static void UpdateRenderSettings(MyRenderSettings1 settings) { Log.WriteLine("UpdateRenderSettings"); Log.IncreaseIndent(); var prevSettings = m_renderSettings; m_renderSettings = settings; LogUpdateRenderSettings(ref settings); MyRenderConstants.SwitchRenderQuality(settings.Dx9Quality); //because of lod ranges MyRenderProxy.Settings.EnableCameraInterpolation = settings.InterpolationEnabled; MyRenderProxy.Settings.EnableObjectInterpolation = settings.InterpolationEnabled; MyRenderProxy.Settings.GrassDensityFactor = settings.GrassDensityFactor; if (settings.GrassDensityFactor == 0.0f) { m_renderSettings.FoliageDetails = MyFoliageDetails.DISABLED; } MyRenderProxy.Settings.VoxelQuality = settings.VoxelQuality; // if(settings.GrassDensityFactor != prevSettings.GrassDensityFactor) // MyRenderProxy.ReloadGrass(); if (settings.ShadowQuality != prevSettings.ShadowQuality) { ResetShadows(MyRenderProxy.Settings.ShadowCascadeCount, settings.ShadowQuality.ShadowCascadeResolution()); } if (settings.AntialiasingMode != prevSettings.AntialiasingMode) { UpdateAntialiasingMode(settings.AntialiasingMode, prevSettings.AntialiasingMode); } if (settings.AnisotropicFiltering != prevSettings.AnisotropicFiltering) { SamplerStates.UpdateFiltering(); } if (settings.TextureQuality != prevSettings.TextureQuality) { //MyTextureManager.UnloadTextures(); MyVoxelMaterials1.InvalidateMaterials(); MyMeshMaterials1.InvalidateMaterials(); MyTextures.ReloadQualityDependantTextures(); //MyVoxelMaterials.ReloadTextures(); //MyMaterialProxyFactory.ReloadTextures(); } m_settingsChangedListeners(); Log.DecreaseIndent(); }
internal static unsafe void InitSubsystems() { MyRwTextures.Init(); MyHwBuffers.Init(); MyPipelineStates.Init(); ResetShadows(MyRenderProxy.Settings.ShadowCascadeCount, RenderSettings.ShadowQuality.ShadowCascadeResolution()); MyRender11.Init(); MyCommon.Init(); SamplerStates.Init(); MyDepthStencilState.Init(); MyTextures.Init(); MyVertexLayouts.Init(); MyShaders.Init(); MyMeshes.Init(); MyMeshTableSRV.Init(); MyLightRendering.Init(); MyLinesRenderer.Init(); MySpritesRenderer.Init(); MyPrimitivesRenderer.Init(); MyOutline.Init(); MyBlur.Init(); MyTransparentRendering.Init(); MyFoliageComponents.Init(); MyBillboardRenderer.Init(); // hardcoded limits MyDebugRenderer.Init(); MyScreenDecals.Init(); MyEnvProbeProcessing.Init(); MyAtmosphereRenderer.Init(); MyCloudRenderer.Init(); MyAAEdgeMarking.Init(); MyScreenPass.Init(); MyCopyToRT.Init(); MyBlendTargets.Init(); MyFXAA.Init(); MyDepthResolve.Init(); MyBloom.Init(); MyLuminanceAverage.Init(); MyToneMapping.Init(); MySSAO.Init(); MyPlanetBlur.Init(); MyHdrDebugTools.Init(); MySceneMaterials.Init(); MyMaterials1.Init(); MyVoxelMaterials1.Init(); MyMeshMaterials1.Init(); }
internal static void OnDeviceReset() { MyRenderContext.OnDeviceReset(); MyRenderContextPool.OnDeviceReset(); MyHwBuffers.OnDeviceReset(); MyShaders.OnDeviceReset(); MyMaterialShaders.OnDeviceReset(); MyPipelineStates.OnDeviceReset(); MyTextures.OnDeviceReset(); MyRwTextures.OnDeviceReset(); SamplerStates.OnDeviceReset(); MyTransparentRendering.OnDeviceReset(); ResetShadows(Settings.ShadowCascadeCount, RenderSettings.ShadowQuality.ShadowCascadeResolution()); MyBillboardRenderer.OnDeviceRestart(); MyScreenDecals.OnDeviceReset(); MyMeshMaterials1.OnDeviceReset(); MyVoxelMaterials1.OnDeviceReset(); MyRenderableComponent.MarkAllDirty(); foreach (var f in MyComponentFactory <MyFoliageComponent> .GetAll()) { f.Dispose(); } foreach (var c in MyComponentFactory <MyGroupRootComponent> .GetAll()) { c.OnDeviceReset(); } MyBigMeshTable.Table.OnDeviceReset(); MySceneMaterials.OnDeviceReset(); MyMeshes.OnDeviceReset(); MyInstancing.OnDeviceReset(); MyScreenDecals.OnDeviceReset(); }
internal static void UpdateRenderSettings(MyRenderSettings1 settings) { Log.WriteLine("UpdateRenderSettings"); Log.IncreaseIndent(); var prevSettings = m_renderSettings; m_renderSettings = settings; LogUpdateRenderSettings(ref settings); MyRenderConstants.SwitchRenderQuality(settings.Dx9Quality); //because of lod ranges MyRenderProxy.Settings.EnableCameraInterpolation = settings.InterpolationEnabled; MyRenderProxy.Settings.EnableObjectInterpolation = settings.InterpolationEnabled; MyRenderProxy.Settings.GrassDensityFactor = settings.GrassDensityFactor; if (settings.GrassDensityFactor == 0.0f) { m_renderSettings.FoliageDetails = MyFoliageDetails.DISABLED; } MyRenderProxy.Settings.VoxelQuality = settings.VoxelQuality; // if(settings.GrassDensityFactor != prevSettings.GrassDensityFactor) // MyRenderProxy.ReloadGrass(); if (settings.ShadowQuality != prevSettings.ShadowQuality) { ResetShadows(MyRenderProxy.Settings.ShadowCascadeCount, settings.ShadowQuality.ShadowCascadeResolution()); } if (settings.AntialiasingMode != prevSettings.AntialiasingMode) { var defineList = new List <ShaderMacro>(); if (RenderSettings.AntialiasingMode != MyAntialiasingMode.NONE) { defineList.Add(ShaderMultisamplingDefine()); } if (DebugMode) { defineList.Add(MyShadersDefines.DebugMacro); } GlobalShaderMacro = defineList.ToArray(); MyShaders.Recompile(); MyMaterialShaders.Recompile(); MyRenderableComponent.MarkAllDirty(); if (settings.AntialiasingMode.SamplesCount() != prevSettings.AntialiasingMode.SamplesCount()) { CreateScreenResources(); } } if (settings.AnisotropicFiltering != prevSettings.AnisotropicFiltering) { SamplerStates.UpdateFiltering(); } if (settings.TextureQuality != prevSettings.TextureQuality) { //MyTextureManager.UnloadTextures(); MyVoxelMaterials1.InvalidateMaterials(); MyMeshMaterials1.InvalidateMaterials(); MyTextures.ReloadQualityDependantTextures(); //MyVoxelMaterials.ReloadTextures(); //MyMaterialProxyFactory.ReloadTextures(); } m_settingsChangedListeners(); Log.DecreaseIndent(); }
internal static unsafe void InitSubsystems() { MyRwTextures.Init(); MyHwBuffers.Init(); MyPipelineStates.Init(); ResetShadows(MyRenderProxy.Settings.ShadowCascadeCount, RenderSettings.ShadowQuality.ShadowCascadeResolution()); MyRender11.Init(); MyCommon.Init(); SamplerStates.Init(); MyDepthStencilState.Init(); MyTextures.Init(); MyVertexLayouts.Init(); MyShaders.Init(); MyMeshes.Init(); MyMeshTableSRV.Init(); MyLightRendering.Init(); MyLinesRenderer.Init(); MySpritesRenderer.Init(); MyPrimitivesRenderer.Init(); MyOutline.Init(); MyBlur.Init(); MyTransparentRendering.Init(); MyFoliageComponents.Init(); MyBillboardRenderer.Init(); // hardcoded limits MyDebugRenderer.Init(); MyScreenDecals.Init(); MyEnvProbeProcessing.Init(); MyAtmosphereRenderer.Init(); MyCloudRenderer.Init(); MyAAEdgeMarking.Init(); MyScreenPass.Init(); MyCopyToRT.Init(); MyBlendTargets.Init(); MyFXAA.Init(); MyDepthResolve.Init(); MyBloom.Init(); MyLuminanceAverage.Init(); MyToneMapping.Init(); MySSAO.Init(); MyPlanetBlur.Init(); MyHdrDebugTools.Init(); MySceneMaterials.Init(); MyMaterials1.Init(); MyVoxelMaterials1.Init(); MyMeshMaterials1.Init(); try { if (m_settings.UseStereoRendering) { var openVR = new MyOpenVR(); MyStereoStencilMask.InitUsingOpenVR(); } } catch (System.Exception e) { if (!VRage.MyCompilationSymbols.DX11ForceStereo) { throw; } MyStereoStencilMask.InitUsingUndefinedMask(); } }