Bug 107669

Summary: [bisected] wflinfo fails ctx->Const.MaxCombinedTextureImageUnits assertion
Product: Mesa Reporter: Clayton Craft <clayton.a.craft>
Component: Mesa coreAssignee: Marek Olšák <maraeo>
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium    
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Clayton Craft 2018-08-24 00:08:31 UTC
$ wflinfo --platform=gbm -a gl
ERROR: command failed
STDERR: wflinfo: ../src/mesa/main/context.c:777: check_context_limits: Assertion `ctx->Const.MaxCombinedTextureImageUnits <= MAX_COMBINED_TEXTURE_IMAGE_UNITS' failed.


I've bisected this failure to this commit:

commit 45f87a48f94148b484961f18a4f1ccf86f066b1c (refs/bisect/bad)
Author: Marek Olšák <marek.olsak@amd.com>
Date:   Mon Aug 6 08:32:23 2018 -0400

    mesa: don't include compute resources in MAX_COMBINED_* limits

    5 is the maximum number of shader stages that can be used by 1 execution
    call at the same time (e.g. a draw call). The limit ensures that each
    stage can use all of its binding points.

    Compute is separate and doesn't need the 5x multiplier.

    Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Comment 1 Marek Olšák 2018-08-24 01:19:59 UTC
Here's your fix:

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 6ba64e4e06d..51cae9dc637 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -422,7 +422,7 @@ brw_initialize_context_constants(struct brw_context *brw)
    };
 
    unsigned num_stages = 0;
-   for (int i = 0; i < MESA_SHADER_STAGES; i++) {
+   for (int i = 0; i <= MESA_SHADER_FRAGMENT; i++) {
       if (stage_exists[i])
          num_stages++;
    }

Feel free to push that.
Comment 2 Kenneth Graunke 2018-08-24 17:36:26 UTC
Yeah, that doesn't work...I basically tried that in b03dcb1e5f507c5950d0de053a6f76e6306ee71f.  You need to include compute still in MaxShaderStorageBufferBindings and MaxUniformBufferBindings.  But then there's the  issue 5 in OES_tessellation_shader that says we should include compute in MAX_COMBINED_TEXTURE_IMAGE_UNITS, too...so even with that it still doesn't work...

Reverted for now (9d670fd86cc13df0ddff5c6fcb0835926e9a8088), so closing this.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.