small fix
This commit is contained in:
@@ -500,6 +500,7 @@ ne_ScreenBuffer *ne_gpu_currentBuffer(ne_GPUState *state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nn_Exit ne_gpu_handler(nn_GPURequest *req) {
|
nn_Exit ne_gpu_handler(nn_GPURequest *req) {
|
||||||
|
// completely rewrite this buggy and incomplete mess.
|
||||||
nn_Computer *C = req->computer;
|
nn_Computer *C = req->computer;
|
||||||
ne_GPUState *state = req->instance;
|
ne_GPUState *state = req->instance;
|
||||||
|
|
||||||
|
|||||||
@@ -3591,6 +3591,7 @@ nn_Exit nn_gpu_handler(nn_ComponentRequest *req) {
|
|||||||
req->methodEnabled = true;
|
req->methodEnabled = true;
|
||||||
return NN_OK;
|
return NN_OK;
|
||||||
case NN_COMP_CALL:
|
case NN_COMP_CALL:
|
||||||
|
// TODO: completely rewrite this buggy mess
|
||||||
if(method == NN_GPUNUM_BIND) {
|
if(method == NN_GPUNUM_BIND) {
|
||||||
if(nn_checkstring(C, 0, "bad argument #1 (string expected)")) return NN_EBADCALL;
|
if(nn_checkstring(C, 0, "bad argument #1 (string expected)")) return NN_EBADCALL;
|
||||||
err = nn_defaultboolean(C, 1, false);
|
err = nn_defaultboolean(C, 1, false);
|
||||||
@@ -3746,13 +3747,26 @@ nn_Exit nn_gpu_handler(nn_ComponentRequest *req) {
|
|||||||
req->returnCount = 1;
|
req->returnCount = 1;
|
||||||
return nn_pushinteger(C, greq.x);
|
return nn_pushinteger(C, greq.x);
|
||||||
}
|
}
|
||||||
if(method == NN_GPUNUM_SETDEPTH) {
|
if(method == NN_GPUNUM_MAXDEPTH) {
|
||||||
greq.action = NN_GPU_MAXDEPTH;
|
greq.action = NN_GPU_MAXDEPTH;
|
||||||
err = state->handler(&greq);
|
err = state->handler(&greq);
|
||||||
if(err) return err;
|
if(err) return err;
|
||||||
req->returnCount = 1;
|
req->returnCount = 1;
|
||||||
return nn_pushinteger(C, greq.x);
|
return nn_pushinteger(C, greq.x);
|
||||||
}
|
}
|
||||||
|
if(method == NN_GPUNUM_SETDEPTH) {
|
||||||
|
if(nn_checkinteger(C, 0, "bad argument #1 (bitdepth expected)")) return NN_EBADCALL;
|
||||||
|
greq.action = NN_GPU_SETDEPTH;
|
||||||
|
err = state->handler(&greq);
|
||||||
|
greq.x = nn_tointeger(C, 0);
|
||||||
|
if(nn_depthName(greq.x) == NULL) {
|
||||||
|
nn_setError(C, "bad depth");
|
||||||
|
return NN_EBADCALL;
|
||||||
|
}
|
||||||
|
if(err) return err;
|
||||||
|
req->returnCount = 1;
|
||||||
|
return nn_pushstring(C, nn_depthName(greq.x));
|
||||||
|
}
|
||||||
if(method == NN_GPUNUM_GETVIEWPORT) {
|
if(method == NN_GPUNUM_GETVIEWPORT) {
|
||||||
greq.action = NN_GPU_GETVIEWPORT;
|
greq.action = NN_GPU_GETVIEWPORT;
|
||||||
err = state->handler(&greq);
|
err = state->handler(&greq);
|
||||||
@@ -3836,6 +3850,20 @@ nn_Exit nn_gpu_handler(nn_ComponentRequest *req) {
|
|||||||
if(err) return err;
|
if(err) return err;
|
||||||
return NN_OK;
|
return NN_OK;
|
||||||
}
|
}
|
||||||
|
// VRAM shenanigans
|
||||||
|
if(method == NN_GPUNUM_GETBUFFERSIZE) {
|
||||||
|
err = nn_defaultinteger(C, 0, 0);
|
||||||
|
if(err) return err;
|
||||||
|
if(nn_checkinteger(C, 0, "bad argument #1 (integer expected)")) return NN_EBADCALL;
|
||||||
|
greq.x = nn_tointeger(C, 0);
|
||||||
|
greq.action = greq.x == 0 ? NN_GPU_GETRESOLUTION : NN_GPU_GETBUFFERSIZE;
|
||||||
|
err = state->handler(&greq);
|
||||||
|
if(err) return err;
|
||||||
|
req->returnCount = 2;
|
||||||
|
err = nn_pushinteger(C, greq.width);
|
||||||
|
if(err) return err;
|
||||||
|
return nn_pushinteger(C, greq.height);
|
||||||
|
}
|
||||||
nn_setError(C, "method not yet implemented");
|
nn_setError(C, "method not yet implemented");
|
||||||
return NN_EBADCALL;
|
return NN_EBADCALL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user