Bug 55010 - texelFetch(usampler2D) triggers st_glsl_to_tgsi.cpp:673:get_opcode: Assertion `op != 177' failed.
Summary: texelFetch(usampler2D) triggers st_glsl_to_tgsi.cpp:673:get_opcode: Assertion...
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: git
Hardware: All All
: medium normal
Assignee: mesa-dev
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-17 11:39 UTC by Jay Cornwall
Modified: 2012-11-08 20:16 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Test case to trigger assertion (2.28 KB, text/x-c++src)
2012-09-17 11:39 UTC, Jay Cornwall
Details
Fix target register type for integer texture opcodes in GLSL/TGSI conversion (943 bytes, patch)
2012-09-17 11:40 UTC, Jay Cornwall
Details | Splinter Review

Description Jay Cornwall 2012-09-17 11:39:28 UTC
Created attachment 67277 [details]
Test case to trigger assertion

Problem:

The attached test case triggers the following assertion during GLSL to TGSI lowering:

../../src/mesa/state_tracker/st_glsl_to_tgsi.cpp:673:get_opcode: Assertion `op != 177' failed.

Explanation:

The following GLSL IR fragment arises from the test case:

(expression int % (expression int u2i (swiz x (txf uvec4 (var_ref S)  (constant int (0))  0  (constant int (0)) ))) (constant int (0))

glsl_to_tgsi_visitor::visit(ir_texture *ir) sets the temporary register holding the TXF result to type glsl::vec4_type. This was correct prior to GL_EXT_texture_integer, which introduced texelFetch(usampler2D) and texelFetch(isampler2D) with return types uvec4 and ivec4 respectively.

The incorrect vec4 type propagates further through the lowering process. The inconsistency between this type and its ir_binop_mod consumer eventually triggers the assertion.

Solution:

It appears to be safe to use ir_texture->type, which carries the correct texelFetch return type, instead of glsl_type::vec4.

The attached patch resolves the issue for me. However, it has not been subjected to regression testing.
Comment 1 Jay Cornwall 2012-09-17 11:40:01 UTC
Created attachment 67278 [details] [review]
Fix target register type for integer texture opcodes in GLSL/TGSI conversion
Comment 2 Andreas Boll 2012-11-08 20:16:40 UTC
Fixed with 9785ae0973cc206afc36dbc7d5b9553f92d06b47


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.