Skip to content
This repository has been archived by the owner on Apr 27, 2024. It is now read-only.

Commit

Permalink
samsung/adreno quirk: dont use glBufferSubData()
Browse files Browse the repository at this point in the history
  • Loading branch information
hjanetzek committed May 16, 2014
1 parent 607b6d6 commit 9c1ae88
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion vtm-android/src/org/oscim/android/MapView.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public MapView(Context context, AttributeSet attributeSet) {
* samsung S4 and Note3 models */
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT
&& "samsung".equals(Build.MANUFACTURER))
GLAdapter.VBO_TEXTURE_LAYERS = false;
GLAdapter.NO_BUFFER_SUB_DATA = true;

DisplayMetrics metrics = getResources().getDisplayMetrics();
CanvasAdapter.dpi = (int) Math.max(metrics.xdpi, metrics.ydpi);
Expand Down
2 changes: 2 additions & 0 deletions vtm/src/org/oscim/backend/GLAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class GLAdapter {
*/
public static boolean VBO_TEXTURE_LAYERS = true;

public static boolean NO_BUFFER_SUB_DATA = false;

public static GL20 get() {
if (g == null)
throw new IllegalStateException();
Expand Down
8 changes: 5 additions & 3 deletions vtm/src/org/oscim/renderer/BufferObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import javax.annotation.CheckReturnValue;

import org.oscim.backend.GL20;
import org.oscim.backend.GLAdapter;
import org.oscim.utils.pool.Inlist;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -57,9 +58,10 @@ public void loadBufferData(Buffer buf, int newSize) {

GL.glBindBuffer(target, id);

// reuse memory allocated for vbo when possible and allocated
// memory is less then four times the new data
if (!clear && (size > newSize) && (size < newSize * 4)) {
/* reuse memory allocated for vbo when possible and allocated
* memory is less then four times the new data */
if (!GLAdapter.NO_BUFFER_SUB_DATA && !clear &&
(size > newSize) && (size < newSize * 4)) {
GL.glBufferSubData(target, 0, newSize, buf);
} else {
mBufferMemoryUsage += newSize - size;
Expand Down

0 comments on commit 9c1ae88

Please sign in to comment.