File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -844,12 +844,19 @@ impl<'a> NagaBuilder<'a> {
844844 RegisterType :: Constant => {
845845 // Load the index register (e.g. 'va0') as normal, and access the component
846846 // given by 'index_select' (e.g. 'x'). This is 'va0.x' in the above example.
847- let ( base_index, _format ) =
847+ let ( base_index, format ) =
848848 load_register ( & source. index_type , source. reg_num as usize ) ?;
849- let index_expr = self . evaluate_expr ( Expression :: AccessIndex {
850- base : base_index,
851- index : source. index_select as u32 ,
852- } ) ;
849+
850+ // If the index register is a scalar (Float1), use it directly.
851+ // Otherwise, extract the component given by 'index_select'.
852+ let index_expr = if format == VertexAttributeFormat :: Float1 {
853+ base_index
854+ } else {
855+ self . evaluate_expr ( Expression :: AccessIndex {
856+ base : base_index,
857+ index : source. index_select as u32 ,
858+ } )
859+ } ;
853860
854861 // Convert to an integer, since we're going to be indexing an array
855862 let index_integer = self . evaluate_expr ( Expression :: As {
You can’t perform that action at this time.
0 commit comments