[Mesa-dev] [PATCH 30/30] i965/cs: Allow ARB_compute_shader to be enabled via env var.
Jordan Justen
jljusten at gmail.com
Sat Feb 1 23:21:21 PST 2014
On Thu, Jan 9, 2014 at 6:19 PM, Paul Berry <stereotype441 at gmail.com> wrote:
> This will allow testing of compute shader functionality before it is
> completed.
>
> To enable ARB_compute_shader functionality in the i965 driver, set
> INTEL_COMPUTE_SHADER=1.
> ---
> src/mesa/drivers/dri/i965/brw_context.c | 11 ++++++++++-
> src/mesa/drivers/dri/i965/intel_extensions.c | 2 ++
> 2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
> index 1b42751..76dd9be 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -298,10 +298,17 @@ brw_initialize_context_constants(struct brw_context *brw)
> ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
> else
> ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits = 0;
> + if (getenv("INTEL_COMPUTE_SHADER")) {
What about trying to make use of MESA_EXTENSION_OVERRIDE=GL_ARB_compute_shader?
We could add
extensions.c:bool _mesa_is_extension_override_enabled(char *)
And then
if (_mesa_is_extension_override_enabled("GL_ARB_compute_shader"))
Or, similarly, get overrides shoved into ctx->Extensions to allow
checking for overrides at this early stage.
-Jordan
> + ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
> + ctx->Const.MaxUniformBufferBindings += 12;
> + } else {
> + ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits = 0;
> + }
> ctx->Const.MaxCombinedTextureImageUnits =
> ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits +
> ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits +
> - ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits;
> + ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits +
> + ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits;
>
> ctx->Const.MaxTextureLevels = 14; /* 8192 */
> if (ctx->Const.MaxTextureLevels > MAX_TEXTURE_LEVELS)
> @@ -425,9 +432,11 @@ brw_initialize_context_constants(struct brw_context *brw)
> ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicCounters = MAX_ATOMIC_COUNTERS;
> ctx->Const.Program[MESA_SHADER_VERTEX].MaxAtomicCounters = MAX_ATOMIC_COUNTERS;
> ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicCounters = MAX_ATOMIC_COUNTERS;
> + ctx->Const.Program[MESA_SHADER_COMPUTE].MaxAtomicCounters = MAX_ATOMIC_COUNTERS;
> ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicBuffers = BRW_MAX_ABO;
> ctx->Const.Program[MESA_SHADER_VERTEX].MaxAtomicBuffers = BRW_MAX_ABO;
> ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicBuffers = BRW_MAX_ABO;
> + ctx->Const.Program[MESA_SHADER_COMPUTE].MaxAtomicBuffers = BRW_MAX_ABO;
> ctx->Const.MaxCombinedAtomicBuffers = 3 * BRW_MAX_ABO;
> }
>
> diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
> index de07b7f..27bc97b 100644
> --- a/src/mesa/drivers/dri/i965/intel_extensions.c
> +++ b/src/mesa/drivers/dri/i965/intel_extensions.c
> @@ -294,6 +294,8 @@ intelInitExtensions(struct gl_context *ctx)
> ctx->Extensions.ARB_transform_feedback_instanced = true;
> ctx->Extensions.ARB_draw_indirect = true;
> }
> + if (getenv("INTEL_COMPUTE_SHADER"))
> + ctx->Extensions.ARB_compute_shader = true;
> }
>
> if (brw->gen == 5 || can_write_oacontrol(brw))
> --
> 1.8.5.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list