[android-about-menu-info] Have information populate the GLES2 and GLES3 tabs.
There is a /lot/ of information in these tabs, we may have to think about changing how the information looks OpenGL isn't done yet since there are a million limits on desktop GL, may just show a few things and extensions there.
This commit is contained in:
parent
0dc437e94d
commit
d3ccf1c7b5
|
@ -10,9 +10,17 @@ import android.app.Activity;
|
|||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v13.app.FragmentPagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Activity for the about menu, which displays info
|
||||
|
@ -23,6 +31,77 @@ public final class AboutActivity extends Activity implements TabListener
|
|||
private ViewPager viewPager;
|
||||
private EGLHelper eglHelper = new EGLHelper(EGLHelper.EGL_OPENGL_ES2_BIT);
|
||||
|
||||
// Represents an item in the multiple About fragments.
|
||||
public static final class AboutFragmentItem
|
||||
{
|
||||
private final String title;
|
||||
private final String subtitle;
|
||||
|
||||
public AboutFragmentItem(String title, String subtitle)
|
||||
{
|
||||
this.title = title;
|
||||
this.subtitle = subtitle;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getSubTitle()
|
||||
{
|
||||
return subtitle;
|
||||
}
|
||||
}
|
||||
|
||||
// The adapter that manages the displaying of items in multiple About fragments.
|
||||
public static final class InfoFragmentAdapter extends ArrayAdapter<AboutFragmentItem>
|
||||
{
|
||||
private final Context ctx;
|
||||
private final int id;
|
||||
private final List<AboutFragmentItem> items;
|
||||
|
||||
public InfoFragmentAdapter(Context ctx, int id, List<AboutFragmentItem> items)
|
||||
{
|
||||
super(ctx, id, items);
|
||||
|
||||
this.ctx = ctx;
|
||||
this.id = id;
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AboutFragmentItem getItem(int index)
|
||||
{
|
||||
return items.get(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
if (convertView == null)
|
||||
{
|
||||
LayoutInflater vi = LayoutInflater.from(ctx);
|
||||
convertView = vi.inflate(id, parent, false);
|
||||
}
|
||||
|
||||
final AboutFragmentItem item = items.get(position);
|
||||
if (item != null)
|
||||
{
|
||||
TextView title = (TextView) convertView.findViewById(R.id.AboutItemTitle);
|
||||
TextView subtitle = (TextView) convertView.findViewById(R.id.AboutItemSubTitle);
|
||||
|
||||
if (title != null)
|
||||
title.setText(item.getTitle());
|
||||
|
||||
if (subtitle != null)
|
||||
subtitle.setText(item.getSubTitle());
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
|
@ -109,12 +188,12 @@ public final class AboutActivity extends Activity implements TabListener
|
|||
}
|
||||
else if (position == 2) // GLES 2
|
||||
{
|
||||
return new Fragment();
|
||||
return new GLES2InfoFragment();
|
||||
}
|
||||
else if (position == 3) // GLES 3 or OpenGL (depending on circumstances)
|
||||
{
|
||||
if (eglHelper.supportsGLES3())
|
||||
return new Fragment(); // TODO: Return the GLES 3 fragment in this case (normal case)
|
||||
return new GLES3InfoFragment(); // TODO: Return the GLES 3 fragment in this case (normal case)
|
||||
else
|
||||
return new Fragment(); // TODO: Return the OpenGL fragment in this case (GLES3 not supported case)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
/**
|
||||
* Copyright 2013 Dolphin Emulator Project
|
||||
* Licensed under GPLv2
|
||||
* Refer to the license.txt file included.
|
||||
*/
|
||||
|
||||
package org.dolphinemu.dolphinemu.about;
|
||||
|
||||
import android.app.ListFragment;
|
||||
import android.opengl.GLES10;
|
||||
import android.opengl.GLES20;
|
||||
import android.opengl.GLES30;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.utils.EGLHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
public class GLES2InfoFragment extends ListFragment {
|
||||
|
||||
private EGLHelper eglHelper = new EGLHelper(EGLHelper.EGL_OPENGL_ES2_BIT);
|
||||
|
||||
public static final int TYPE_STRING = 0;
|
||||
public static final int TYPE_INTEGER = 1;
|
||||
public static final int TYPE_INTEGER_RANGE = 2;
|
||||
|
||||
class Limit
|
||||
{
|
||||
public final String name;
|
||||
public final int glEnum;
|
||||
public final int type;
|
||||
|
||||
public Limit(String name, int glEnum, int type)
|
||||
{
|
||||
this.name = name;
|
||||
this.glEnum = glEnum;
|
||||
this.type = type;
|
||||
}
|
||||
public String GetValue()
|
||||
{
|
||||
if (type == TYPE_INTEGER)
|
||||
return Integer.toString(eglHelper.glGetInteger(glEnum));
|
||||
return eglHelper.glGetString(glEnum);
|
||||
}
|
||||
}
|
||||
|
||||
private final Limit Limits[] = {
|
||||
new Limit("Vendor", GL10.GL_VENDOR, TYPE_STRING),
|
||||
new Limit("Version", GL10.GL_VERSION, TYPE_STRING),
|
||||
new Limit("Renderer", GL10.GL_RENDERER, TYPE_STRING),
|
||||
new Limit("GLSL version", GLES20.GL_SHADING_LANGUAGE_VERSION, TYPE_STRING),
|
||||
// GLES 2.0 Limits
|
||||
//new Limit("Aliased Point Size", GLES20.GL_ALIASED_POINT_SIZE_RANGE, TYPE_INTEGER_RANGE),
|
||||
//new Limit("Aliased Line Width ", GLES20.GL_ALIASED_LINE_WIDTH_RANGE, TYPE_INTEGER_RANGE),
|
||||
new Limit("Max Texture Size", GLES20.GL_MAX_TEXTURE_SIZE, TYPE_INTEGER),
|
||||
//new Limit("Viewport Dimensions", GLES20.GL_MAX_VIEWPORT_DIMS, TYPE_INTEGER_RANGE),
|
||||
new Limit("Subpixel Bits", GLES20.GL_SUBPIXEL_BITS, TYPE_INTEGER),
|
||||
new Limit("Max Vertex Attributes", GLES20.GL_MAX_VERTEX_ATTRIBS, TYPE_INTEGER),
|
||||
new Limit("Max Vertex Uniform Vectors", GLES20.GL_MAX_VERTEX_UNIFORM_VECTORS, TYPE_INTEGER),
|
||||
new Limit("Max Varying Vectors", GLES20.GL_MAX_VARYING_VECTORS, TYPE_INTEGER),
|
||||
new Limit("Max Combined Texture Units", GLES20.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, TYPE_INTEGER),
|
||||
new Limit("Max Vertex Texture Units", GLES20.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, TYPE_INTEGER),
|
||||
new Limit("Max Texture Units", GLES20.GL_MAX_TEXTURE_IMAGE_UNITS, TYPE_INTEGER),
|
||||
new Limit("Max Fragment Uniform Vectors", GLES20.GL_MAX_FRAGMENT_UNIFORM_VECTORS, TYPE_INTEGER),
|
||||
new Limit("Max Cubemap Texture Size", GLES20.GL_MAX_CUBE_MAP_TEXTURE_SIZE, TYPE_INTEGER),
|
||||
new Limit("Shader Binary Formats", GLES20.GL_NUM_SHADER_BINARY_FORMATS, TYPE_INTEGER),
|
||||
new Limit("Max Framebuffer Size", GLES20.GL_MAX_RENDERBUFFER_SIZE, TYPE_INTEGER),
|
||||
};
|
||||
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
ListView rootView = (ListView) inflater.inflate(R.layout.gamelist_listview, container, false);
|
||||
|
||||
|
||||
List<AboutActivity.AboutFragmentItem> Input = new ArrayList<AboutActivity.AboutFragmentItem>();
|
||||
|
||||
for(Limit limit : Limits)
|
||||
{
|
||||
Log.w("Dolphinemu", "Getting enum " + limit.name);
|
||||
Input.add(new AboutActivity.AboutFragmentItem(limit.name, limit.GetValue()));
|
||||
}
|
||||
|
||||
// Get extensions manually
|
||||
String ExtensionsString = eglHelper.glGetString(GLES20.GL_EXTENSIONS);
|
||||
String Extensions[] = ExtensionsString.split(" ");
|
||||
String FinalExtensions = "";
|
||||
for (String Extension : Extensions)
|
||||
FinalExtensions += Extension + "\n";
|
||||
Input.add(new AboutActivity.AboutFragmentItem("OpenGL ES 2.0 Extensions", FinalExtensions));
|
||||
|
||||
AboutActivity.InfoFragmentAdapter adapter = new AboutActivity.InfoFragmentAdapter(getActivity(), R.layout.about_layout, Input);
|
||||
rootView.setAdapter(adapter);
|
||||
|
||||
return rootView;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
/**
|
||||
* Copyright 2013 Dolphin Emulator Project
|
||||
* Licensed under GPLv2
|
||||
* Refer to the license.txt file included.
|
||||
*/
|
||||
|
||||
package org.dolphinemu.dolphinemu.about;
|
||||
|
||||
import android.app.ListFragment;
|
||||
import android.opengl.GLES10;
|
||||
import android.opengl.GLES20;
|
||||
import android.opengl.GLES30;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.utils.EGLHelper;
|
||||
|
||||
import java.sql.Struct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
public class GLES3InfoFragment extends ListFragment {
|
||||
|
||||
private EGLHelper eglHelper = new EGLHelper(EGLHelper.EGL_OPENGL_ES3_BIT_KHR);
|
||||
|
||||
public static final int TYPE_STRING = 0;
|
||||
public static final int TYPE_INTEGER = 1;
|
||||
public static final int TYPE_INTEGER_RANGE = 2;
|
||||
|
||||
class Limit
|
||||
{
|
||||
public final String name;
|
||||
public final int glEnum;
|
||||
public final int type;
|
||||
|
||||
public Limit(String name, int glEnum, int type)
|
||||
{
|
||||
this.name = name;
|
||||
this.glEnum = glEnum;
|
||||
this.type = type;
|
||||
}
|
||||
public String GetValue()
|
||||
{
|
||||
if (type == TYPE_INTEGER)
|
||||
return Integer.toString(eglHelper.glGetInteger(glEnum));
|
||||
return eglHelper.glGetString(glEnum);
|
||||
}
|
||||
}
|
||||
|
||||
private final Limit Limits[] = {
|
||||
new Limit("Vendor", GL10.GL_VENDOR, TYPE_STRING),
|
||||
new Limit("Version", GL10.GL_VERSION, TYPE_STRING),
|
||||
new Limit("Renderer", GL10.GL_RENDERER, TYPE_STRING),
|
||||
new Limit("GLSL version", GLES20.GL_SHADING_LANGUAGE_VERSION, TYPE_STRING),
|
||||
// GLES 2.0 Limits
|
||||
//new Limit("Aliased Point Size", GLES20.GL_ALIASED_POINT_SIZE_RANGE, TYPE_INTEGER_RANGE),
|
||||
//new Limit("Aliased Line Width ", GLES20.GL_ALIASED_LINE_WIDTH_RANGE, TYPE_INTEGER_RANGE),
|
||||
new Limit("Max Texture Size", GLES20.GL_MAX_TEXTURE_SIZE, TYPE_INTEGER),
|
||||
//new Limit("Viewport Dimensions", GLES20.GL_MAX_VIEWPORT_DIMS, TYPE_INTEGER_RANGE),
|
||||
new Limit("Subpixel Bits", GLES20.GL_SUBPIXEL_BITS, TYPE_INTEGER),
|
||||
new Limit("Max Vertex Attributes", GLES20.GL_MAX_VERTEX_ATTRIBS, TYPE_INTEGER),
|
||||
new Limit("Max Vertex Uniform Vectors", GLES20.GL_MAX_VERTEX_UNIFORM_VECTORS, TYPE_INTEGER),
|
||||
new Limit("Max Varying Vectors", GLES20.GL_MAX_VARYING_VECTORS, TYPE_INTEGER),
|
||||
new Limit("Max Combined Texture Units", GLES20.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, TYPE_INTEGER),
|
||||
new Limit("Max Vertex Texture Units", GLES20.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, TYPE_INTEGER),
|
||||
new Limit("Max Texture Units", GLES20.GL_MAX_TEXTURE_IMAGE_UNITS, TYPE_INTEGER),
|
||||
new Limit("Max Fragment Uniform Vectors", GLES20.GL_MAX_FRAGMENT_UNIFORM_VECTORS, TYPE_INTEGER),
|
||||
new Limit("Max Cubemap Texture Size", GLES20.GL_MAX_CUBE_MAP_TEXTURE_SIZE, TYPE_INTEGER),
|
||||
new Limit("Shader Binary Formats", GLES20.GL_NUM_SHADER_BINARY_FORMATS, TYPE_INTEGER),
|
||||
new Limit("Max Framebuffer Size", GLES20.GL_MAX_RENDERBUFFER_SIZE, TYPE_INTEGER),
|
||||
// GLES 3.0 limits
|
||||
new Limit("Max 3D Texture size", GLES30.GL_MAX_3D_TEXTURE_SIZE, TYPE_INTEGER),
|
||||
new Limit("Max Element Vertices", GLES30.GL_MAX_ELEMENTS_VERTICES, TYPE_INTEGER),
|
||||
new Limit("Max Element Indices", GLES30.GL_MAX_ELEMENTS_INDICES, TYPE_INTEGER),
|
||||
new Limit("Max Draw Buffers", GLES30.GL_MAX_DRAW_BUFFERS, TYPE_INTEGER),
|
||||
new Limit("Max Fragment Uniform Components", GLES30.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, TYPE_INTEGER),
|
||||
new Limit("Max Vertex Uniform Components", GLES30.GL_MAX_VERTEX_UNIFORM_COMPONENTS, TYPE_INTEGER),
|
||||
new Limit("Number of Extensions", GLES30.GL_NUM_EXTENSIONS, TYPE_INTEGER),
|
||||
new Limit("Max Array Texture Layers", GLES30.GL_MAX_ARRAY_TEXTURE_LAYERS, TYPE_INTEGER),
|
||||
new Limit("Min Program Texel Offset", GLES30.GL_MIN_PROGRAM_TEXEL_OFFSET, TYPE_INTEGER),
|
||||
new Limit("Max Program Texel Offset", GLES30.GL_MAX_PROGRAM_TEXEL_OFFSET, TYPE_INTEGER),
|
||||
new Limit("Max Varying Components", GLES30.GL_MAX_VARYING_COMPONENTS, TYPE_INTEGER),
|
||||
new Limit("Max TF Varying Length", GLES30.GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, TYPE_INTEGER),
|
||||
new Limit("Max TF Separate Components", GLES30.GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS, TYPE_INTEGER),
|
||||
new Limit("Max TF Interleaved Components", GLES30.GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, TYPE_INTEGER),
|
||||
new Limit("Max TF Separate Attributes", GLES30.GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, TYPE_INTEGER),
|
||||
new Limit("Max Color Attachments", GLES30.GL_MAX_COLOR_ATTACHMENTS, TYPE_INTEGER),
|
||||
new Limit("Max Samples", GLES30.GL_MAX_SAMPLES, TYPE_INTEGER),
|
||||
new Limit("Max Vertex UBOs", GLES30.GL_MAX_VERTEX_UNIFORM_BLOCKS, TYPE_INTEGER),
|
||||
new Limit("Max Fragment UBOs", GLES30.GL_MAX_FRAGMENT_UNIFORM_BLOCKS, TYPE_INTEGER),
|
||||
new Limit("Max Combined UBOs", GLES30.GL_MAX_COMBINED_UNIFORM_BLOCKS, TYPE_INTEGER),
|
||||
new Limit("Max Uniform Buffer Bindings", GLES30.GL_MAX_UNIFORM_BUFFER_BINDINGS, TYPE_INTEGER),
|
||||
new Limit("Max UBO Size", GLES30.GL_MAX_UNIFORM_BLOCK_SIZE, TYPE_INTEGER),
|
||||
new Limit("Max Combined Vertex Uniform Components", GLES30.GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, TYPE_INTEGER),
|
||||
new Limit("Max Combined Fragment Uniform Components", GLES30.GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, TYPE_INTEGER),
|
||||
new Limit("UBO Alignment", GLES30.GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, TYPE_INTEGER),
|
||||
new Limit("Max Vertex Output Components", GLES30.GL_MAX_VERTEX_OUTPUT_COMPONENTS, TYPE_INTEGER),
|
||||
new Limit("Max Fragment Input Components", GLES30.GL_MAX_FRAGMENT_INPUT_COMPONENTS, TYPE_INTEGER),
|
||||
new Limit("Max Server Wait Timeout", GLES30.GL_MAX_SERVER_WAIT_TIMEOUT, TYPE_INTEGER),
|
||||
new Limit("Program Binary Formats", GLES30.GL_NUM_PROGRAM_BINARY_FORMATS, TYPE_INTEGER),
|
||||
new Limit("Max Element Index", GLES30.GL_MAX_ELEMENT_INDEX, TYPE_INTEGER),
|
||||
new Limit("Sample Counts", GLES30.GL_NUM_SAMPLE_COUNTS, TYPE_INTEGER),
|
||||
|
||||
};
|
||||
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
ListView rootView = (ListView) inflater.inflate(R.layout.gamelist_listview, container, false);
|
||||
|
||||
|
||||
List<AboutActivity.AboutFragmentItem> Input = new ArrayList<AboutActivity.AboutFragmentItem>();
|
||||
|
||||
for(Limit limit : Limits)
|
||||
{
|
||||
Log.w("Dolphinemu", "Getting enum " + limit.name);
|
||||
Input.add(new AboutActivity.AboutFragmentItem(limit.name, limit.GetValue()));
|
||||
}
|
||||
|
||||
// Get extensions manually
|
||||
int numExtensions = eglHelper.glGetInteger(GLES30.GL_NUM_EXTENSIONS);
|
||||
String ExtensionsString = "";
|
||||
for (int indx = 0; indx < numExtensions; ++indx)
|
||||
ExtensionsString += eglHelper.glGetStringi(GLES10.GL_EXTENSIONS, indx) + "\n";
|
||||
Input.add(new AboutActivity.AboutFragmentItem("OpenGL ES 3.0 Extensions", ExtensionsString));
|
||||
|
||||
AboutActivity.InfoFragmentAdapter adapter = new AboutActivity.InfoFragmentAdapter(getActivity(), R.layout.about_layout, Input);
|
||||
rootView.setAdapter(adapter);
|
||||
|
||||
return rootView;
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import javax.microedition.khronos.egl.EGLDisplay;
|
|||
import javax.microedition.khronos.egl.EGLSurface;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
import android.opengl.GLES30;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
|
@ -307,4 +308,21 @@ public final class EGLHelper
|
|||
mEGL.eglMakeCurrent(mDisplay, mEGLSurface, mEGLSurface, mEGLContext);
|
||||
mGL = (GL10) mEGLContext.getGL();
|
||||
}
|
||||
|
||||
public String glGetString(int glEnum)
|
||||
{
|
||||
return mGL.glGetString(glEnum);
|
||||
}
|
||||
|
||||
public String glGetStringi(int glEnum, int index)
|
||||
{
|
||||
return GLES30.glGetStringi(glEnum, index);
|
||||
}
|
||||
|
||||
public int glGetInteger(int glEnum)
|
||||
{
|
||||
int[] val = new int[1];
|
||||
mGL.glGetIntegerv(glEnum, val, 0);
|
||||
return val[0];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue