summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/glapi/glX_XML.py13
-rw-r--r--src/mesa/glapi/glX_proto_send.py96
-rw-r--r--src/mesa/glapi/gl_API.xml30
3 files changed, 106 insertions, 33 deletions
diff --git a/src/mesa/glapi/glX_XML.py b/src/mesa/glapi/glX_XML.py
index 3e749790d8..3f6f841d78 100644
--- a/src/mesa/glapi/glX_XML.py
+++ b/src/mesa/glapi/glX_XML.py
@@ -304,6 +304,8 @@ class glXFunction(gl_XML.glFunction):
self.output = None
self.can_be_large = 0
self.reply_always_array = 0
+ self.dimensions_in_reply = 0
+ self.img_reset = None
self.server_handcode = 0
self.client_handcode = 0
@@ -324,6 +326,7 @@ class glXFunction(gl_XML.glFunction):
self.glx_rop = int(attrs.get('rop', "0"))
self.glx_sop = int(attrs.get('sop', "0"))
self.glx_vendorpriv = int(attrs.get('vendorpriv', "0"))
+ self.img_reset = attrs.get('img_reset', None)
# The 'handcode' attribute can be one of 'true',
# 'false', 'client', or 'server'.
@@ -365,6 +368,10 @@ class glXFunction(gl_XML.glFunction):
else:
self.reply_always_array = 0
+ if attrs.get('dimensions_in_reply', "false") == "true":
+ self.dimensions_in_reply = 1
+ else:
+ self.dimensions_in_reply = 0
else:
gl_XML.glFunction.startElement(self, name, attrs)
@@ -433,7 +440,7 @@ class glXFunction(gl_XML.glFunction):
pixel commends is zero. The offset for pixel commands depends
on the number of dimensions of the pixel data."""
- if self.image:
+ if self.image and not self.image.is_output:
[dim, junk, junk, junk, junk] = self.dimensions()
# The base size is the size of the pixel pack info
@@ -457,12 +464,12 @@ class glXFunction(gl_XML.glFunction):
size = self.offset_of_first_parameter()
for p in gl_XML.glFunction.parameterIterator(self):
- if not p.is_output:
+ if not p.is_output and p.name != self.img_reset:
size += p.size()
if self.pad_after(p):
size += 4
- if self.image and self.image.img_null_flag:
+ if self.image and (self.image.img_null_flag or self.image.is_output):
size += 4
return size
diff --git a/src/mesa/glapi/glX_proto_send.py b/src/mesa/glapi/glX_proto_send.py
index 334caf8252..4f95da3aef 100644
--- a/src/mesa/glapi/glX_proto_send.py
+++ b/src/mesa/glapi/glX_proto_send.py
@@ -103,6 +103,7 @@ class glXPixelFunctionUtility(glX_XML.glXFunction):
self.can_be_large = func.can_be_large
self.count_parameter_list = func.count_parameter_list
self.counter = func.counter
+ self.img_reset = None
return
@@ -166,6 +167,48 @@ read_reply( Display *dpy, size_t size, void * dest, GLboolean reply_is_always_ar
return reply.retval;
}
+static NOINLINE void
+read_pixel_reply( Display *dpy, __GLXcontext * gc, unsigned max_dim,
+ GLint width, GLint height, GLint depth, GLenum format, GLenum type,
+ void * dest, GLboolean dimensions_in_reply )
+{
+ xGLXSingleReply reply;
+ GLint size;
+
+ (void) _XReply(dpy, (xReply *) & reply, 0, False);
+
+ if ( dimensions_in_reply ) {
+ width = reply.pad3;
+ height = reply.pad4;
+ depth = reply.pad5;
+
+ if ((height == 0) || (max_dim < 2)) { height = 1; }
+ if ((depth == 0) || (max_dim < 3)) { depth = 1; }
+ }
+
+ size = reply.length * 4;
+ if (size != 0) {
+ void * buf = Xmalloc( size );
+
+ if ( buf == NULL ) {
+ _XEatData(dpy, size);
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ }
+ else {
+ const GLint extra = 4 - (size & 3);
+
+ _XRead(dpy, buf, size);
+ if ( extra < 4 ) {
+ _XEatData(dpy, extra);
+ }
+
+ __glEmptyImage(gc, 3, width, height, depth, format, type,
+ buf, dest);
+ Xfree(buf);
+ }
+ }
+}
+
#define X_GLXSingle 0
static NOINLINE FASTCALL GLubyte *
@@ -265,8 +308,9 @@ generic_%u_byte( GLint rop, const void * ptr )
r = 2
for p in f.parameterIterator(1, r):
- self.common_emit_one_arg(p, offset, pc, indent, adjust)
- offset += p.size()
+ if p.name != f.img_reset:
+ self.common_emit_one_arg(p, offset, pc, indent, adjust)
+ offset += p.size()
return offset
@@ -328,6 +372,9 @@ generic_%u_byte( GLint rop, const void * ptr )
# parameter.
if not f.glx_rop:
+ if f.image and f.image.is_output:
+ print ' const __GLXattribute * const state = gc->client_state_private;'
+
print ' Display * const dpy = gc->currentDpy;'
skip_condition = "dpy != NULL"
elif f.can_be_large:
@@ -383,26 +430,43 @@ generic_%u_byte( GLint rop, const void * ptr )
print ' %s setup_single_request(gc, %s, cmdlen);' % (pc_decl, f.opcode_name())
self.common_emit_args(f, "pc", " ", 0, 0)
+ if f.image and f.image.is_output:
+ o = f.command_fixed_length() - 4
+ print ' *(int32_t *)(pc + %u) = 0;' % (o)
+ if f.image.img_format != "GL_COLOR_INDEX" or f.image.img_type != "GL_BITMAP":
+ print ' * (int8_t *)(pc + %u) = state->storePack.swapEndian;' % (o)
+
+ if f.img_reset:
+ print ' * (int8_t *)(pc + %u) = %s;' % (o + 1, f.img_reset)
+
if f.needs_reply():
- if f.output != None:
- output_size = f.output.p_type.size
- output_str = f.output.name
+ if f.image and f.image.is_output:
+ [dim, w, h, d, junk] = f.dimensions()
+ if f.dimensions_in_reply:
+ print " read_pixel_reply(dpy, gc, %u, 0, 0, 0, %s, %s, %s, GL_TRUE);" % (dim, f.image.img_format, f.image.img_type, f.image.name)
+ else:
+ print " read_pixel_reply(dpy, gc, %u, %s, %s, %s, %s, %s, %s, GL_FALSE);" % (dim, w, h, d, f.image.img_format, f.image.img_type, f.image.name)
else:
- output_size = 0
- output_str = "NULL"
+ if f.output != None:
+ output_size = f.output.p_type.size
+ output_str = f.output.name
+ else:
+ output_size = 0
+ output_str = "NULL"
- if f.fn_return_type != 'void':
- return_str = " retval = (%s)" % (f.fn_return_type)
- else:
- return_str = " (void)"
+ if f.fn_return_type != 'void':
+ return_str = " retval = (%s)" % (f.fn_return_type)
+ else:
+ return_str = " (void)"
- if f.reply_always_array:
- aa = "GL_TRUE"
- else:
- aa = "GL_FALSE"
+ if f.reply_always_array:
+ aa = "GL_TRUE"
+ else:
+ aa = "GL_FALSE"
+
+ print " %s read_reply(dpy, %s, %s, %s);" % (return_str, output_size, output_str, aa)
- print " %s read_reply(dpy, %s, %s, %s);" % (return_str, output_size, output_str, aa)
elif self.debug:
# Only emit the extra glFinish call for functions
# that don't already require a reply from the server.
diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml
index 2cbb3941c6..7d88d0d280 100644
--- a/src/mesa/glapi/gl_API.xml
+++ b/src/mesa/glapi/gl_API.xml
@@ -53,6 +53,8 @@
doubles_in_order CDATA #IMPLIED
always_array CDATA #IMPLIED
handcode CDATA #IMPLIED
+ img_reset CDATA #IMPLIED
+ dimensions_in_reply CDATA #IMPLIED
ignore CDATA #IMPLIED>
]>
@@ -2349,8 +2351,8 @@ glx:
<param name="height" type="GLsizei"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
- <param name="pixels" type="GLvoid *" output="true"/>
- <glx sop="111" handcode="true"/>
+ <param name="pixels" type="GLvoid *" output="true" img_width="width" img_height="height" img_format="format" img_type="type" img_target="0"/>
+ <glx sop="111"/>
</function>
<function name="DrawPixels" offset="257">
@@ -2465,8 +2467,8 @@ glx:
</function>
<function name="GetPolygonStipple" offset="274">
- <param name="mask" type="GLubyte *" output="true"/>
- <glx sop="128" handcode="true"/>
+ <param name="mask" type="GLubyte *" output="true" img_width="32" img_height="32" img_format="GL_COLOR_INDEX" img_type="GL_BITMAP"/>
+ <glx sop="128"/>
</function>
<function name="GetString" offset="275">
@@ -2515,8 +2517,8 @@ glx:
<param name="level" type="GLint"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
- <param name="pixels" type="GLvoid *" output="true"/>
- <glx sop="135" handcode="true"/>
+ <param name="pixels" type="GLvoid *" output="true" img_width="width" img_height="height" img_depth="depth" img_format="format" img_type="type"/>
+ <glx sop="135" dimensions_in_reply="true"/>
</function>
<function name="GetTexParameterfv" offset="282">
@@ -3322,8 +3324,8 @@ glx:
<param name="target" type="GLenum"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
- <param name="table" type="GLvoid *" output="true"/>
- <glx sop="147" handcode="true"/>
+ <param name="table" type="GLvoid *" output="true" img_width="width" img_format="format" img_type="type"/>
+ <glx sop="147" dimensions_in_reply="true"/>
</function>
<function name="GetColorTableParameterfv" offset="344">
@@ -3431,8 +3433,8 @@ glx:
<param name="target" type="GLenum"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
- <param name="image" type="GLvoid *" output="true"/>
- <glx sop="150" handcode="true"/>
+ <param name="image" type="GLvoid *" output="true" img_width="width" img_height="height" img_format="format" img_type="type"/>
+ <glx sop="150" dimensions_in_reply="true"/>
</function>
<function name="GetConvolutionParameterfv" offset="357">
@@ -3476,8 +3478,8 @@ glx:
<param name="reset" type="GLboolean"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
- <param name="values" type="GLvoid *" output="true"/>
- <glx sop="154" handcode="true"/>
+ <param name="values" type="GLvoid *" output="true" img_width="width" img_format="format" img_type="type"/>
+ <glx sop="154" dimensions_in_reply="true" img_reset="reset"/>
</function>
<function name="GetHistogramParameterfv" offset="362">
@@ -3499,8 +3501,8 @@ glx:
<param name="reset" type="GLboolean"/>
<param name="format" type="GLenum"/>
<param name="type" type="GLenum"/>
- <param name="values" type="GLvoid *" output="true"/>
- <glx sop="157" handcode="true"/>
+ <param name="values" type="GLvoid *" output="true" img_width="2" img_format="format" img_type="type"/>
+ <glx sop="157" img_reset="reset"/>
</function>
<function name="GetMinmaxParameterfv" offset="365">