reflect: remove get_prefix from get_texture_semantic/get_unique_semantic

This commit is contained in:
chyyran 2024-09-05 02:20:53 -04:00 committed by Ronny Chan
parent c9a6411394
commit 820fb69328
2 changed files with 8 additions and 8 deletions

View file

@ -670,7 +670,7 @@ impl NagaReflect {
let member_type = &module.types[member.ty].inner;
if let Some(parameter) = semantics.uniform_semantics.get_unique_semantic(&name) {
if let Some(parameter) = semantics.uniform_semantics.unique_semantic(&name) {
let Some(typeinfo) = parameter.semantics.validate_type(&member_type) else {
return Err(blame.error(SemanticsErrorKind::InvalidTypeForSemantic(name)));
};
@ -748,7 +748,7 @@ impl NagaReflect {
}
}
}
} else if let Some(texture) = semantics.uniform_semantics.get_texture_semantic(&name) {
} else if let Some(texture) = semantics.uniform_semantics.texture_semantic(&name) {
let Some(_typeinfo) = texture.semantics.validate_type(&member_type) else {
return Err(blame.error(SemanticsErrorKind::InvalidTypeForSemantic(name)));
};
@ -847,7 +847,7 @@ impl NagaReflect {
) -> Result<(), ShaderReflectError> {
let Some(semantic) = semantics
.texture_semantics
.get_texture_semantic(texture.name)
.texture_semantic(texture.name)
else {
return Err(
SemanticErrorBlame::Fragment.error(SemanticsErrorKind::UnknownSemantics(

View file

@ -318,11 +318,11 @@ impl UniformMeta for TextureSizeMeta {
/// A trait for maps that can return texture semantic units.
pub trait TextureSemanticMap {
/// Get the texture semantic for the given variable name.
fn get_texture_semantic(&self, name: &str) -> Option<Semantic<TextureSemantics>>;
fn texture_semantic(&self, name: &str) -> Option<Semantic<TextureSemantics>>;
}
impl TextureSemanticMap for FastHashMap<ShortString, UniformSemantic> {
fn get_texture_semantic(&self, name: &str) -> Option<Semantic<TextureSemantics>> {
fn texture_semantic(&self, name: &str) -> Option<Semantic<TextureSemantics>> {
match self.get(name) {
None => {
if let Some(semantics) = TextureSemantics::TEXTURE_SEMANTICS
@ -354,7 +354,7 @@ impl TextureSemanticMap for FastHashMap<ShortString, UniformSemantic> {
}
impl TextureSemanticMap for FastHashMap<ShortString, Semantic<TextureSemantics>> {
fn get_texture_semantic(&self, name: &str) -> Option<Semantic<TextureSemantics>> {
fn texture_semantic(&self, name: &str) -> Option<Semantic<TextureSemantics>> {
match self.get(name) {
None => {
if let Some(semantics) = TextureSemantics::TEXTURE_SEMANTICS
@ -387,11 +387,11 @@ impl TextureSemanticMap for FastHashMap<ShortString, Semantic<TextureSemantics>>
/// A trait for maps that can return unique semantic units.
pub trait UniqueSemanticMap {
/// Get the unique semantic for the given variable name.
fn get_unique_semantic(&self, name: &str) -> Option<Semantic<UniqueSemantics, ()>>;
fn unique_semantic(&self, name: &str) -> Option<Semantic<UniqueSemantics, ()>>;
}
impl UniqueSemanticMap for FastHashMap<ShortString, UniformSemantic> {
fn get_unique_semantic(&self, name: &str) -> Option<Semantic<UniqueSemantics, ()>> {
fn unique_semantic(&self, name: &str) -> Option<Semantic<UniqueSemantics, ()>> {
match self.get(name) {
// existing uniforms in the semantic map have priority
None => match name {