MCPcopy Create free account
hub / github.com/a2flo/floor / build_mip_map_minification_program

Method build_mip_map_minification_program

src/device/device_image.cpp:198–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198void device_image::build_mip_map_minification_program() const {
199 // build mip-map minify functions (do so in a separate thread so that we don't hold up anything)
200 task::spawn([ctx = dev.context]() {
201 const toolchain::compile_options options {
202 // suppress any debug output for this, we only want to have console/log output if something goes wrong
203 .silence_debug_output = true
204 };
205
206 std::string base_path;
207 switch (ctx->get_platform_type()) {
208 case PLATFORM_TYPE::CUDA:
209 base_path = floor::get_cuda_base_path();
210 break;
211 case PLATFORM_TYPE::OPENCL:
212 base_path = floor::get_opencl_base_path();
213 break;
214 case PLATFORM_TYPE::VULKAN:
215 base_path = floor::get_vulkan_base_path();
216 break;
217 case PLATFORM_TYPE::HOST:
218 // doesn't matter
219 break;
220 default:
221 log_error("backend does not support (or need) mip-map minification functions");
222 return;
223 }
224
225 auto program = ctx->add_program_file(base_path + "include/floor/device/backend/mip_map_minify.hpp", options);
226 if (!program) {
227 log_error("failed to build minify functions");
228 return;
229 }
230
231 provide_minify_program(*ctx, program);
232
233 // TODO: safely/cleanly hold up device_context destruction if the program exits before this is built
234 }, "minify build");
235}
236
237void device_image::generate_mip_map_chain(const device_queue& cqueue) {
238#if defined(FLOOR_HAS_EMBEDDED_MMM_FUBAR)

Callers

nothing calls this directly

Calls 3

spawnFunction · 0.85
get_platform_typeMethod · 0.45
add_program_fileMethod · 0.45

Tested by

no test coverage detected