internal GraphicsDeviceFeatures(Direct3D11.Device device) { mapFeaturesPerFormat = new FeaturesPerFormat[256]; // Check global features Level = device.FeatureLevel; HasComputeShaders = device.CheckFeatureSupport(Feature.ComputeShaders); HasDoublePrecision = device.CheckFeatureSupport(Feature.ShaderDoubles); device.CheckThreadingSupport(out HasMultiThreadingConcurrentResources, out this.HasDriverCommandLists); // Check features for each DXGI.Format foreach (var format in Enum.GetValues(typeof(DXGI.Format))) { var dxgiFormat = (DXGI.Format)format; var maximumMSAA = MSAALevel.None; var computeShaderFormatSupport = ComputeShaderFormatSupport.None; var formatSupport = FormatSupport.None; if (!ObsoleteFormatToExcludes.Contains(dxgiFormat)) { maximumMSAA = GetMaximumMSAASampleCount(device, dxgiFormat); if (HasComputeShaders) { computeShaderFormatSupport = device.CheckComputeShaderFormatSupport(dxgiFormat); } formatSupport = device.CheckFormatSupport(dxgiFormat); } mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat(dxgiFormat, maximumMSAA, computeShaderFormatSupport, formatSupport); } }
internal GraphicsDeviceFeatures(Direct3D11.Device device) { mapFeaturesPerFormat = new FeaturesPerFormat[256]; // Check global features Level = device.FeatureLevel; HasComputeShaders = device.CheckFeatureSupport(Feature.ComputeShaders); HasDoublePrecision = device.CheckFeatureSupport(Feature.ShaderDoubles); device.CheckThreadingSupport(out HasMultiThreadingConcurrentResources, out this.HasDriverCommandLists); // Check features for each DXGI.Format foreach (var format in Enum.GetValues(typeof(DXGI.Format))) { var dxgiFormat = (DXGI.Format) format; var maximumMSAA = MSAALevel.None; var computeShaderFormatSupport = ComputeShaderFormatSupport.None; var formatSupport = FormatSupport.None; if (!ObsoleteFormatToExcludes.Contains(dxgiFormat)) { maximumMSAA = GetMaximumMSAASampleCount(device, dxgiFormat); if (HasComputeShaders) computeShaderFormatSupport = device.CheckComputeShaderFormatSupport(dxgiFormat); formatSupport = device.CheckFormatSupport(dxgiFormat); } mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat(dxgiFormat, maximumMSAA, computeShaderFormatSupport, formatSupport); } }
private void EnumerateMSAASupportPerFormat(GraphicsDevice deviceRoot) { // Query OpenGL for the highest supported multisample count: int globalMaxMSAASamples; GL.GetInteger(GL_MAX_SAMPLES, out globalMaxMSAASamples); // Now select the highest engine-supported multisample mode: // TODO: Adjust comment. MultisampleCount actualMultisampleCount = MultisampleCount.None; // Technically we could just cast "globalMaxMSAASamples" to "actualMultisampleCount", // but AFAIK nothing prevents an implementation from exposing things like 6x MSAA or some other uncommon mode. if (globalMaxMSAASamples >= 8) { // If the maximum supported MSAA mode by the OpenGL implementation is higher than the maximum supported by the engine (8xMSAA), we clamp it. actualMultisampleCount = MultisampleCount.X8; } else if (globalMaxMSAASamples >= 4) { // If the maximum supported MSAA mode by the OpenGL implementation is between 4 and 7 samples, we fall back to the next lowest engine-supported one (4x). actualMultisampleCount = MultisampleCount.X4; // 4-7 x MSAA => 4 x MSAA (next lowest) } else if (globalMaxMSAASamples == 2) { // If the maximum supported MSAA mode by the OpenGL implementation is between 2 and 3 samples, we fall back to the next lowest engine-supported one (2x). actualMultisampleCount = MultisampleCount.X2; } for (int i = 0; i < mapFeaturesPerFormat.Length; i++) { // TODO: This ignores the supported multisample capabilities of each render target format. But I don't know how to query this in OpenGL (assuming it's even possible at all). mapFeaturesPerFormat[i] = new FeaturesPerFormat((PixelFormat)i, actualMultisampleCount, FormatSupport.None); } }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { mapFeaturesPerFormat = new FeaturesPerFormat[256]; IsProfiled = false; using (deviceRoot.UseOpenGLCreationContext()) { Vendor = GL.GetString(StringName.Vendor); Renderer = GL.GetString(StringName.Renderer); #if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES SupportedExtensions = GL.GetString(StringName.Extensions).Split(' '); #else int numExtensions; GL.GetInteger(GetPName.NumExtensions, out numExtensions); SupportedExtensions = new string[numExtensions]; for (int extensionIndex = 0; extensionIndex < numExtensions; ++extensionIndex) { SupportedExtensions[extensionIndex] = GL.GetString(StringName.Extensions, extensionIndex); } #endif } #if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES var isOpenGLES3 = deviceRoot.versionMajor >= 3; deviceRoot.HasDepth24 = isOpenGLES3 || SupportedExtensions.Contains("GL_OES_depth24"); deviceRoot.HasPackedDepthStencilExtension = SupportedExtensions.Contains("GL_OES_packed_depth_stencil"); deviceRoot.HasExtTextureFormatBGRA8888 = SupportedExtensions.Contains("GL_EXT_texture_format_BGRA8888") || SupportedExtensions.Contains("GL_APPLE_texture_format_BGRA8888"); deviceRoot.HasRenderTargetFloat = SupportedExtensions.Contains("GL_EXT_color_buffer_float"); deviceRoot.HasRenderTargetHalf = SupportedExtensions.Contains("GL_EXT_color_buffer_half_float"); deviceRoot.HasVAO = isOpenGLES3 || SupportedExtensions.Contains("GL_OES_vertex_array_object"); // Compute shaders available in OpenGL ES 3.1 HasComputeShaders = isOpenGLES3 && deviceRoot.versionMinor >= 1; HasDoublePrecision = false; // TODO: from 3.1: draw indirect, separate shader object // TODO: check tessellation & geometry shaders: GL_ANDROID_extension_pack_es31a #else deviceRoot.HasVAO = true; // Compute shaders available in OpenGL 4.3 HasComputeShaders = deviceRoot.versionMajor >= 4 && deviceRoot.versionMinor >= 3; HasDoublePrecision = SupportedExtensions.Contains("GL_ARB_vertex_attrib_64bit"); // TODO: from 4.0: tessellation, draw indirect // TODO: from 4.1: separate shader object #endif HasDriverCommandLists = false; HasMultiThreadingConcurrentResources = false; // TODO: Enum supported formats in mapFeaturesPerFormat // Find shader model based on OpenGL version (might need to check extensions more carefully) Profile = OpenGLUtils.GetFeatureLevel(deviceRoot.versionMajor, deviceRoot.versionMinor); }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { mapFeaturesPerFormat = new FeaturesPerFormat[256]; IsProfiled = false; using (deviceRoot.UseOpenGLCreationContext()) { Vendor = GL.GetString(StringName.Vendor); Renderer = GL.GetString(StringName.Renderer); #if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES SupportedExtensions = GL.GetString(StringName.Extensions).Split(' '); #else int numExtensions; GL.GetInteger(GetPName.NumExtensions, out numExtensions); SupportedExtensions = new string[numExtensions]; for (int extensionIndex = 0; extensionIndex < numExtensions; ++extensionIndex) { SupportedExtensions[extensionIndex] = GL.GetString(StringName.Extensions, extensionIndex); } #endif } #if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES var isOpenGLES3 = deviceRoot.versionMajor >= 3; deviceRoot.HasDepth24 = isOpenGLES3 || SupportedExtensions.Contains("GL_OES_depth24"); deviceRoot.HasPackedDepthStencilExtension = SupportedExtensions.Contains("GL_OES_packed_depth_stencil"); deviceRoot.HasExtTextureFormatBGRA8888 = SupportedExtensions.Contains("GL_EXT_texture_format_BGRA8888") || SupportedExtensions.Contains("GL_APPLE_texture_format_BGRA8888"); deviceRoot.HasRenderTargetFloat = SupportedExtensions.Contains("GL_EXT_color_buffer_float"); deviceRoot.HasRenderTargetHalf = SupportedExtensions.Contains("GL_EXT_color_buffer_half_float"); deviceRoot.HasVAO = isOpenGLES3 || SupportedExtensions.Contains("GL_OES_vertex_array_object"); // Compute shaders available in OpenGL ES 3.1 HasComputeShaders = isOpenGLES3 && deviceRoot.versionMinor >= 1; HasDoublePrecision = false; // TODO: from 3.1: draw indirect, separate shader object // TODO: check tessellation & geometry shaders: GL_ANDROID_extension_pack_es31a #else deviceRoot.HasVAO = true; // Compute shaders available in OpenGL 4.3 HasComputeShaders = deviceRoot.versionMajor >= 4 && deviceRoot.versionMinor >= 3; HasDoublePrecision = SupportedExtensions.Contains("GL_ARB_vertex_attrib_64bit"); // TODO: from 4.0: tessellation, draw indirect // TODO: from 4.1: separate shader object #endif HasDriverCommandLists = false; HasMultiThreadingConcurrentResources = false; // TODO: Enum supported formats in mapFeaturesPerFormat // Find shader model based on OpenGL version (might need to check extensions more carefully) Profile = OpenGLUtils.GetFeatureLevel(deviceRoot.versionMajor, deviceRoot.versionMinor); }
internal GraphicsDeviceFeatures(GraphicsDevice device) { IsProfiled = false; HasDriverCommandLists = false; HasMultiThreadingConcurrentResources = false; HasComputeShaders = false; HasDoublePrecision = false; mapFeaturesPerFormat = new FeaturesPerFormat[0]; Profile = GraphicsProfile.Level9; }
internal GraphicsDeviceFeatures(GraphicsDevice device) { IsProfiled = false; HasDriverCommandLists = false; HasMultiThreadingConcurrentResources = false; HasComputeShaders = false; HasDoublePrecision = false; mapFeaturesPerFormat = new FeaturesPerFormat[0]; Profile = GraphicsProfile.Level9; }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { // Find shader model based on OpenGL version (might need to check extensions more carefully) if (deviceRoot.versionMajor > 4) { Profile = GraphicsProfile.Level_11_0; } else if (deviceRoot.versionMajor > 3 && deviceRoot.versionMinor > 3) { Profile = GraphicsProfile.Level_10_0; } else { Profile = GraphicsProfile.Level_9_1; } mapFeaturesPerFormat = new FeaturesPerFormat[256]; IsProfiled = false; using (deviceRoot.UseOpenGLCreationContext()) { Vendor = GL.GetString(StringName.Vendor); Renderer = GL.GetString(StringName.Renderer); #if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES SupportedExtensions = GL.GetString(StringName.Extensions).Split(' '); #else int numExtensions; GL.GetInteger(GetPName.NumExtensions, out numExtensions); SupportedExtensions = new string[numExtensions]; for (int extensionIndex = 0; extensionIndex < numExtensions; ++extensionIndex) { SupportedExtensions[extensionIndex] = GL.GetString(StringName.Extensions, extensionIndex); } #endif } #if SILICONSTUDIO_PARADOX_GRAPHICS_API_OPENGLES deviceRoot.HasDepth24 = SupportedExtensions.Contains("GL_OES_depth24"); deviceRoot.HasPackedDepthStencilExtension = SupportedExtensions.Contains("GL_OES_packed_depth_stencil"); deviceRoot.HasExtTextureFormatBGRA8888 = SupportedExtensions.Contains("GL_EXT_texture_format_BGRA8888") || SupportedExtensions.Contains("GL_APPLE_texture_format_BGRA8888"); deviceRoot.HasVAO = SupportedExtensions.Contains("GL_OES_vertex_array_object"); #else deviceRoot.HasVAO = true; #endif // Compute shaders available in OpenGL 4.3 HasComputeShaders = deviceRoot.versionMajor > 4 && deviceRoot.versionMinor > 3; HasDoublePrecision = SupportedExtensions.Contains("GL_ARB_vertex_attrib_64bit"); HasDriverCommandLists = false; HasMultiThreadingConcurrentResources = false; // TODO: Enum supported formats in mapFeaturesPerFormat }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { //var nativeDevice = deviceRoot.NativeDevice; //PhysicalDeviceFeatures features; //deviceRoot.Adapter.PhysicalDevice.GetFeatures(out features); HasSRgb = true; mapFeaturesPerFormat = new FeaturesPerFormat[256]; // Set back the real GraphicsProfile that is used RequestedProfile = deviceRoot.RequestedProfile; CurrentProfile = deviceRoot.RequestedProfile; // GraphicsProfileHelper.FromFeatureLevel(deviceRoot.CurrentFeatureLevel); HasComputeShaders = true; HasDoublePrecision = false; HasMultiThreadingConcurrentResources = true; HasDriverCommandLists = true; HasDepthAsSRV = true; HasDepthAsReadOnlyRT = true; HasMultisampleDepthAsSRV = true; HasResourceRenaming = false; // TODO D3D12 for (int i = 0; i < mapFeaturesPerFormat.Length; i++) { mapFeaturesPerFormat[i] = new FeaturesPerFormat((PixelFormat)i, MultisampleCount.None, FormatSupport.None); } //// Check features for each DXGI.Format //foreach (var format in Enum.GetValues(typeof(SharpDX.DXGI.Format))) //{ // var dxgiFormat = (SharpDX.DXGI.Format)format; // var maximumMultisampleCount = MultisampleCount.None; // var computeShaderFormatSupport = ComputeShaderFormatSupport.None; // var formatSupport = FormatSupport.None; // if (!ObsoleteFormatToExcludes.Contains(dxgiFormat)) // { // maximumMultisampleCount = GetMaximumMultisampleCount(nativeDevice, dxgiFormat); // if (HasComputeShaders) // computeShaderFormatSupport = nativeDevice.CheckComputeShaderFormatSupport(dxgiFormat); // formatSupport = (FormatSupport)nativeDevice.CheckFormatSupport(dxgiFormat); // } // //mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat((PixelFormat)dxgiFormat, maximumMultisampleCount, computeShaderFormatSupport, formatSupport); // mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat((PixelFormat)dxgiFormat, maximumMultisampleCount, formatSupport); //} }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { var nativeDevice = deviceRoot.NativeDevice; HasSRgb = true; mapFeaturesPerFormat = new FeaturesPerFormat[256]; // Set back the real GraphicsProfile that is used // TODO D3D12 RequestedProfile = deviceRoot.RequestedProfile; CurrentProfile = GraphicsProfileHelper.FromFeatureLevel(deviceRoot.CurrentFeatureLevel); // TODO D3D12 HasComputeShaders = true; HasDoublePrecision = nativeDevice.D3D12Options.DoublePrecisionFloatShaderOps; // TODO D3D12 Confirm these are correct // Some docs: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476876(v=vs.85).aspx HasDepthAsSRV = true; HasDepthAsReadOnlyRT = true; HasMultisampleDepthAsSRV = true; HasResourceRenaming = false; HasMultiThreadingConcurrentResources = true; HasDriverCommandLists = true; // Check features for each DXGI.Format foreach (var format in Enum.GetValues(typeof(SharpDX.DXGI.Format))) { var dxgiFormat = (SharpDX.DXGI.Format)format; var maximumMultisampleCount = MultisampleCount.None; var formatSupport = FormatSupport.None; if (!ObsoleteFormatToExcludes.Contains(dxgiFormat)) { SharpDX.Direct3D12.FeatureDataFormatSupport formatSupportData; formatSupportData.Format = dxgiFormat; formatSupportData.Support1 = FormatSupport1.None; formatSupportData.Support2 = FormatSupport2.None; if (nativeDevice.CheckFeatureSupport(SharpDX.Direct3D12.Feature.FormatSupport, ref formatSupportData)) { formatSupport = (FormatSupport)formatSupportData.Support1; } maximumMultisampleCount = GetMaximumMultisampleCount(nativeDevice, dxgiFormat); } mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat((PixelFormat)dxgiFormat, maximumMultisampleCount, formatSupport); } }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { NullHelper.ToImplement(); mapFeaturesPerFormat = new FeaturesPerFormat[256]; HasComputeShaders = true; HasDepthAsReadOnlyRT = false; HasDepthAsSRV = true; HasDoublePrecision = true; HasDriverCommandLists = true; HasMultiThreadingConcurrentResources = true; HasResourceRenaming = true; HasSRgb = true; RequestedProfile = GraphicsProfile.Level_11_2; CurrentProfile = GraphicsProfile.Level_11_2; }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { var nativeDevice = deviceRoot.NativeDevice; HasSRgb = true; mapFeaturesPerFormat = new FeaturesPerFormat[256]; // Set back the real GraphicsProfile that is used // TODO D3D12 RequestedProfile = deviceRoot.RequestedProfile; CurrentProfile = GraphicsProfileHelper.FromFeatureLevel(deviceRoot.CurrentFeatureLevel); // TODO D3D12 HasComputeShaders = true; HasDoublePrecision = nativeDevice.D3D12Options.DoublePrecisionFloatShaderOps; // TODO D3D12 Confirm these are correct HasDepthAsSRV = true; HasDepthAsReadOnlyRT = true; HasResourceRenaming = false; HasMultiThreadingConcurrentResources = true; HasDriverCommandLists = true; // TODO D3D12 //// Check features for each DXGI.Format //foreach (var format in Enum.GetValues(typeof(SharpDX.DXGI.Format))) //{ // var dxgiFormat = (SharpDX.DXGI.Format)format; // var maximumMSAA = MSAALevel.None; // var computeShaderFormatSupport = ComputeShaderFormatSupport.None; // var formatSupport = FormatSupport.None; // if (!ObsoleteFormatToExcludes.Contains(dxgiFormat)) // { // maximumMSAA = GetMaximumMSAASampleCount(nativeDevice, dxgiFormat); // if (HasComputeShaders) // computeShaderFormatSupport = nativeDevice.CheckComputeShaderFormatSupport(dxgiFormat); // formatSupport = (FormatSupport)nativeDevice.CheckFormatSupport(dxgiFormat); // } // //mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat((PixelFormat)dxgiFormat, maximumMSAA, computeShaderFormatSupport, formatSupport); // mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat((PixelFormat)dxgiFormat, maximumMSAA, formatSupport); //} }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { var nativeDevice = deviceRoot.NativeDevice; HasSRgb = true; mapFeaturesPerFormat = new FeaturesPerFormat[256]; // Set back the real GraphicsProfile that is used // TODO D3D12 RequestedProfile = deviceRoot.RequestedProfile; CurrentProfile = GraphicsProfileHelper.FromFeatureLevel(deviceRoot.CurrentFeatureLevel); // TODO D3D12 HasComputeShaders = true; HasDoublePrecision = nativeDevice.D3D12Options.DoublePrecisionFloatShaderOps; // TODO D3D12 Confirm these are correct HasDepthAsSRV = true; HasDepthAsReadOnlyRT = true; HasResourceRenaming = false; HasMultiThreadingConcurrentResources = true; HasDriverCommandLists = true; // TODO D3D12 //// Check features for each DXGI.Format //foreach (var format in Enum.GetValues(typeof(SharpDX.DXGI.Format))) //{ // var dxgiFormat = (SharpDX.DXGI.Format)format; // var maximumMSAA = MSAALevel.None; // var computeShaderFormatSupport = ComputeShaderFormatSupport.None; // var formatSupport = FormatSupport.None; // if (!ObsoleteFormatToExcludes.Contains(dxgiFormat)) // { // maximumMSAA = GetMaximumMSAASampleCount(nativeDevice, dxgiFormat); // if (HasComputeShaders) // computeShaderFormatSupport = nativeDevice.CheckComputeShaderFormatSupport(dxgiFormat); // formatSupport = (FormatSupport)nativeDevice.CheckFormatSupport(dxgiFormat); // } // //mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat((PixelFormat)dxgiFormat, maximumMSAA, computeShaderFormatSupport, formatSupport); // mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat((PixelFormat)dxgiFormat, maximumMSAA, formatSupport); //} }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { var nativeDevice = deviceRoot.NativeDevice; HasSRgb = true; mapFeaturesPerFormat = new FeaturesPerFormat[256]; // Set back the real GraphicsProfile that is used RequestedProfile = deviceRoot.RequestedProfile; CurrentProfile = GraphicsProfileHelper.FromFeatureLevel(nativeDevice.FeatureLevel); HasResourceRenaming = true; HasComputeShaders = nativeDevice.CheckFeatureSupport(SharpDX.Direct3D11.Feature.ComputeShaders); HasDoublePrecision = nativeDevice.CheckFeatureSupport(SharpDX.Direct3D11.Feature.ShaderDoubles); nativeDevice.CheckThreadingSupport(out HasMultiThreadingConcurrentResources, out this.HasDriverCommandLists); HasDepthAsSRV = (CurrentProfile >= GraphicsProfile.Level_10_0); HasDepthAsReadOnlyRT = CurrentProfile >= GraphicsProfile.Level_11_0; HasMultisampleDepthAsSRV = CurrentProfile >= GraphicsProfile.Level_11_0; // Check features for each DXGI.Format foreach (var format in Enum.GetValues(typeof(SharpDX.DXGI.Format))) { var dxgiFormat = (SharpDX.DXGI.Format)format; var maximumMultisampleCount = MultisampleCount.None; var computeShaderFormatSupport = ComputeShaderFormatSupport.None; var formatSupport = FormatSupport.None; if (!ObsoleteFormatToExcludes.Contains(dxgiFormat)) { maximumMultisampleCount = GetMaximumMultisampleCount(nativeDevice, dxgiFormat); if (HasComputeShaders) { computeShaderFormatSupport = nativeDevice.CheckComputeShaderFormatSupport(dxgiFormat); } formatSupport = (FormatSupport)nativeDevice.CheckFormatSupport(dxgiFormat); } //mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat((PixelFormat)dxgiFormat, maximumMultisampleCount, computeShaderFormatSupport, formatSupport); mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat((PixelFormat)dxgiFormat, maximumMultisampleCount, formatSupport); } }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { var nativeDevice = deviceRoot.NativeDevice; HasSRgb = true; mapFeaturesPerFormat = new FeaturesPerFormat[256]; // Set back the real GraphicsProfile that is used Profile = GraphicsProfileHelper.FromFeatureLevel(nativeDevice.FeatureLevel); #if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP IsProfiled = PixHelper.IsCurrentlyProfiled; #else IsProfiled = false; #endif HasComputeShaders = nativeDevice.CheckFeatureSupport(Feature.ComputeShaders); HasDoublePrecision = nativeDevice.CheckFeatureSupport(Feature.ShaderDoubles); nativeDevice.CheckThreadingSupport(out HasMultiThreadingConcurrentResources, out this.HasDriverCommandLists); // Check features for each DXGI.Format foreach (var format in Enum.GetValues(typeof(SharpDX.DXGI.Format))) { var dxgiFormat = (SharpDX.DXGI.Format)format; var maximumMSAA = MSAALevel.None; var computeShaderFormatSupport = ComputeShaderFormatSupport.None; var formatSupport = FormatSupport.None; if (!ObsoleteFormatToExcludes.Contains(dxgiFormat)) { maximumMSAA = GetMaximumMSAASampleCount(nativeDevice, dxgiFormat); if (HasComputeShaders) { computeShaderFormatSupport = nativeDevice.CheckComputeShaderFormatSupport(dxgiFormat); } formatSupport = (FormatSupport)nativeDevice.CheckFormatSupport(dxgiFormat); } //mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat((PixelFormat)dxgiFormat, maximumMSAA, computeShaderFormatSupport, formatSupport); mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat((PixelFormat)dxgiFormat, maximumMSAA, formatSupport); } }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { var nativeDevice = deviceRoot.NativeDevice; HasSRgb = true; mapFeaturesPerFormat = new FeaturesPerFormat[256]; // Set back the real GraphicsProfile that is used Profile = GraphicsProfileHelper.FromFeatureLevel(nativeDevice.FeatureLevel); #if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP IsProfiled = PixHelper.IsCurrentlyProfiled; #else IsProfiled = false; #endif HasComputeShaders = nativeDevice.CheckFeatureSupport(Feature.ComputeShaders); HasDoublePrecision = nativeDevice.CheckFeatureSupport(Feature.ShaderDoubles); nativeDevice.CheckThreadingSupport(out HasMultiThreadingConcurrentResources, out this.HasDriverCommandLists); // Check features for each DXGI.Format foreach (var format in Enum.GetValues(typeof(SharpDX.DXGI.Format))) { var dxgiFormat = (SharpDX.DXGI.Format)format; var maximumMSAA = MSAALevel.None; var computeShaderFormatSupport = ComputeShaderFormatSupport.None; var formatSupport = FormatSupport.None; if (!ObsoleteFormatToExcludes.Contains(dxgiFormat)) { maximumMSAA = GetMaximumMSAASampleCount(nativeDevice, dxgiFormat); if (HasComputeShaders) computeShaderFormatSupport = nativeDevice.CheckComputeShaderFormatSupport(dxgiFormat); formatSupport = (FormatSupport)nativeDevice.CheckFormatSupport(dxgiFormat); } //mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat((PixelFormat)dxgiFormat, maximumMSAA, computeShaderFormatSupport, formatSupport); mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat((PixelFormat)dxgiFormat, maximumMSAA, formatSupport); } }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { var nativeDevice = deviceRoot.NativeDevice; HasSRgb = true; mapFeaturesPerFormat = new FeaturesPerFormat[256]; // Set back the real GraphicsProfile that is used RequestedProfile = deviceRoot.RequestedProfile; CurrentProfile = GraphicsProfileHelper.FromFeatureLevel(nativeDevice.FeatureLevel); HasResourceRenaming = true; HasComputeShaders = nativeDevice.CheckFeatureSupport(Feature.ComputeShaders); HasDoublePrecision = nativeDevice.CheckFeatureSupport(Feature.ShaderDoubles); nativeDevice.CheckThreadingSupport(out HasMultiThreadingConcurrentResources, out this.HasDriverCommandLists); HasDepthAsSRV = (CurrentProfile >= GraphicsProfile.Level_10_0); HasDepthAsReadOnlyRT = (CurrentProfile >= GraphicsProfile.Level_11_0); // Check features for each DXGI.Format foreach (var format in Enum.GetValues(typeof(SharpDX.DXGI.Format))) { var dxgiFormat = (SharpDX.DXGI.Format)format; var maximumMSAA = MSAALevel.None; var computeShaderFormatSupport = ComputeShaderFormatSupport.None; var formatSupport = FormatSupport.None; if (!ObsoleteFormatToExcludes.Contains(dxgiFormat)) { maximumMSAA = GetMaximumMSAASampleCount(nativeDevice, dxgiFormat); if (HasComputeShaders) computeShaderFormatSupport = nativeDevice.CheckComputeShaderFormatSupport(dxgiFormat); formatSupport = (FormatSupport)nativeDevice.CheckFormatSupport(dxgiFormat); } //mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat((PixelFormat)dxgiFormat, maximumMSAA, computeShaderFormatSupport, formatSupport); mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat((PixelFormat)dxgiFormat, maximumMSAA, formatSupport); } }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { NullHelper.ToImplement(); mapFeaturesPerFormat = new FeaturesPerFormat[256]; for (int i = 0; i < mapFeaturesPerFormat.Length; i++) { mapFeaturesPerFormat[i] = new FeaturesPerFormat((PixelFormat)i, MultisampleCount.None, FormatSupport.None); } HasComputeShaders = true; HasDepthAsReadOnlyRT = false; HasDepthAsSRV = true; HasMultisampleDepthAsSRV = false; HasDoublePrecision = true; HasDriverCommandLists = true; HasMultiThreadingConcurrentResources = true; HasResourceRenaming = true; HasSRgb = true; RequestedProfile = GraphicsProfile.Level_11_2; CurrentProfile = GraphicsProfile.Level_11_2; }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { mapFeaturesPerFormat = new FeaturesPerFormat[256]; HasSRgb = true; using (deviceRoot.UseOpenGLCreationContext()) { Vendor = GL.GetString(StringName.Vendor); Renderer = GL.GetString(StringName.Renderer); #if SILICONSTUDIO_XENKO_GRAPHICS_API_OPENGLES SupportedExtensions = GL.GetString(StringName.Extensions).Split(' '); #else int numExtensions; GL.GetInteger(GetPName.NumExtensions, out numExtensions); SupportedExtensions = new string[numExtensions]; for (int extensionIndex = 0; extensionIndex < numExtensions; ++extensionIndex) { SupportedExtensions[extensionIndex] = GL.GetString(StringNameIndexed.Extensions, extensionIndex); } #endif } #if SILICONSTUDIO_XENKO_GRAPHICS_API_OPENGLES var isOpenGLES3 = deviceRoot.currentVersion >= 300; deviceRoot.HasDepth24 = isOpenGLES3 || SupportedExtensions.Contains("GL_OES_depth24"); deviceRoot.HasPackedDepthStencilExtension = SupportedExtensions.Contains("GL_OES_packed_depth_stencil"); deviceRoot.HasExtTextureFormatBGRA8888 = SupportedExtensions.Contains("GL_EXT_texture_format_BGRA8888") || SupportedExtensions.Contains("GL_APPLE_texture_format_BGRA8888"); deviceRoot.HasRenderTargetFloat = SupportedExtensions.Contains("GL_EXT_color_buffer_float"); deviceRoot.HasRenderTargetHalf = SupportedExtensions.Contains("GL_EXT_color_buffer_half_float"); deviceRoot.HasVAO = isOpenGLES3 || SupportedExtensions.Contains("GL_OES_vertex_array_object"); deviceRoot.HasTextureRG = isOpenGLES3 || SupportedExtensions.Contains("GL_EXT_texture_rg"); deviceRoot.HasKhronosDebug = deviceRoot.currentVersion >= 320 || SupportedExtensions.Contains("GL_KHR_debug"); // Either 3.2+, or 3.1+ with GL_EXT_texture_buffer // TODO: For now we don't have proper ES3 bindings on Android (and possibly iOS) deviceRoot.HasTextureBuffers = false; //deviceRoot.HasTextureBuffers = (deviceRoot.version >= 320) // || (deviceRoot.version >= 310 && SupportedExtensions.Contains("GL_EXT_texture_buffer")); HasSRgb = isOpenGLES3 || SupportedExtensions.Contains("GL_EXT_sRGB"); // Compute shaders available in OpenGL ES 3.1 HasComputeShaders = isOpenGLES3 && deviceRoot.currentVersion >= 1; HasDoublePrecision = false; HasDepthAsSRV = isOpenGLES3; HasDepthAsReadOnlyRT = isOpenGLES3; // TODO: from 3.1: draw indirect, separate shader object // TODO: check tessellation & geometry shaders: GL_ANDROID_extension_pack_es31a #else deviceRoot.HasVAO = true; deviceRoot.HasDXT = SupportedExtensions.Contains("GL_EXT_texture_compression_s3tc"); deviceRoot.HasTextureBuffers = true; deviceRoot.HasKhronosDebug = deviceRoot.currentVersion >= 430 || SupportedExtensions.Contains("GL_KHR_debug"); // Compute shaders available in OpenGL 4.3 HasComputeShaders = deviceRoot.version >= 430; HasDoublePrecision = SupportedExtensions.Contains("GL_ARB_vertex_attrib_64bit"); HasDepthAsSRV = deviceRoot.version >= 300; HasDepthAsReadOnlyRT = deviceRoot.version >= 300; // TODO: from 4.0: tessellation, draw indirect // TODO: from 4.1: separate shader object #endif deviceRoot.HasDepthClamp = SupportedExtensions.Contains("GL_ARB_depth_clamp"); HasDriverCommandLists = false; HasMultiThreadingConcurrentResources = false; // TODO: Enum supported formats in mapFeaturesPerFormat // Find shader model based on OpenGL version (might need to check extensions more carefully) RequestedProfile = deviceRoot.requestedGraphicsProfile; CurrentProfile = OpenGLUtils.GetFeatureLevel(deviceRoot.currentVersion); }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { mapFeaturesPerFormat = new FeaturesPerFormat[256]; HasSRgb = true; using (deviceRoot.UseOpenGLCreationContext()) { Vendor = GL.GetString(StringName.Vendor); Renderer = GL.GetString(StringName.Renderer); #if STRIDE_GRAPHICS_API_OPENGLES SupportedExtensions = GL.GetString(StringName.Extensions).Split(' '); #else int numExtensions; GL.GetInteger(GetPName.NumExtensions, out numExtensions); SupportedExtensions = new string[numExtensions]; for (int extensionIndex = 0; extensionIndex < numExtensions; ++extensionIndex) { SupportedExtensions[extensionIndex] = GL.GetString(StringNameIndexed.Extensions, extensionIndex); } #endif } #if STRIDE_GRAPHICS_API_OPENGLES deviceRoot.HasExtTextureFormatBGRA8888 = SupportedExtensions.Contains("GL_EXT_texture_format_BGRA8888") || SupportedExtensions.Contains("GL_APPLE_texture_format_BGRA8888"); deviceRoot.HasKhronosDebug = deviceRoot.currentVersion >= 320 || SupportedExtensions.Contains("GL_KHR_debug"); deviceRoot.HasTimerQueries = SupportedExtensions.Contains("GL_EXT_disjoint_timer_query"); // Either 3.2+, or 3.1+ with GL_EXT_texture_buffer // TODO: For now we don't have proper ES3 bindings on Android (and possibly iOS) deviceRoot.HasTextureBuffers = false; //deviceRoot.HasTextureBuffers = (deviceRoot.version >= 320) // || (deviceRoot.version >= 310 && SupportedExtensions.Contains("GL_EXT_texture_buffer")); // Compute shaders available in OpenGL ES 3.1 HasComputeShaders = deviceRoot.currentVersion >= 310; HasDoublePrecision = false; HasDepthAsSRV = true; HasDepthAsReadOnlyRT = true; HasMultisampleDepthAsSRV = true; deviceRoot.HasDepthClamp = SupportedExtensions.Contains("GL_ARB_depth_clamp"); // TODO: from 3.1: draw indirect, separate shader object // TODO: check tessellation & geometry shaders: GL_ANDROID_extension_pack_es31a #else deviceRoot.HasDXT = SupportedExtensions.Contains("GL_EXT_texture_compression_s3tc"); deviceRoot.HasTextureBuffers = true; deviceRoot.HasKhronosDebug = deviceRoot.currentVersion >= 430 || SupportedExtensions.Contains("GL_KHR_debug"); deviceRoot.HasTimerQueries = deviceRoot.version >= 320; // Compute shaders available in OpenGL 4.3 HasComputeShaders = deviceRoot.version >= 430; HasDoublePrecision = SupportedExtensions.Contains("GL_ARB_vertex_attrib_64bit"); HasDepthAsSRV = true; HasDepthAsReadOnlyRT = true; HasMultisampleDepthAsSRV = true; deviceRoot.HasDepthClamp = true; // TODO: from 4.0: tessellation, draw indirect // TODO: from 4.1: separate shader object #endif deviceRoot.HasAnisotropicFiltering = SupportedExtensions.Contains("GL_EXT_texture_filter_anisotropic"); HasResourceRenaming = true; HasDriverCommandLists = false; HasMultiThreadingConcurrentResources = false; // Find shader model based on OpenGL version (might need to check extensions more carefully) RequestedProfile = deviceRoot.requestedGraphicsProfile; CurrentProfile = OpenGLUtils.GetFeatureLevel(deviceRoot.currentVersion); EnumerateMSAASupportPerFormat(deviceRoot); }
internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot) { mapFeaturesPerFormat = new FeaturesPerFormat[256]; HasSRgb = true; using (deviceRoot.UseOpenGLCreationContext()) { Vendor = GL.GetString(StringName.Vendor); Renderer = GL.GetString(StringName.Renderer); #if SILICONSTUDIO_XENKO_GRAPHICS_API_OPENGLES SupportedExtensions = GL.GetString(StringName.Extensions).Split(' '); #else int numExtensions; GL.GetInteger(GetPName.NumExtensions, out numExtensions); SupportedExtensions = new string[numExtensions]; for (int extensionIndex = 0; extensionIndex < numExtensions; ++extensionIndex) { SupportedExtensions[extensionIndex] = GL.GetString(StringNameIndexed.Extensions, extensionIndex); } #endif } #if SILICONSTUDIO_XENKO_GRAPHICS_API_OPENGLES var isOpenGLES3 = deviceRoot.currentVersion >= 300; deviceRoot.HasDepth24 = isOpenGLES3 || SupportedExtensions.Contains("GL_OES_depth24"); deviceRoot.HasPackedDepthStencilExtension = SupportedExtensions.Contains("GL_OES_packed_depth_stencil"); deviceRoot.HasExtTextureFormatBGRA8888 = SupportedExtensions.Contains("GL_EXT_texture_format_BGRA8888") || SupportedExtensions.Contains("GL_APPLE_texture_format_BGRA8888"); deviceRoot.HasTextureFloat = isOpenGLES3 || SupportedExtensions.Contains("GL_OES_texture_float"); deviceRoot.HasTextureHalf = isOpenGLES3 || SupportedExtensions.Contains("GL_OES_texture_half_float"); deviceRoot.HasRenderTargetFloat = isOpenGLES3 || SupportedExtensions.Contains("GL_EXT_color_buffer_float"); deviceRoot.HasRenderTargetHalf = isOpenGLES3 || SupportedExtensions.Contains("GL_EXT_color_buffer_half_float"); deviceRoot.HasVAO = isOpenGLES3 || SupportedExtensions.Contains("GL_OES_vertex_array_object"); deviceRoot.HasTextureRG = isOpenGLES3 || SupportedExtensions.Contains("GL_EXT_texture_rg"); deviceRoot.HasKhronosDebug = deviceRoot.currentVersion >= 320 || SupportedExtensions.Contains("GL_KHR_debug"); // Either 3.2+, or 3.1+ with GL_EXT_texture_buffer // TODO: For now we don't have proper ES3 bindings on Android (and possibly iOS) deviceRoot.HasTextureBuffers = false; //deviceRoot.HasTextureBuffers = (deviceRoot.version >= 320) // || (deviceRoot.version >= 310 && SupportedExtensions.Contains("GL_EXT_texture_buffer")); HasSRgb = isOpenGLES3 || SupportedExtensions.Contains("GL_EXT_sRGB"); // Compute shaders available in OpenGL ES 3.1 HasComputeShaders = isOpenGLES3 && deviceRoot.currentVersion >= 1; HasDoublePrecision = false; HasDepthAsSRV = isOpenGLES3; HasDepthAsReadOnlyRT = isOpenGLES3; deviceRoot.HasDepthClamp = SupportedExtensions.Contains("GL_ARB_depth_clamp"); // TODO: from 3.1: draw indirect, separate shader object // TODO: check tessellation & geometry shaders: GL_ANDROID_extension_pack_es31a #else deviceRoot.HasVAO = true; deviceRoot.HasDXT = SupportedExtensions.Contains("GL_EXT_texture_compression_s3tc"); deviceRoot.HasTextureBuffers = true; deviceRoot.HasKhronosDebug = deviceRoot.currentVersion >= 430 || SupportedExtensions.Contains("GL_KHR_debug"); // Compute shaders available in OpenGL 4.3 HasComputeShaders = deviceRoot.version >= 430; HasDoublePrecision = SupportedExtensions.Contains("GL_ARB_vertex_attrib_64bit"); HasDepthAsSRV = deviceRoot.version >= 300; HasDepthAsReadOnlyRT = deviceRoot.version >= 300; deviceRoot.HasDepthClamp = deviceRoot.version >= 300; // TODO: from 4.0: tessellation, draw indirect // TODO: from 4.1: separate shader object #endif deviceRoot.HasAnisotropicFiltering = SupportedExtensions.Contains("GL_EXT_texture_filter_anisotropic"); HasResourceRenaming = true; HasDriverCommandLists = false; HasMultiThreadingConcurrentResources = false; // TODO: Enum supported formats in mapFeaturesPerFormat // Find shader model based on OpenGL version (might need to check extensions more carefully) RequestedProfile = deviceRoot.requestedGraphicsProfile; CurrentProfile = OpenGLUtils.GetFeatureLevel(deviceRoot.currentVersion); }