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

Function lib_hlsl_Texture_Sample

src/HLSLLibrary.cpp:458–478  ·  view source on GitHub ↗

Texture1/2/3D */

Source from the content-addressed store, hash-verified

456
457 /* Texture1/2/3D */
458 bv_variable lib_hlsl_Texture_Sample(bv_program* prog, bv_object* me, u8 argc, bv_variable* args)
459 {
460 /* TODO: clamp LOD, etc... */
461 if (argc >= 2) {
462 bv_object* samplerState = bv_variable_get_object(args[0]);
463
464 // Texture1D/2D/3D
465 if (IsBasicTexture(me->type->name)) {
466 Texture* tex = (Texture*)me->user_data;
467 glm::vec3 uv = sd::AsVector<3, float>(args[1]);
468
469 float lod = 0.0f; // TODO: LOD calculation
470
471 glm::vec4 sample = tex->Sample(uv.x, uv.y, uv.z, lod);
472
473 return Common::create_float4(prog, sample);
474 }
475 }
476
477 return Common::create_float4(prog);
478 }
479
480 bv_library* Library()
481 {

Callers

nothing calls this directly

Calls 3

IsBasicTextureFunction · 0.85
create_float4Function · 0.85
SampleMethod · 0.80

Tested by

no test coverage detected