Skip to content

Commit

Permalink
Simplify the MetalTexture abstraction (AcademySoftwareFoundation#2095)
Browse files Browse the repository at this point in the history
`mx_texture.metal` is used to provide an abstraction to the texture code when being called from GLSL code.

There are a few functions in the interface of this abstraction that do not appear to be used anywhere.

This PR proposes removing them, as a precursor to other upcoming texture work.  I'm proposing this as a separate PR to make things easier to review.

All of the MSL unit tests pass.
  • Loading branch information
ld-kerley authored Oct 31, 2024
1 parent b330fd7 commit 1b2852e
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions libraries/stdlib/genmsl/lib/mx_texture.metal
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@ struct MetalTexture
{
texture2d<float> tex;
sampler s;
int get_width() { return tex.get_width(); }
int get_height() { return tex.get_height(); }
int get_num_mip_levels() { return tex.get_num_mip_levels(); }
};

int get_width(MetalTexture mtlTex) { return mtlTex.get_width(); }

float4 texture(MetalTexture mtlTex, float2 uv)
{
return mtlTex.tex.sample(mtlTex.s, uv);
Expand All @@ -21,10 +16,5 @@ float4 textureLod(MetalTexture mtlTex, float2 uv, float lod)

int2 textureSize(MetalTexture mtlTex, int mipLevel)
{
return int2(mtlTex.get_width(), mtlTex.get_height());
}

int texture_mips(MetalTexture mtlTex)
{
return mtlTex.tex.get_num_mip_levels();
return int2(mtlTex.tex.get_width(), mtlTex.tex.get_height());
}

0 comments on commit 1b2852e

Please sign in to comment.