opengl32: glBindTexture() and glDeleteTextures() require an active GL context

Bruno Jesus 00cpxxx at gmail.com
Mon Jun 23 21:38:24 CDT 2014


On Sat, Jun 21, 2014 at 6:47 PM, Roderick Colenbrander
<thunderbird2k at gmail.com> wrote:
> Hi Bruno,
>
> Regarding the make_opengl script it generates the code from templates from
> the opengl site. The templates contain all the function definitions. The
> script has some function which in the end generates code for each function.
> Look for something common e.g. trace lines to find your way around the
> script.

Please take a look at the attached patch, Sebastian Lackner helped me
with the perl code and the patch generates the same changes I manually
created in my previous attempt. It's done in a way it will not mess
with all functions, only the ones required.

> Thanks,
> Roderick

Best wishes,
Bruno
-------------- next part --------------
diff --git a/dlls/opengl32/make_opengl b/dlls/opengl32/make_opengl
index b0b9c00..dac5c99 100755
--- a/dlls/opengl32/make_opengl
+++ b/dlls/opengl32/make_opengl
@@ -87,6 +87,13 @@ my %cat_1_5 = ( %cat_1_4, "GL_VERSION_1_5" => 1 );
 my %norm_categories = ();
 
 #
+# This list represents the functions that require NULL function table
+# handling
+#
+
+my @null_table_check = qw/glBindTexture glDeleteTextures/;
+
+#
 # This hash table gives the conversion between OpenGL types and what
 # is used by the TRACE printfs
 #
@@ -282,6 +289,9 @@ sub GenerateThunk($$$$)
     $ret .= 'void ' if (!@{$func_ref->[1]});
     $ret .= ") {\n";
     $ret .= "  const struct opengl_funcs *funcs = NtCurrentTeb()->glTable;\n";
+    if (grep $_ eq $name, @null_table_check) {
+        $ret .= "  if(!funcs) return; /* called without an active gl context */\n";
+    }
     if ($func_ref->[0] ne "void" && $gen_thread_safe) {
         $ret .= "  " . ConvertType($func_ref->[0]) . " ret_value;\n";
     }


More information about the wine-devel mailing list