On 12/11/2013 03:53 AM, Pi Tabred wrote: > On 10.12.2013 18:00, Marek Olšák wrote: >> On Tue, Dec 10, 2013 at 2:13 PM, Pi Tabred <servuswiege...@yahoo.de> wrote: >>> - add xml file for extension >>> - add reference in gl_API.xml >>> - add pointer to device driver function table >>> - add new functions to list of available functions >>> --- >>> src/mapi/glapi/gen/ARB_clear_buffer_object.xml | 50 >>> ++++++++++++++++++++++++++ >>> src/mapi/glapi/gen/gl_API.xml | 6 +++- >>> src/mesa/main/dd.h | 5 +++ >>> src/mesa/main/tests/dispatch_sanity.cpp | 4 +-- >>> 4 files changed, 62 insertions(+), 3 deletions(-) >>> create mode 100644 src/mapi/glapi/gen/ARB_clear_buffer_object.xml >>> >>> diff --git a/src/mapi/glapi/gen/ARB_clear_buffer_object.xml >>> b/src/mapi/glapi/gen/ARB_clear_buffer_object.xml >>> new file mode 100644 >>> index 0000000..e7baf6f >>> --- /dev/null >>> +++ b/src/mapi/glapi/gen/ARB_clear_buffer_object.xml >>> @@ -0,0 +1,50 @@ >>> +<?xml version="1.0"?> >>> +<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd"> >>> + >>> +<!-- Note: no GLX protocol info yet. --> >>> + >>> + >>> +<OpenGLAPI> >>> + >>> +<category name="GL_ARB_clear_buffer_object" number="121"> >>> + >>> + <function name ="ClearBufferData" offset="assign"> >>> + <param name="target" type="GLenum"/> >>> + <param name="internalformat" type="GLenum"/> >>> + <param name="format" type="GLenum"/> >>> + <param name="type" type="GLenum"/> >>> + <param name="data" type="const GLvoid *"/> >>> + </function> >>> + >>> + <function name ="ClearBufferSubData" offset="assign"> >>> + <param name="target" type="GLenum"/> >>> + <param name="internalformat" type="GLenum"/> >>> + <param name="offset" type="GLintptr"/> >>> + <param name="size" type="GLsizeiptr"/> >>> + <param name="format" type="GLenum"/> >>> + <param name="type" type="GLenum"/> >>> + <param name="data" type="const GLvoid *"/> >>> + </function> >>> + >>> +<!-- <function name="ClearNamedBufferDataEXT" offset="assign" es2="3.0"> >>> + <param name="buffer" type="GLuint"/> >>> + <param name="internalformat" type="GLenum"/> >>> + <param name="format" type="GLenum"/> >>> + <param name="type" type="GLenum"/> >>> + <param name="data" type="const GLvoid*"/> >>> + </function> >>> + >>> + >>> + <function name="ClearNamedBufferSubDataEXT" offset="assign" es2="3.0"> >>> + <param name="buffer" type="GLuint"/> >>> + <param name="internalformat" type="GLenum"/> >>> + <param name="offset" type="GLintptr"/> >>> + <param name="size" type="GLsizeiptr"/> >>> + <param name="format" type="GLenum"/> >>> + <param name="type" type="GLenum"/> >>> + <param name="data" type="const GLvoid*"/> >>> + </function> --> >>> + >>> +</category> >>> + >>> +</OpenGLAPI> >>> diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml >>> index 5c877aa..af8ab2e 100644 >>> --- a/src/mapi/glapi/gen/gl_API.xml >>> +++ b/src/mapi/glapi/gen/gl_API.xml >>> @@ -8460,7 +8460,11 @@ >>> >>> </category> >>> >>> -<!-- ARB extensions #120...#124 --> >>> +<!-- ARB extension #120 --> >>> + >>> +<xi:include href="ARB_clear_buffer_object.xml" >>> xmlns:xi="http://www.w3.org/2001/XInclude"/> >>> + >>> +<!-- ARB extensions #122...#124 --> >>> >>> <xi:include href="ARB_vertex_attrib_binding.xml" >>> xmlns:xi="http://www.w3.org/2001/XInclude"/> >>> >>> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h >>> index b5b874f..0e2bda0 100644 >>> --- a/src/mesa/main/dd.h >>> +++ b/src/mesa/main/dd.h >>> @@ -569,6 +569,11 @@ struct dd_function_table { >>> GLintptrARB offset, GLsizeiptrARB size, >>> GLvoid *data, struct gl_buffer_object *obj ); >>> >>> + void (*ClearBufferSubData)( struct gl_context *ctx, GLenum >>> internalformat, >>> + GLintptr offset, GLsizeiptr size, >>> + GLenum format, GLenum type, >>> + const GLvoid *data, struct gl_buffer_object >>> *obj ); >> >> This interface could be simpler. The unpacking from the data to the >> internal format should take place in mesa/main, so that drivers only >> have to implement something like this: >> >> void (*ClearBufferSubData)(struct gl_context *ctx, struct >> gl_buffer_object *obj, GLintptr offset, GLsizeiptr size, GLvoid >> *element, int element_size); >> >> "offset" and "size" should stay. "element" is the clear value that has >> "element_size" bytes. "element_size" is the size of the internal >> format in bytes. >> >> Marek > > That's something I considered, but I thought the drivers might have > their own way of converting the data to the internalformat. > If that's not the case, I'll change it.
I think there are two ways a driver could implement this function, and I suspect that drivers for UMA systems may dynamically switch between the two. I'm pretty sure the i965 driver will, anyway. A driver could implement this using a blitter-based or CPU-based memcpy function. In that case, having a pointer to raw data in the destination format is what you would want. A driver could also implement this using a blitter-based or render-based clear function. That is, they'd wrap the buffer object in a fake surface and do whatever is done for glClearBuffer*. I had originally thought you'd want the internalformat in that case, but after discussing a number of implementation strategies with Ken, I don't think it's actually needed. I also support Marek's suggestion. For the record, the possible implementation strategies Ken and I discussed: - Repeating memcpy on the CPU. - Using the blit engine with clever source strides. - Using the render engine with some sort of uint outputs of raw bits. - Using transform feedback with some sort of uint outputs of raw bits. > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev