From: Tiziano Bacocco Subject: Mesa shader compiling/optimizing process is too slow Date: Mon, 09 Jul 2012 18:48:18 +0200 Message-ID: <4FFB0B52.4030009@tizbac.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from vsmtp1.tin.it (vsmtp1.tin.it [212.216.176.141]) by gabe.freedesktop.org (Postfix) with ESMTP id BE4BE9E880 for ; Mon, 9 Jul 2012 09:53:36 -0700 (PDT) Received: from tizbac.localdomain (80.181.119.37) by vsmtp1.tin.it (8.6.023.02) id 4FD666850314037F for dri-devel@lists.freedesktop.org; Mon, 9 Jul 2012 18:48:20 +0200 Received: from [192.168.1.190] (unknown [192.168.1.190]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: tiziano) by tizbac.localdomain (Postfix) with ESMTPSA id 0A9CAC38BC for ; Mon, 9 Jul 2012 18:48:18 +0200 (CEST) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org I've done benchmarks and comparison between proprietary drivers and Mesa, Mesa seems to be up to 200x slower compiling the same shader, since i understand optimizing such part of code may take months or even more, i have thought to solve it this way: Upon calling glLinkProgram , an unoptimized version of the shader ( compiles much much faster ) is uploaded to the GPU Then a separate thread is launched that will optimize the shader and as soon it is done, on the next call to glUseProgram it will upload optimized version in place of unoptimized one. This will solve many performance issues and temporary freezes with games that load/unload content while running, while not reducing performance once the background optimization is done