mesa: improve error messaging for format CSV parser
authorTapani Pälli <tapani.palli@intel.com>
Mon, 26 Jan 2015 10:35:23 +0000 (12:35 +0200)
committerTapani Pälli <tapani.palli@intel.com>
Wed, 28 Jan 2015 08:40:15 +0000 (10:40 +0200)
Patch adds 2 error messages that point user directly to fix
mispelled or impossible swizzle field for a format.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/mesa/main/format_info.py
src/mesa/main/format_parser.py

index fe2063d7ad1dd6ca99317aaed9d7f0c95b6c5009..3bae57e54edbb3817e72f0d732705de247e08313 100644 (file)
@@ -58,7 +58,7 @@ def get_gl_base_format(fmat):
    elif fmat.has_channel('i') and fmat.num_channels() == 1:
       return 'GL_INTENSITY'
    else:
-      assert False
+      sys.exit("error, could not determine base format for {0}, check swizzle".format(fmat.name));
 
 def get_gl_data_type(fmat):
    if fmat.is_compressed():
index 522bce356821b7b2fb76fa8b913a09ba2f3bd989..11184f78e2c18c7283289a6eab3a0890203fc942 100755 (executable)
@@ -24,6 +24,8 @@
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
+import sys
+
 VOID = 'x'
 UNSIGNED = 'u'
 SIGNED = 's'
@@ -562,7 +564,10 @@ def parse(filename):
          block_height = int(fields[3])
          colorspace = fields[9]
 
-         swizzle = Swizzle(fields[8])
+         try:
+            swizzle = Swizzle(fields[8])
+         except:
+            sys.exit("error parsing swizzle for format " + name)
          channels = _parse_channels(fields[4:8], layout, colorspace, swizzle)
 
          yield Format(name, layout, block_width, block_height, channels, swizzle, colorspace)