Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:whyyyyyyyy
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a4d051bf8b4ef2b77c45b56690c030fb5abc05e63ec1240d2da999c26f0e23a9
User & Date: mlatu 2023-05-26 22:44:02.646
Context
2023-05-26
23:34
idgi check-in: d79469382e user: mlatu tags: trunk
22:44
whyyyyyyyy check-in: a4d051bf8b user: mlatu tags: trunk
16:58
window and instance makes surface, surface makes adapter, adapter makes devices, but device wont come check-in: afa1d6464c user: mlatu tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/glfw.aux.h.
50
51
52
53
54
55
56

57
58



59

60
61
62
63
64
65
66
	wgpuInstanceRequestAdapter(
		instance /* equivalent of navigator.gpu */,
		options,
		onAdapterRequestEnded_callback, 
		(void*)userData
	);


    int64_t i = 0;
    while(!userData->requestEnded){i++;};



    printf("got adapter after %I64d cycles\n", i);

    
    WGPUAdapter *result = janet_smalloc(sizeof(WGPUAdapter));
    *result = userData->adapter;
    janet_sfree(userData);
	return result;
}








>
|
|
>
>
>

>







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
	wgpuInstanceRequestAdapter(
		instance /* equivalent of navigator.gpu */,
		options,
		onAdapterRequestEnded_callback, 
		(void*)userData
	);

    printf("will wait for adapter now\n");
    int64_t i = 1;
    for(; i != 0 || !userData->requestEnded;)
    {
      i++;
    }
    printf("got adapter after %I64d cycles\n", i);
    printf("adapter %I64d\n", userData->adapter);
    
    WGPUAdapter *result = janet_smalloc(sizeof(WGPUAdapter));
    *result = userData->adapter;
    janet_sfree(userData);
	return result;
}

89
90
91
92
93
94
95

96
97
98
99
100
101
102
103

104
105



106

107

108
109

110

111
112
 */
WGPUDevice *requestDevice(WGPUAdapter adapter,
                          WGPUDeviceDescriptor const * descriptor) {
    UserData *userData = janet_smalloc(sizeof(UserData));

    userData->device = NULL;
    userData->requestEnded = false;


    wgpuAdapterRequestDevice(
        adapter,
        descriptor,
        onDeviceRequestEnded_callback,
        (void*)&userData
    );


    int64_t i = 0;
    while(!userData->requestEnded){i++;};



    printf("got device after %I64d cycles\n", i);



    WGPUDevice *result = janet_smalloc(sizeof(WGPUDevice));
    *result = userData->device;

    janet_sfree(userData);

    return result;
}







>








>
|
|
>
>
>

>
|
>


>

>


94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
 */
WGPUDevice *requestDevice(WGPUAdapter adapter,
                          WGPUDeviceDescriptor const * descriptor) {
    UserData *userData = janet_smalloc(sizeof(UserData));

    userData->device = NULL;
    userData->requestEnded = false;
    printf("requesting device %I64d\n", userData->device);

    wgpuAdapterRequestDevice(
        adapter,
        descriptor,
        onDeviceRequestEnded_callback,
        (void*)&userData
    );

    printf("will wait for device now\n");
    int64_t i = 1;
    for(; i != 0 || !userData->requestEnded;)
    {
      i++;
    }
    printf("got device after %I64d cycles\n", i);
    printf("device %I64d\n", userData->device);
    
    printf("do we need to free userData? %I64d\n", userData);
    WGPUDevice *result = janet_smalloc(sizeof(WGPUDevice));
    *result = userData->device;
    printf("device still is %I64d\n", *result);
    janet_sfree(userData);
    printf("so do we need to free or not? %I64d\n", userData);
    return result;
}
Changes to test/test0.janet.
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
  (terminate)
  (error "could not create adapter"))

(pp (inspect-wgpu-adapter wgpu-adapter))

(pp "now for the device")
(def wgpu-device (wgpu-create-device wgpu-adapter))
(pp "oh?")
(unless wgpu-device
  (if wgpu-adapter
    (wgpu-destroy-adapter wgpu-adapter)
    (pp "adapter already gone"))
  (if wgpu-surface
    (wgpu-destroy-surface wgpu-surface)
    (pp "surface already gone"))







|







33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
  (terminate)
  (error "could not create adapter"))

(pp (inspect-wgpu-adapter wgpu-adapter))

(pp "now for the device")
(def wgpu-device (wgpu-create-device wgpu-adapter))
(pp "did we get it yet? we did? holy fuck!")
(unless wgpu-device
  (if wgpu-adapter
    (wgpu-destroy-adapter wgpu-adapter)
    (pp "adapter already gone"))
  (if wgpu-surface
    (wgpu-destroy-surface wgpu-surface)
    (pp "surface already gone"))