Skip to content
This repository has been archived by the owner on Jan 29, 2025. It is now read-only.

Commit

Permalink
glsl-in: texelFetch accept multisampled textures
Browse files Browse the repository at this point in the history
  • Loading branch information
JCapucho committed Feb 3, 2022
1 parent 9b89c5f commit b6b1871
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/front/glsl/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,19 @@ pub fn inject_builtin(declaration: &mut FunctionDeclaration, module: &mut Module
// bits layout
// bit 0 - dim part 1 - 1D/2D
// bit 1 - array
// bit 2 - dim part 2 - 3D
// bit 2 - multisample
// bit 3 - dim part 2 - 3D
//
// 0b100 is the latest since 3D arrayed images aren't allowed
for bits in 0..(0b101) {
let dim = bits & 0b1 | (bits & 0b100) >> 1;
// 0b1000 is the latest since 3D arrayed images aren't allowed
for bits in 0..(0b1001) {
let dim = bits & 0b1 | (bits & 0b1000) >> 2;
let arrayed = bits & 0b10 == 0b10;
let multi = bits & 0b100 == 0b100;

// Multisampled 1d images don't exist
if dim == 0b00 && multi {
continue;
}

let image = TypeInner::Image {
dim: match dim {
Expand All @@ -461,7 +468,7 @@ pub fn inject_builtin(declaration: &mut FunctionDeclaration, module: &mut Module
arrayed,
class: ImageClass::Sampled {
kind: Sk::Float,
multi: false,
multi,
},
};

Expand Down

0 comments on commit b6b1871

Please sign in to comment.