Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the user to override the vertex semantics. #1847

Merged
merged 3 commits into from
May 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="gapic/src/main"/>
<classpathentry excluding="BUILD.bazel" kind="src" path="gapic/src/main"/>
<classpathentry kind="src" path="bazel-genfiles/gapic/src/main"/>
<classpathentry kind="src" path="platform_src"/>
<classpathentry kind="src" path="gapic/res"/>
<classpathentry excluding="BUILD.bazel" kind="src" path="platform_src"/>
<classpathentry excluding="BUILD.bazel" kind="src" path="gapic/res"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="gapic/third_party/guava-20.0.jar" sourcepath="gapic/third_party/guava-20.0-sources.jar"/>
<classpathentry kind="lib" path="gapic/third_party/grpc/grpc-context-1.0.1.jar" sourcepath="gapic/third_party/grpc/grpc-context-1.0.1-sources.jar"/>
Expand Down
18 changes: 13 additions & 5 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
Expand Down Expand Up @@ -35,26 +38,28 @@ org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=info
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=ignore
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=info
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=info
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=info
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
Expand All @@ -67,7 +72,10 @@ org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=info
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
Expand Down
3 changes: 2 additions & 1 deletion cmd/gapit/stresstest.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/google/gapid/core/log"
"github.com/google/gapid/gapis/api"
"github.com/google/gapid/gapis/service"
"github.com/google/gapid/gapis/service/path"
)

type stresstestVerb struct{ StressTestFlags }
Expand Down Expand Up @@ -97,7 +98,7 @@ func (verb *stresstestVerb) Run(ctx context.Context, flags flag.FlagSet) error {
}

