32 matrices is just a feeeeew two many for ATI cards, but of course
their drivers can't do anything useful like report an error; they just silently screw up. Limiting it to 31 makes it work, but there's still a strange slowdown issue (and it's not that the shaders are being run in software, but it's worth checking for that anyway). git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@243 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -71,7 +71,7 @@ import com.threerings.jme.util.ShaderConfig;
|
||||
public class SkinMesh extends ModelMesh
|
||||
{
|
||||
/** The maximum number of bone matrices that we can use for hardware skinning. */
|
||||
public static final int MAX_SHADER_BONE_COUNT = 32;
|
||||
public static final int MAX_SHADER_BONE_COUNT = 31;
|
||||
|
||||
/** The maximum number of bones influencing a single vertex for hardware skinning. */
|
||||
public static final int MAX_SHADER_BONES_PER_VERTEX = 4;
|
||||
|
||||
@@ -26,7 +26,9 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -152,10 +154,22 @@ public class ShaderCache
|
||||
(frag == null) ? null : getSource(frag, defs));
|
||||
|
||||
// check its link status
|
||||
IntBuffer linked = BufferUtils.createIntBuffer(1);
|
||||
IntBuffer ibuf = BufferUtils.createIntBuffer(1);
|
||||
ARBShaderObjects.glGetObjectParameterARB(sstate.getProgramID(),
|
||||
ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB, linked);
|
||||
return (linked.get() == 0) ? null : sstate;
|
||||
ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB, ibuf);
|
||||
if (ibuf.get(0) == 0) {
|
||||
return null; // failed to link
|
||||
}
|
||||
|
||||
// check the info log
|
||||
ARBShaderObjects.glGetObjectParameterARB(sstate.getProgramID(),
|
||||
ARBShaderObjects.GL_OBJECT_INFO_LOG_LENGTH_ARB, ibuf);
|
||||
ByteBuffer bbuf = BufferUtils.createByteBuffer(ibuf.get(0));
|
||||
ARBShaderObjects.glGetInfoLogARB(sstate.getProgramID(), ibuf, bbuf);
|
||||
String log = Charset.forName("US-ASCII").decode(bbuf).toString();
|
||||
|
||||
// if it runs in software mode, that counts as a failure
|
||||
return (log.indexOf("software") == -1) ? sstate : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user