[Mesa-dev] [PATCH 00/12] RFC: add support of ARB_separate_shader_object extensions
Ian Romanick
idr at freedesktop.org
Fri Apr 5 14:44:54 PDT 2013
On 04/05/2013 02:25 PM, gregory wrote:
> Hello,
>
> Please find an implementation of the ARB_separate_shader_objects extensions. I concentrate mostly on the state part of
> the extensions aka the pipeline object. I think GLSL already compiled program separately anyway.
>
> I test my implementation on the test that I send yesterday ago on piglit. All tests are ok but I miss a test for new uniform function.
> Besides there are still some parts unimplemented:
> 1/ GLX Protocol: not sure it will be useful, as understand GLX is kinda drepecated
We don't have any other GLX support for GLSL, so I wouldn't worry about it.
> 2/ Display list: need to be done or maybe enable the extensions on CORE profile
I haven't had any requests for the functionality with compatibility
profiles. As far as I can tell, all of the ISVs that want this feature
are already shifting to core profiles.
Maybe Aras can give us one humble ISVs opinion. :)
> Stuff that bug me:
> 1/ I don't get how to use ralloc_strdup. So I set the ralloc's context to NULL, not sure it is fully correct
The ralloc memory context is (usually) some other thing allocated by
ralloc. When the context is freed, all of the things allocated using
that context will also be freed. So,
a = ralloc_size(NULL, 32);
b = ralloc_size(a, 32);
...
ralloc_free(a);
Will free both a and b.
You can also use ralloc_steal to reparent an allocation. So,
a = ralloc_size(NULL, 32);
b = ralloc_size(a, 32);
c = ralloc_size(NULL, 32);
ralloc_steal(c, b);
ralloc_free(a);
will only cause a to be freed. b is now in the context of c.
We use this in the GLSL compiler to, basically, implement a
mark-and-sweep garbage collector. As various parts of the compiler
allocate new objects and orphan others, we'll do a ralloc_steal pass to
reparent all of the objects that are still connected. A ralloc_free of
the old context will destroy all the objects that are no longer connected.
> 2/ I implement the feature as a pure mesa state. I don't know if they're any rule to create driver functions. Maybe it
> would be better to add CreatePipelineObject/DeletePipelineObject/BindPipeline/UseProgramStages. Opinion is welcome
>
> Note: I didn't yet rebase my work on latest mesa. Not sure if it is critical for a preliminary review.
> Note2: I create the xml manually, don't know if there is any automatic flow.
>
> Thanks
>
> gregory (12):
> sso: Create extensions entry points
> sso: Add pipeline container/state
> sso: add support of GL_PROGRAM_SEPARABLE and CreateShaderProgramv
> sso: implement ActiveShaderProgram & GetProgramPipelineiv
> sso: replace Shader binding point with _Shader
> sso: rename Shader to the pointer _Shader
> sso: update meta state
> sso:Implement _mesa_UseProgramStages
> sso: implement BindProgramPipeline
> sso: update glGet: GL_PROGRAM_PIPELINE_BINDING
> sso: implement ValidateProgramPipeline and GetProgramPipelineInfoLog
> sso: Finally enable the extension on Gallium
>
> src/mapi/glapi/gen/ARB_separate_shader_objects.xml | 392 ++++++++++
> src/mapi/glapi/gen/Makefile.am | 1 +
> src/mapi/glapi/gen/gl_API.xml | 6 +-
> src/mapi/glapi/gen/gl_genexec.py | 1 +
> src/mesa/drivers/common/meta.c | 35 +-
> src/mesa/drivers/dri/i965/brw_gs.c | 2 +-
> src/mesa/drivers/dri/i965/brw_shader.cpp | 2 +-
> src/mesa/drivers/dri/i965/brw_vs.c | 4 +-
> src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 2 +-
> src/mesa/drivers/dri/i965/brw_wm.c | 4 +-
> src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 2 +-
> src/mesa/drivers/dri/i965/gen6_sol.c | 6 +-
> src/mesa/drivers/dri/i965/gen6_vs_state.c | 2 +-
> src/mesa/drivers/dri/i965/gen6_wm_state.c | 2 +-
> src/mesa/drivers/dri/i965/gen7_sol_state.c | 4 +-
> src/mesa/drivers/dri/i965/gen7_vs_state.c | 2 +-
> src/mesa/drivers/dri/i965/gen7_wm_state.c | 2 +-
> src/mesa/main/api_validate.c | 2 +-
> src/mesa/main/context.c | 44 +-
> src/mesa/main/extensions.c | 1 +
> src/mesa/main/ff_fragment_shader.cpp | 8 +-
> src/mesa/main/get.c | 17 +
> src/mesa/main/get_hash_params.py | 3 +
> src/mesa/main/mtypes.h | 38 +
> src/mesa/main/pipelineobj.c | 800 ++++++++++++++++++++
> src/mesa/main/pipelineobj.h | 101 +++
> src/mesa/main/shaderapi.c | 250 ++++--
> src/mesa/main/shaderapi.h | 8 +-
> src/mesa/main/state.c | 14 +-
> src/mesa/main/texstate.c | 12 +-
> src/mesa/main/transformfeedback.c | 4 +-
> src/mesa/main/uniform_query.cpp | 75 +-
> src/mesa/main/uniforms.c | 392 +++++++++-
> src/mesa/main/uniforms.h | 77 ++
> src/mesa/program/ir_to_mesa.cpp | 12 +-
> src/mesa/sources.mak | 1 +
> src/mesa/state_tracker/st_atom_clip.c | 2 +-
> src/mesa/state_tracker/st_atom_constbuf.c | 4 +-
> src/mesa/state_tracker/st_cb_drawpixels.c | 2 +-
> src/mesa/state_tracker/st_draw.c | 6 +-
> src/mesa/state_tracker/st_extensions.c | 1 +
> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +-
> src/mesa/state_tracker/st_program.c | 6 +-
> src/mesa/swrast/s_fragprog.c | 2 +-
> 44 files changed, 2182 insertions(+), 171 deletions(-)
> create mode 100644 src/mapi/glapi/gen/ARB_separate_shader_objects.xml
> create mode 100644 src/mesa/main/pipelineobj.c
> create mode 100644 src/mesa/main/pipelineobj.h
More information about the mesa-dev
mailing list