summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/formats.h
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2014-11-26 10:38:44 +0100
committerIago Toral Quiroga <[email protected]>2015-01-12 11:20:28 +0100
commit3c19251f28e6b4feff81f48b1c73f1f2e09e38e1 (patch)
tree288a149271204090d31b8cbae00862b5b8ae0508 /src/mesa/main/formats.h
parent3da735cc4c478b0ab2ecc2164899cf9d77dc671a (diff)
mesa: Let _mesa_get_format_base_format also handle mesa_array_format.
If we need the base format for a mesa_array_format we have to find the matching mesa_format first. This is expensive because it requires to loop through all existing mesa formats until we find the right match. We can resolve the base format of an array format directly by looking at its swizzle information. Also, we can have _mesa_get_format_base_format accept an uint32_t which can pack either a mesa_format or a mesa_array_format and resolve the base format for either type. This way clients do not need to check if they have a mesa_format or a mesa_array_format and call different functions depending on the case. Another reason to resolve the base format for array formats directly is that we don't have matching mesa_format enums for every possible array format, so for some GL format/type combinations we can produce array formats that don't have a corresponding mesa format, in which case we would not be able to find the base format. Example format=GL_RGB, type=GL_UNSIGNED_SHORT. This type would map to something like MESA_FORMAT_RGB_UNORM16, but we don't have that. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/main/formats.h')
-rw-r--r--src/mesa/main/formats.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 8656c01d2d8..dd07c35f5d9 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -587,7 +587,7 @@ extern GLenum
_mesa_get_format_datatype(mesa_format format);
extern GLenum
-_mesa_get_format_base_format(mesa_format format);
+_mesa_get_format_base_format(uint32_t format);
extern void
_mesa_get_format_block_size(mesa_format format, GLuint *bw, GLuint *bh);