[Mesa-dev] [PATCH 10/10] i965: Support 32 texture image units on Haswell+.
Matt Turner
mattst88 at gmail.com
Wed Jan 22 12:50:15 PST 2014
On Sat, Jan 18, 2014 at 8:20 PM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> The Intel closed source OpenGL driver recently began supporting 32
> texture image units on Haswell. This makes the open source driver
> support 32 as well.
>
> Earlier generations don't have the message header field required to
> support more than 16 sampler states, so we continue to advertise 16
> there.
>
> On Haswell, this causes us to advertise:
> - GL_MAX_TEXTURE_IMAGE_UNITS = 32
> - GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 32
> - GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 96
> instead of the old values of 16, 16, and 48.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
> src/mesa/drivers/dri/i965/brw_context.c | 9 ++++++---
> src/mesa/drivers/dri/i965/brw_context.h | 2 +-
> 2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
> index 1b42751..806f3db 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -282,20 +282,23 @@ brw_initialize_context_constants(struct brw_context *brw)
> {
> struct gl_context *ctx = &brw->ctx;
>
> + unsigned max_samplers =
> + brw->gen >= 8 || brw->is_haswell ? BRW_MAX_TEX_UNIT : 16;
> +
> ctx->Const.QueryCounterBits.Timestamp = 36;
>
> ctx->Const.StripTextureBorder = true;
>
> ctx->Const.MaxDualSourceDrawBuffers = 1;
> ctx->Const.MaxDrawBuffers = BRW_MAX_DRAW_BUFFERS;
> - ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
> + ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = max_samplers;
> ctx->Const.MaxTextureCoordUnits = 8; /* Mesa limit */
> ctx->Const.MaxTextureUnits =
> MIN2(ctx->Const.MaxTextureCoordUnits,
> ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits);
> - ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
> + ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits = max_samplers;
> if (brw->gen >= 7)
> - ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits = BRW_MAX_TEX_UNIT;
> + ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits = max_samplers;
> else
> ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits = 0;
> ctx->Const.MaxCombinedTextureImageUnits =
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
> index 63dd4a0..5908659 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -650,7 +650,7 @@ struct brw_gs_prog_data
> };
>
> /** Number of texture sampler units */
> -#define BRW_MAX_TEX_UNIT 16
> +#define BRW_MAX_TEX_UNIT 32
>
> /** Max number of render targets in a shader */
> #define BRW_MAX_DRAW_BUFFERS 8
> --
> 1.8.5.2
Unfortunate that the PRMs that contain the relevant information for
this series are missing...
Anyway, the series is
Reviewed-by: Matt Turner <mattst88 at gmail.com>
More information about the mesa-dev
mailing list