case getMesh:
boxedMesh, err := client.Get(ctx, c.Command(at).Mesh(true).Path())
boxedMesh, err := client.Get(ctx, c.Command(at).Mesh(path.NewMeshOptions(true)).Path())
if err == nil {
mesh := boxedMesh.(*api.Mesh)
_ = mesh
Expand Down
Binary file added gapic/res/icons/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gapic/res/icons/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion gapic/src/main/com/google/gapid/image/Histogram.java
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ public int getPercentileBin(int percentile, Set<Stream.Channel> channels) {
}

@SuppressWarnings("ProtocolBufferOrdinal")
private static int getChannelIdx(Stream.Channel channel) {
public static int getChannelIdx(Stream.Channel channel) {
return channel.ordinal();
}
}
4 changes: 2 additions & 2 deletions gapic/src/main/com/google/gapid/models/Strings.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static String getMessage(String identifier) {
}

public static String getMessage(Stringtable.Msg reason) {
return getMessage(reason.getIdentifier(), reason.getArguments());
return getMessage(reason.getIdentifier(), reason.getArgumentsMap());
}

public static String getMessage(String identifier, Map<String, Stringtable.Value> arguments) {
Expand All @@ -61,7 +61,7 @@ public static String getMessage(String identifier, Map<String, Stringtable.Value
}

private static Stringtable.Node getNode(Stringtable.StringTable table, String identifier) {
return table.getEntries().get(identifier);
return table.getEntriesMap().get(identifier);
}

private static StringBuilder getString(
Expand Down
2 changes: 2 additions & 0 deletions gapic/src/main/com/google/gapid/util/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,6 @@ public interface Messages {
"Extra details from the logs and the trace file would be extra helpful.\n\n";
public static final String NO_OPENGL =
"Failed to create an OpenGL context. OpenGL is required to use this application.";
public static final String GEO_SEMANTICS_TITLE = "Vertex Semantics";
public static final String GEO_SEMANTICS_HINT = "Manually configure the vertex stream semantics:";
}
23 changes: 19 additions & 4 deletions gapic/src/main/com/google/gapid/util/Paths.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,26 @@ public static Path.Any resourceAfter(AtomIndex atom, Path.ID id) {
.build();
}

public static Path.Any meshAfter(AtomIndex atom, Path.MeshOptions options,
Vertex.BufferFormat format) {
public static final Path.MeshOptions NODATA_MESH_OPTIONS = Path.MeshOptions.newBuilder()
.setExcludeData(true)
.build();

public static Path.Any meshAfter(AtomIndex atom, Path.MeshOptions options) {
return Path.Any.newBuilder()
.setMesh(Path.Mesh.newBuilder()
.setCommandTreeNode(atom.getNode())
.setOptions(options))
.build();
}

public static Path.Any meshAfter(
AtomIndex atom, Path.MeshOptions options, Vertex.BufferFormat format) {
return Path.Any.newBuilder()
.setAs(Path.As.newBuilder().setVertexBufferFormat(format)
.setMesh(Path.Mesh.newBuilder().setCommandTreeNode(atom.getNode()).setOptions(options)))
.setAs(Path.As.newBuilder()
.setMesh(Path.Mesh.newBuilder()
.setCommandTreeNode(atom.getNode())
.setOptions(options))
.setVertexBufferFormat(format))
.build();
}

Expand Down
70 changes: 70 additions & 0 deletions gapic/src/main/com/google/gapid/util/Streams.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,28 @@
*/
package com.google.gapid.util;

import com.google.common.collect.ImmutableMap;
import com.google.gapid.proto.stream.Stream;

import java.util.Map;

/**
* Data {@link Stream} utilities.
*/
public class Streams {
// U8 represents a 8-bit unsigned, integer.
public static final Stream.DataType U8 = newInt(false, 8);

// F10 represents a 10-bit unsigned floating-point number.
public static final Stream.DataType F10 = newFloat(false, 5, 5);
// F11 represents a 11-bit unsigned floating-point number.
public static final Stream.DataType F11 = newFloat(false, 5, 6);
// F16 represents a 16-bit signed, floating-point number.
public static final Stream.DataType F16 = newFloat(true, 5, 10);
// F32 represents a 32-bit signed, floating-point number.
public static final Stream.DataType F32 = newFloat(true, 7, 24);
// F64 represents a 64-bit signed, floating-point number.
public static final Stream.DataType F64 = newFloat(true, 10, 53);

// LINEAR is a Sampling state using a linear curve.
public static final Stream.Sampling LINEAR = Stream.Sampling.newBuilder()
Expand Down Expand Up @@ -129,6 +140,65 @@ public static Stream.DataType newFloat(boolean signed, int exponentBits, int man
).build();
}

private static final Map<Stream.DataType, String> FIXED_DATATYPE_NAMES =
ImmutableMap.<Stream.DataType, String>builder()
.put(F10, "float10")
.put(F11, "float11")
.put(F16, "float16")
.put(F32, "float32")
.put(F64, "float64")
.build();

private Streams() {
}

public static String toString(Stream.Format format) {
StringBuilder sb = new StringBuilder();
int count = 0;
String lastType = null;
for (Stream.Component c : format.getComponentsList()) {
String type = toString(c.getDataType());
if (lastType == null || type.equals(lastType)) {
lastType = type;
count++;
} else {
append(sb, lastType, count).append(", ");
lastType = type;
count = 1;
}
}
if (lastType != null) {
append(sb, lastType, count);
}
return sb.toString();
}

private static StringBuilder append(StringBuilder sb, String type, int count) {
sb.append(type);
if (count > 1) {
sb.append(" vec").append(count);
}
return sb;
}

public static String toString(Stream.DataType type) {
String name = FIXED_DATATYPE_NAMES.get(type);
if (name != null) {
return name;
}

switch (type.getKindCase()) {
case FLOAT:
Stream.Float f = type.getFloat();
return "float" + (type.getSigned() ? "S" : "U") + f.getMantissaBits() + "E" + f.getExponentBits();
case FIXED:
Stream.Fixed x = type.getFixed();
return "fixed" + (type.getSigned() ? "S" : "U") + x.getIntegerBits() + "." + x.getFractionalBits();
case INTEGER:
Stream.Integer i = type.getInteger();
return (type.getSigned() ? "s" : "u") + "int" + i.getBits();
default:
return "unknown";
}
}
}
Loading