MCPcopy Create free account
hub / github.com/dfranx/ShaderDebugger / TexelFetch

Method TexelFetch

src/Texture.cpp:73–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71 return glm::vec4(mem[0], mem[1], mem[2], mem[3]);
72 }
73 glm::vec4 Texture::TexelFetch(int u, int v, int w, int mip)
74 {
75 if (m_isInvalid())
76 return glm::vec4(1.0f);
77
78 // clamp (TODO: wrap)
79 u = std::min(Width, std::max(0, w));
80 v = std::min(Height, std::max(0, v));
81 w = std::min(Depth, std::max(0, w));
82
83 // clamp mipmap level
84 mip = std::min(MipmapLevels, std::max(0, mip));
85
86 float* mem = &Data[mip][(u + Width * (v + Depth * w)) * 4];
87
88 return glm::vec4(mem[0], mem[1], mem[2], mem[3]);
89 }
90 void Texture::m_cleanup()
91 {
92 if (Data != nullptr) {

Callers 2

lib_glsl_texelFetchFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected