Bug 70110

Summary: [bisected] regression: assert in r600_bind_sampler_states since 27c054edf0ae92c8c498830e7c7510fa94f5dcfd
Product: Mesa Reporter: Alexandre Demers <alexandre.f.demers>
Component: Drivers/Gallium/r600Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: brianp
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Replace overkill assert by

Description Alexandre Demers 2013-10-04 03:34:36 UTC
~/projects/display/openGL/tests/tropics_32$ ~/projects/display/test-gallium-32.sh ./1024x768_windowed.sh 
Launching ./1024x768_windowed.sh
r600_state_common.c:399:r600_bind_sampler_states: Assertion `!"Only vertex/fragment sampler are implemented."' failed.
./1024x768_windowed.sh: line 13: 24122 Trace/breakpoint trap   (core dumped) ./bin/Tropics -video_app opengl -sound_app openal -extern_define RELEASE -system_script tropics/unigine.cpp -engine_config ../data/unigine.cfg -data_path ../ -video_fullscreen 0 -video_mode -1 -video_width 1024 -video_height 768

On HD 6950
First bad commit:
27c054edf0ae92c8c498830e7c7510fa94f5dcfd

radeon: don't use old bind_vertex/fragment_sampler_states() hooks
Author Brian Paul<brianp@vmware.com>
Author date 9/12/13 5:45 PM
Parent i915g: remove old bind_vertex/fragment_sampler_states() h...
Child svga: don't hook in old bind_fragment_sampler_states() fu...
Branch origin/master (radeonsi/compute: Fix segfault caused by recent refactoring) 
Follows snb-magic (graw: Add struct pipe_surface forward declaration.)

    radeon: don't use old bind_vertex/fragment_sampler_states() hooks
Comment 1 Alexandre Demers 2013-10-04 16:49:26 UTC
Easy one: under r600_bind_sampler_states(), there is an assert. Since I'm building with --enable-debug, I hit it.

	if (shader != PIPE_SHADER_VERTEX &&
	    shader != PIPE_SHADER_FRAGMENT) {
		assert(!"Only vertex/fragment sampler are implemented.");
		return;
	}


I suggest we should/could print out an error message if needed, but it shouldn't be an assert() since we return just after that without doing anything if the shader is not of the supported type. In fact, I tested mesa with the assert commented out and everything was back to the way it used to be, so we really don't need an assert() there. A R600_ERR() seems to do the trick here:

	if (shader != PIPE_SHADER_VERTEX &&
	    shader != PIPE_SHADER_FRAGMENT) {
		R600_ERR("!Only vertex/fragment sampler are implemented.\n");
		return;
	}
Comment 2 Alexandre Demers 2013-10-04 17:03:17 UTC
Created attachment 87133 [details] [review]
Replace overkill assert by

It fixes an unneeded assert preventing some app to launch as they should.
Please review and commit.
Comment 3 Marek Olšák 2013-10-04 19:41:22 UTC
Fixed by c04b8d1daba5468a7ea991a65570a41951e2da7d. Closing.

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.