mirror of
https://github.com/MobileGL-Dev/MobileGlues.git
synced 2025-09-22 10:42:11 -04:00
[Fix] (multidraw: compute): restore original program
This commit is contained in:
parent
8145ed3308
commit
8ef12ff1ac
@ -267,17 +267,8 @@ void main() {
|
|||||||
if (outIdx >= prefixSums[prefixSums.length() - 1])
|
if (outIdx >= prefixSums[prefixSums.length() - 1])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// bisect to find out draw call #
|
// Find out draw call #
|
||||||
int low = 0;
|
int low = 0;
|
||||||
// int high = draws.length() - 1;
|
|
||||||
// while (low < high) {
|
|
||||||
// int mid = (low + high + 1) / 2;
|
|
||||||
// if (prefixSums[mid] <= outIdx) {
|
|
||||||
// low = mid;
|
|
||||||
// } else {
|
|
||||||
// high = mid - 1;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
int l = draws.length() - 1;
|
int l = draws.length() - 1;
|
||||||
for (low = 0; low < l; ++low) {
|
for (low = 0; low < l; ++low) {
|
||||||
if (prefixSums[low] > outIdx) {
|
if (prefixSums[low] > outIdx) {
|
||||||
@ -433,6 +424,8 @@ GLAPI GLAPIENTRY void mg_glMultiDrawElementsBaseVertex_compute(
|
|||||||
|
|
||||||
// Bind index buffer and do draw
|
// Bind index buffer and do draw
|
||||||
LOG_D("draw")
|
LOG_D("draw")
|
||||||
|
GLES.glUseProgram(prev_program);
|
||||||
|
CHECK_GL_ERROR_NO_INIT
|
||||||
GLES.glBindBuffer(GL_VERTEX_ARRAY, prev_vb);
|
GLES.glBindBuffer(GL_VERTEX_ARRAY, prev_vb);
|
||||||
CHECK_GL_ERROR_NO_INIT
|
CHECK_GL_ERROR_NO_INIT
|
||||||
GLES.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_outputibo);
|
GLES.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, g_outputibo);
|
||||||
|
@ -18,20 +18,10 @@ layout(std430, binding = 3) writeonly buffer Output { uint out_indices[]; };
|
|||||||
void main() {
|
void main() {
|
||||||
uint outIdx = gl_GlobalInvocationID.x;
|
uint outIdx = gl_GlobalInvocationID.x;
|
||||||
if (outIdx >= prefixSums[prefixSums.length() - 1])
|
if (outIdx >= prefixSums[prefixSums.length() - 1])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// bisect to find out draw call #
|
// Find out draw call #
|
||||||
int low = 0;
|
int low = 0;
|
||||||
// int high = draws.length() - 1;
|
|
||||||
// while (low < high) {
|
|
||||||
// int mid = (low + )
|
|
||||||
// int mid = (low + high + 1) / 2;
|
|
||||||
// if (prefixSums[mid] <= outIdx) {
|
|
||||||
// low = mid;
|
|
||||||
// } else {
|
|
||||||
// high = mid - 1;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
int l = draws.length() - 1;
|
int l = draws.length() - 1;
|
||||||
for (low = 0; low < l; ++low) {
|
for (low = 0; low < l; ++low) {
|
||||||
if (prefixSums[low] > outIdx) {
|
if (prefixSums[low] > outIdx) {
|
||||||
@ -41,7 +31,7 @@ void main() {
|
|||||||
|
|
||||||
// figure out which index to take
|
// figure out which index to take
|
||||||
DrawCommand cmd = draws[low];
|
DrawCommand cmd = draws[low];
|
||||||
uint localIdx = outIdx - prefixSums[low];
|
uint localIdx = outIdx - ((low == 0) ? 0u : (prefixSums[low - 1]));
|
||||||
uint inIndex = localIdx + cmd.firstIndex;
|
uint inIndex = localIdx + cmd.firstIndex;
|
||||||
|
|
||||||
// Write out
|
// Write out
|
||||||
|
Loading…
x
Reference in New Issue
Block a user