From: Paul Berry Date: Mon, 6 Jan 2014 23:12:05 +0000 (-0800) Subject: i965/cs: Allow ARB_compute_shader to be enabled via env var. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=25268b930dbd9bc89c0cce83746c5ca2f534c016;p=mesa.git i965/cs: Allow ARB_compute_shader to be enabled via env var. 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. Reviewed-by: Jordan Justen --- diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index d9d1ae5867b..6a3a4f1972c 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -296,10 +296,17 @@ brw_initialize_context_constants(struct brw_context *brw) ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits = max_samplers; else ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits = 0; + if (getenv("INTEL_COMPUTE_SHADER")) { + 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) @@ -423,9 +430,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 2b5ed0b3b82..a0fd354f2cb 100644 --- a/src/mesa/drivers/dri/i965/intel_extensions.c +++ b/src/mesa/drivers/dri/i965/intel_extensions.c @@ -299,6 +299,9 @@ intelInitExtensions(struct gl_context *ctx) */ if (ctx->API == API_OPENGL_CORE) ctx->Extensions.ARB_viewport_array = true; + + if (getenv("INTEL_COMPUTE_SHADER")) + ctx->Extensions.ARB_compute_shader = true; } if (brw->gen == 5 || can_write_oacontrol(brw))