GPUShader: Change shader state tracking to be part of the GPUContext
This remove the use of batch->program and replace it with batch->shader. This will allow GL abstraction latter.
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
|
||||
static bool bpygpu_batch_is_program_or_error(BPyGPUBatch *self)
|
||||
{
|
||||
if (!glIsProgram(self->batch->program)) {
|
||||
if (!self->batch->shader) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "batch does not have any program assigned to it");
|
||||
return false;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ static PyObject *bpygpu_Batch_draw(BPyGPUBatch *self, PyObject *args)
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else if (self->batch->program != GPU_shader_get_program(py_program->shader)) {
|
||||
else if (self->batch->shader != py_program->shader) {
|
||||
GPU_batch_set_shader(self->batch, py_program->shader);
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ static PyObject *bpygpu_Batch_program_use_begin(BPyGPUBatch *self)
|
||||
if (!bpygpu_batch_is_program_or_error(self)) {
|
||||
return NULL;
|
||||
}
|
||||
GPU_batch_program_use_begin(self->batch);
|
||||
GPU_shader_bind(self->batch->shader);
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ static PyObject *bpygpu_Batch_program_use_end(BPyGPUBatch *self)
|
||||
if (!bpygpu_batch_is_program_or_error(self)) {
|
||||
return NULL;
|
||||
}
|
||||
GPU_batch_program_use_end(self->batch);
|
||||
GPU_shader_unbind();
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user