]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_shared.c
implemented Direct3D9 renderer (off by default), not very optimized but almost comple...
[xonotic/darkplaces.git] / vid_shared.c
index 20f2b3e1dd3dd8f74e0b5d2226c8924b1cc98bc5..fccb1e4ab61a46b73cec3c676de238181bfcaf63 100644 (file)
@@ -790,13 +790,37 @@ static dllfunction_t drawbuffersfuncs[] =
        {NULL, NULL}
 };
 
-void VID_CheckExtensions(void)
+void VID_ClearExtensions(void)
 {
+       // VorteX: reset extensions info cvar, it got filled by GL_CheckExtension
+       Cvar_SetQuick(&gl_info_extensions, "");
+
        // clear the extension flags
        memset(&vid.support, 0, sizeof(vid.support));
+       vid.renderpath = RENDERPATH_GL11;
+       vid.forcevbo = false;
+       vid.maxtexturesize_2d = 0;
+       vid.maxtexturesize_3d = 0;
+       vid.maxtexturesize_cubemap = 0;
+       vid.texunits = 1;
+       vid.teximageunits = 1;
+       vid.texarrayunits = 1;
+       vid.max_anisotropy = 1;
+       vid.maxdrawbuffers = 1;
 
-       // VorteX: reset extensions info cvar, it got filled by GL_CheckExtension
-       Cvar_SetQuick(&gl_info_extensions, "");
+       // this is a complete list of all functions that are directly checked in the renderer
+       qglDrawRangeElements = NULL;
+       qglDrawBuffer = NULL;
+       qglPolygonStipple = NULL;
+       qglFlush = NULL;
+       qglActiveTexture = NULL;
+       qglGetCompressedTexImageARB = NULL;
+       qglFramebufferTexture2DEXT = NULL;
+       qglDrawBuffersARB = NULL;
+}
+
+void VID_CheckExtensions(void)
+{
        if (!GL_CheckExtension("1.1", opengl110funcs, NULL, false))
                Sys_Error("OpenGL 1.1.0 functions not found");
 
@@ -804,7 +828,6 @@ void VID_CheckExtensions(void)
 
        Con_DPrint("Checking OpenGL extensions...\n");
 
-       vid.forcevbo = false;
        vid.support.amd_texture_texture4 = GL_CheckExtension("GL_AMD_texture_texture4", NULL, "-notexture4", false);
        vid.support.arb_depth_texture = GL_CheckExtension("GL_ARB_depth_texture", NULL, "-nodepthtexture", false);
        vid.support.arb_draw_buffers = GL_CheckExtension("GL_ARB_draw_buffers", drawbuffersfuncs, "-nodrawbuffers", false);
@@ -860,15 +883,6 @@ void VID_CheckExtensions(void)
 // COMMANDLINEOPTION: GL: -novbo disables GL_ARB_vertex_buffer_object (which accelerates rendering)
 // COMMANDLINEOPTION: GL: -novertexshader disables GL_ARB_vertex_shader (allows vertex shader effects)
 
-       vid.maxtexturesize_2d = 0;
-       vid.maxtexturesize_3d = 0;
-       vid.maxtexturesize_cubemap = 0;
-       vid.texunits = 1;
-       vid.teximageunits = 1;
-       vid.texarrayunits = 1;
-       vid.max_anisotropy = 1;
-       vid.maxdrawbuffers = 1;
-
        if (vid.support.arb_draw_buffers)
                qglGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, (GLint*)&vid.maxdrawbuffers);
 
@@ -1036,6 +1050,9 @@ void VID_UpdateGamma(qboolean force, int rampsize)
        {
        case RENDERPATH_GL20:
        case RENDERPATH_CGGL:
+       case RENDERPATH_D3D9:
+       case RENDERPATH_D3D10:
+       case RENDERPATH_D3D11:
                if (v_glslgamma.integer)
                        wantgamma = 0;
                break;
@@ -1236,6 +1253,7 @@ int VID_Mode(int fullscreen, int width, int height, int bpp, float refreshrate,
        mode.stereobuffer = stereobuffer != 0;
        mode.samples = samples;
        cl_ignoremousemoves = 2;
+       VID_ClearExtensions();
        if (VID_InitMode(&mode))
        {
                // accept the (possibly modified) mode