fix loop leak
This commit is contained in:
@@ -438,7 +438,6 @@ var main_depth = {
|
||||
|
||||
function render_camera(cmds, camera)
|
||||
{
|
||||
|
||||
if (!camera.target) {
|
||||
main_color.width = main_depth.width = prosperon.camera.size.x;
|
||||
main_color.height = main_depth.height = prosperon.camera.size.y;
|
||||
@@ -466,7 +465,7 @@ function render_camera(cmds, camera)
|
||||
|
||||
if (render_queue.length == 0) return;
|
||||
var spritemesh = render._main.make_sprite_mesh(render_queue);
|
||||
return;
|
||||
|
||||
cmds.upload_model(spritemesh);
|
||||
var pass = cmds.render_pass(camera.target);
|
||||
var camera = prosperon.camera;
|
||||
|
||||
@@ -255,10 +255,11 @@ Cmdline.register_order(
|
||||
case "Windows":
|
||||
driver = "direct3d12"
|
||||
break
|
||||
case "Mac OS X":
|
||||
case "macOS":
|
||||
driver = "metal"
|
||||
break
|
||||
}
|
||||
console.log(os.sys())
|
||||
render._main = prosperon.window.make_gpu(false, driver);
|
||||
render._main.window = prosperon.window;
|
||||
render._main.claim_window(prosperon.window);
|
||||
|
||||
@@ -1169,6 +1169,7 @@ void *gpu_buffer_unpack(JSContext *js, SDL_GPUDevice *device, JSValue buffer, si
|
||||
if (!*send_gpu) printf("COULDN'T MAKE GPU BUFFER: %s\n", SDL_GetError());
|
||||
JS_SetPropertyStr(js, buffer, "gpu", SDL_GPUBuffer2js(js,*send_gpu));
|
||||
}
|
||||
JS_FreeValue(js,gpu);
|
||||
}
|
||||
|
||||
if (send_data)
|
||||
@@ -3948,7 +3949,6 @@ JSC_CCALL(gpu_make_sprite_mesh,
|
||||
ret = JS_NewObject(js);
|
||||
|
||||
if (need_new_all) {
|
||||
printf("NEED NEW ALL\n");
|
||||
// Create all new buffers
|
||||
JSValue new_pos = make_gpu_buffer(js, posdata, pos_size, JS_TYPED_ARRAY_FLOAT32, 2, 1,0);
|
||||
JSValue new_uv = make_gpu_buffer(js, uvdata, uv_size, JS_TYPED_ARRAY_FLOAT32, 2, 1,0);
|
||||
@@ -4367,6 +4367,7 @@ JSC_CCALL(renderpass_bind_buffers,
|
||||
JSValue buffer = JS_GetPropertyUint32(js,buffers,i);
|
||||
bindings[i].offset = 0;
|
||||
gpu_buffer_unpack(js,global_gpu, buffer, NULL, NULL,&bindings[i].buffer);
|
||||
JS_FreeValue(js,buffer);
|
||||
}
|
||||
|
||||
SDL_BindGPUVertexBuffers(
|
||||
@@ -4426,10 +4427,10 @@ static const JSCFunctionListEntry js_SDL_GPURenderPass_funcs[] = {
|
||||
MIST_FUNC_DEF(renderpass, draw_indexed, 5),
|
||||
MIST_FUNC_DEF(renderpass, end, 0),
|
||||
MIST_FUNC_DEF(renderpass, bind_index_buffer, 1),
|
||||
MIST_FUNC_DEF(renderpass, bind_buffers, 3),
|
||||
MIST_FUNC_DEF(renderpass, bind_buffers, 2),
|
||||
MIST_FUNC_DEF(renderpass, bind_samplers, 3),
|
||||
MIST_FUNC_DEF(renderpass, bind_storage_buffers, 3),
|
||||
MIST_FUNC_DEF(renderpass, bind_storage_textures, 3),
|
||||
MIST_FUNC_DEF(renderpass, bind_storage_buffers, 2),
|
||||
MIST_FUNC_DEF(renderpass, bind_storage_textures, 2),
|
||||
};
|
||||
|
||||
JSC_CCALL(copypass_end,
|
||||
@@ -5896,6 +5897,7 @@ JSC_CCALL(os_make_transform, return transform2js(js,make_transform()))
|
||||
JSC_SCALL(os_system, return number2js(js,system(str)); )
|
||||
|
||||
JSC_SCALL(os_model_buffer,
|
||||
/*
|
||||
int mesh_idx = 0;
|
||||
|
||||
// Configure cgltf
|
||||
@@ -5927,12 +5929,6 @@ JSC_SCALL(os_model_buffer,
|
||||
return JS_UNDEFINED;
|
||||
}
|
||||
|
||||
/*
|
||||
Build an array of JS material objects, similar to your old code with Assimp.
|
||||
For each cgltf_material in data->materials, we store something in materials[i].
|
||||
This example only sets the "diffuse" property from the PBR base color texture.
|
||||
More properties (metallic, roughness, etc.) can be added similarly.
|
||||
*/
|
||||
JSValue materials[data->materials_count];
|
||||
for (int i = 0; i < (int)data->materials_count; i++) {
|
||||
JSValue mat = JS_NewObject(js);
|
||||
@@ -5960,11 +5956,6 @@ JSC_SCALL(os_model_buffer,
|
||||
// Create an array to hold all the "model" objects
|
||||
JSValue ret_arr = JS_NewArray(js);
|
||||
|
||||
/*
|
||||
Loop over all cgltf_meshes. Each mesh can contain multiple "primitives."
|
||||
Each primitive can have different attributes (POSITION, NORMAL, etc.)
|
||||
and references exactly one material.
|
||||
*/
|
||||
for (int m = 0; m < (int)data->meshes_count; m++) {
|
||||
cgltf_mesh *cgmesh = &data->meshes[m];
|
||||
// Go through each primitive in this mesh
|
||||
@@ -6135,6 +6126,7 @@ JSC_SCALL(os_model_buffer,
|
||||
cgltf_free(data);
|
||||
|
||||
ret = ret_arr;
|
||||
*/
|
||||
)
|
||||
|
||||
JSC_SCALL(os_gltf_buffer,
|
||||
|
||||
Reference in New Issue
Block a user