[Mesa-dev] [PATCH 00/30] mesa: Start implementing compute shaders.

Paul Berry stereotype441 at gmail.com
Thu Jan 9 18:19:01 PST 2014

This is the first of several planned patch series to implement the
extension ARB_compute_shader in Mesa.  This series allows the Mesa
front-end to parse and compile a "do-nothing" compute shader--that is,
one which contains nothing but a compute shader input layout
declaration and an empty main() function.

Since compute shader support is not yet complete, I haven't enabled
it.  To try it out, set the environment variable

With that environment variable set, the series passes all of the
ARB_compute_shader tests I recently sent to the Piglit mailing list,
except for the "minmax" test.

Patches 01-12 do preparatory refactoring in order to make adding
compute shaders (and other future shader stages) easier.

Patch 13 adds the extension enable flags for compute shaders, both in
the context and in the GLSL compiler.

Patch 14 adds the ARB_compute_shader functions and enums to Mesa's
dispatch code generation logic.  The functions don't do anything yet.

Patch 15 changes the linker so that once the compute shader stage has
been added, it won't mistakenly consider it to be part of the rest of
the graphics pipeline.

Patches 16-20 add MESA_SHADER_COMPUTE to the gl_shader_stage enum, and
update the rest of the code base to accommodate its presence in the

Patches 21-23 implement some compute shader constants.

Patches 24-26 implement logic to handle compute shader work group
sizes (also known as "local sizes").

Patches 27-28 implement two other basic rules of compute shaders (they
don't have user-defined ins/outs, and they can't be mixed with other
shader types).

Finally, patches 29-30 implement the necessary back-end code for the
i965 driver to allow compute shaders to be turned on with an
environment variable.

Once these patches land, I plan to start working on the i965 back end.

[PATCH 01/30] mesa: Replace _mesa_program_index_to_target with _mesa_shader_stage_to_program.
[PATCH 02/30] mesa: Make validate_shader_target() non-static.
[PATCH 03/30] main: Allow ctx == NULL in _mesa_validate_shader_target().
[PATCH 04/30] mesa: use _mesa_validate_shader_target() more frequently.
[PATCH 05/30] glsl/linker: Refactor in preparation for adding more shader stages.
[PATCH 06/30] mesa: Replace ctx->Shader.Current{Vertex,Fragment,Geometry}Program with an array.
[PATCH 07/30] mesa: Fold long lines introduced by the previous patch.
[PATCH 08/30] i965: Fix comments to refer to the new ctx->Shader.CurrentProgram array.
[PATCH 09/30] meta: Replace save_state::{Vertex,Geometry,Fragment}Shader with an array.
[PATCH 10/30] mesa: Remove ad-hoc arrays of gl_shader_program.
[PATCH 11/30] mesa: Change redundant code into loops in shaderapi.c.
[PATCH 12/30] mesa: Change redundant code into loops in texstate.c.
[PATCH 13/30] mesa/cs: Add extension enable flags for ARB_compute_shader.
[PATCH 14/30] mesa/cs: Add dispatch API stubs for ARB_compute_shader.
[PATCH 15/30] glsl/cs: Change some linker loops to use MESA_SHADER_FRAGMENT as a bound.
[PATCH 16/30] mesa/cs: Add a MESA_SHADER_COMPUTE stage and update statements.
[PATCH 17/30] glsl/cs: Populate default values for ctx->Const.Program[MESA_SHADER_COMPUTE].
[PATCH 18/30] glsl/cs: update main.cpp to use the ".comp" extension for compute shaders.
[PATCH 19/30] mesa/cs: Handle compute shaders in _mesa_use_program().
[PATCH 20/30] mesa/cs: Create the gl_compute_program struct, and the code to initialize it.
[PATCH 21/30] mesa/cs: Implement MAX_COMPUTE_WORK_GROUP_SIZE constant.
[PATCH 22/30] mesa/cs: Implement MAX_COMPUTE_WORK_GROUP_INVOCATIONS constant.
[PATCH 23/30] mesa/cs: Implement MAX_COMPUTE_WORK_GROUP_COUNT constant.
[PATCH 24/30] glsl/cs: Handle compute shader local_size_{x,y,z} declaration.
[PATCH 25/30] mesa/cs: Handle compute shader local size during linking.
[PATCH 26/30] main/cs: Implement query for COMPUTE_WORK_GROUP_SIZE.
[PATCH 27/30] glsl/cs: Prohibit user-defined ins/outs in compute shaders.
[PATCH 28/30] glsl/cs: Prohibit mixing of compute and non-compute shaders.
[PATCH 29/30] i965/cs: Create the brw_compute_program struct, and the code to initialize it.
[PATCH 30/30] i965/cs: Allow ARB_compute_shader to be enabled via env var.

More information about the mesa-dev mailing list