test for required extensions in Cg renderer too
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using OpenRA.FileFormats.Graphics;
|
using OpenRA.FileFormats.Graphics;
|
||||||
using Tao.Cg;
|
using Tao.Cg;
|
||||||
using Tao.OpenGl;
|
using Tao.OpenGl;
|
||||||
@@ -119,6 +120,23 @@ namespace OpenRA.Renderer.Cg
|
|||||||
|
|
||||||
CheckGlError();
|
CheckGlError();
|
||||||
|
|
||||||
|
// Test for required extensions
|
||||||
|
var required = new string[]
|
||||||
|
{
|
||||||
|
"GL_ARB_vertex_program",
|
||||||
|
"GL_ARB_fragment_program",
|
||||||
|
"GL_ARB_vertex_buffer_object",
|
||||||
|
};
|
||||||
|
|
||||||
|
var extensions = Gl.glGetString(Gl.GL_EXTENSIONS);
|
||||||
|
var missingExtensions = required.Where( r => !extensions.Contains(r) ).ToArray();
|
||||||
|
|
||||||
|
if (missingExtensions.Any())
|
||||||
|
{
|
||||||
|
WriteGraphicsLog("Unsupported GPU: Missing extensions: {0}".F(string.Join(",", missingExtensions)));
|
||||||
|
throw new InvalidProgramException("Unsupported GPU. See graphics.log for details.");
|
||||||
|
}
|
||||||
|
|
||||||
windowSize = size;
|
windowSize = size;
|
||||||
|
|
||||||
cgContext = Tao.Cg.Cg.cgCreateContext();
|
cgContext = Tao.Cg.Cg.cgCreateContext();
|
||||||
|
|||||||
Reference in New Issue
Block a user