mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
[glsl-in] Provide default interpolation
This commit is contained in:
committed by
Dzmitry Malyshau
parent
9464a81ae2
commit
f57739d30b
@@ -1,6 +1,7 @@
|
||||
use crate::{
|
||||
Binding, Block, BuiltIn, Constant, Expression, GlobalVariable, Handle, ImageClass,
|
||||
LocalVariable, ScalarKind, StorageAccess, StorageClass, Type, TypeInner, VectorSize,
|
||||
Interpolation, LocalVariable, ScalarKind, StorageAccess, StorageClass, Type, TypeInner,
|
||||
VectorSize,
|
||||
};
|
||||
|
||||
use super::ast::*;
|
||||
@@ -297,6 +298,13 @@ impl Program<'_> {
|
||||
|
||||
if let Some(location) = location {
|
||||
let input = StorageQualifier::Input == storage;
|
||||
let interpolation = self.module.types[ty].inner.scalar_kind().map(|kind| {
|
||||
if let ScalarKind::Float = kind {
|
||||
Interpolation::Perspective
|
||||
} else {
|
||||
Interpolation::Flat
|
||||
}
|
||||
});
|
||||
|
||||
let handle = self.module.global_variables.append(GlobalVariable {
|
||||
name: Some(name.clone()),
|
||||
|
||||
Reference in New Issue
Block a user