mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
compiler/spirv: add a fail if tex instr coord components aren't dimensional enough
this is really hard to pin down later on, so catch it here instead gotta have those dimensions. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12825>
This commit is contained in:
parent
c38318aee2
commit
361a7d2451
1 changed files with 9 additions and 0 deletions
|
|
@ -2803,6 +2803,15 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
|
|||
|
||||
struct vtn_ssa_value *coord_val = vtn_ssa_value(b, w[idx++]);
|
||||
coord = coord_val->def;
|
||||
/* From the SPIR-V spec verxion 1.5, rev. 5:
|
||||
*
|
||||
* "Coordinate must be a scalar or vector of floating-point type. It
|
||||
* contains (u[, v] ... [, array layer]) as needed by the definition
|
||||
* of Sampled Image. It may be a vector larger than needed, but all
|
||||
* unused components appear after all used components."
|
||||
*/
|
||||
vtn_fail_if(coord->num_components < coord_components,
|
||||
"Coordinate value passed has fewer components than sampler dimensionality.");
|
||||
p->src = nir_src_for_ssa(nir_channels(&b->nb, coord,
|
||||
(1 << coord_components) - 1));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue