Summary: | Some extensions enabled even when not supported by the underlying driver | ||
---|---|---|---|
Product: | Mesa | Reporter: | Vinson Lee <vlee> |
Component: | glsl-compiler | Assignee: | Paul Berry <stereotype441> |
Status: | CLOSED FIXED | QA Contact: | |
Severity: | critical | ||
Priority: | medium | ||
Version: | git | ||
Hardware: | x86 (IA32) | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Vinson Lee
2011-06-06 16:19:35 UTC
Shouldn't the compiler reject the shader? The driver doesn't seem to claim to support anything which would indicate the texture grad instructions are supported (namely glsl 1.30, EXT_gpu_shader4, ARB_shader_texture_lod) which would lead to TXD emit. Or the driver should just fail to link maybe... (In reply to comment #1) > Shouldn't the compiler reject the shader? The driver doesn't seem to claim to > support anything which would indicate the texture grad instructions are > supported (namely glsl 1.30, EXT_gpu_shader4, ARB_shader_texture_lod) which > would lead to TXD emit. Or the driver should just fail to link maybe... That's my thought too. It seems likely that something is going wrong in the extension checking in the compiler. I cannot get a shader using texture2DGrad or texture2DGradARB to compile on the i965 driver. Can you send the output of MESA_GLSL=dump? (In reply to comment #4) > I added piglit test case glsl-link-bug38015. Ah, that makes a bit more sense. It seems that we're not handling extension 'enable' for unsupported extensions correctly. The GLSL spec says, "Behave as specified by the extension extension_name. Warn on the #extension if the extension extension_name is not supported. Give an error on the #extension if all is specified." The first two statements seem to be in conflict. How can the driver "behave as specified by the extension extension_name" when the extension isn't supported? My thinking is that we should emit the warning, create the #define with the value 0, and not do anything else from the extension. I'm curious what other drivers do with 'enable' of extensions that they "know" but are not supported on a particular piece of hardware. I'm also going to change the component to the glsl-compiler since this doesn't really have anything to do with the i965 driver. (In reply to comment #5) > My thinking is that we should emit the warning, create the #define with the > value 0, and not do anything else from the extension. I take that back. If the extension is supported, the #define is set (whether it is enabled or not). All we need to do is emit the warning and NOT enable the extension. I believe the problem is that _mesa_glsl_process_extension() is checking whether the extension is supported *after* enabling/disabling/turning on warnings for it. It should be checking whether the extension is supported first, and then only taking action if it is. It looks like several other extensions have similar problems: - GL_ARB_draw_instanced - GL_ARB_explicit_attrib_location - GL_ARB_fragment_coord_conventions - GL_EXT_texture_array - GL_ARB_shader_stencil_export - GL_AMD_conservative_depth - GL_AMD_shader_stencil_export - GL_OES_texture_3D Assuming this explanation is correct, I'll try and fix all these in one patch. I would love to do this fix by replacing _mesa_glsl_process_extension() with some table-driven code, so that we don't make the same mistake when implementing future extensions, but since the extension enable flags are stored in bitfields that would probably require more invasive surgery than is really justified. Note: while investigating this bug, I believe I found two other, less severe bugs: 1. Whenever a shader mentions the GL_ARB_shader_texture_lod extension, we automatically turn on the GL_ARB_texture_rectangle extension, regardless of whether GL_ARB_shader_texture_lod is being enabled or disabled. 2. The shader directives "#extension all : warn" and "#extension all : disable" look like they have no effect. These two bugs are lower impact because their only effect is to suppress errors and warnings that would otherwise be generated. I'll file separate bugs for these two problems, and we can come back to them if time allows. Presumably the original problem (TXD assertion) is gone now that the i965 driver actually supports GL_ARB_shader_texture_lod...in particular, I deleted that assertion. :) But the #extension handling bug still stands. Perhaps this bug report should be renamed? (In reply to comment #9) > Presumably the original problem (TXD assertion) is gone now that the i965 > driver actually supports GL_ARB_shader_texture_lod...in particular, I deleted > that assertion. :) > > But the #extension handling bug still stands. Perhaps this bug report should > be renamed? Agreed. I've renamed the bug to reflect the extension handling problem that remains. I should have a patch submitted today or tomorrow to fix the problem. Fixed with commit 3097715d41da4b725b7ce9f9d5bbc0f684cbf0a6 mesa: 4a7667b96b7bd7cdffbe929182c15935b74facd2 (master) Verified fixed. |
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.