Hi all,
I have a custom shader with a uniform vec4 in the fragment shader which I set using the following code in the Materials renderMultipassLighting() function:
[java]
Uniform lightColor = shader.getUniform(“g_LightColor”);
// Set the color of the light
lightColor.setValue(VarType.Vector4, l.getColor().clone());
[/java]
However, I get this crash 70% of the time on my ATI card (it never crashes on my nVidia card).
[java]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J org.lwjgl.opengl.GL20.nglUniform4f(IFFFFJ)V
J com.jme3.renderer.lwjgl.LwjglRenderer.updateUniform(Lcom/jme3/shader/Shader;Lcom/jme3/shader/Uniform;)V
[/java]
The crash occurs when r.setShader(shader) is called. In this setShader() function, updateUniform() is called which finally calls:
[java]
case Vector4:
Object val = uniform.getValue();
if (val instanceof ColorRGBA) {
ColorRGBA c = (ColorRGBA) val;
glUniform4f(loc, c.r, c.g, c.b, c.a); // CRASH
[/java]
The weird part is, the uniform location is correct and the ColorRGBA values are all valid. And it only crashes SOME of the time! I thought perhaps it’s a race condition, but even in debug mode stepping very slowly it still crashes sometimes. It may just be my drivers (Dell is telling me I’m up to date) but I was wondering if anyone has experienced something similar or has any insight into why this is happening?
Also, the error only occurs on the very first time the shader is used. Once it succeeds once, the program seems to run crash free (I only run for ~5-10 mins at a time)
Hey all, sorry for the late post. The shader was being rewritten since it didn’t look like the effect we were going for and I was kind of hoping the rewrite would magically eliminate the problem. Long story short, it didn’t work.
Some more information:
Does it work with the default lighting shader?
Yes
Does it work with the default material?
No
I noticed some odd behaviour on my nVidia machine trying out the fragment shader (posted below, vertex shader and material definition posted below below). The g_LightType was always 0, even when I made sure to set it in my custom Material like so:
[java]
Uniform lightType = shader.getUniform(“g_LightType”);
// Set the type of light
lightType.setValue(VarType.Int, type.ordinal());
[/java]
The problem turned out to be that during the ambient pass, I was doing
[java]
r.setShader(shader);
r.renderMesh(g.getMesh(), g.getLodLevel(), 1);
[/java]
before setting the uniform. This caused it to default to zero, and for every light after, it was stuck at zero! My guess is the shader locked itself down after it was first loaded and refused to accept any changes afterwards, even when I called lightType.setValue(VarType.Int, type.ordinal());.
To fix this, I simply set all of my uniforms before doing the ambient render like so:
[java]
lightType.setValue(VarType.Int, Type.Ambient.ordinal());
lightAttenuation.setValue(VarType.Vector4, Vector4f.ZERO.clone());
lightColor.setValue(VarType.Vector4, getAmbientColor(lightList));
lightPos.setValue(VarType.Vector3, Vector3f.ZERO.clone());
lightDir.setValue(VarType.Vector3, Vector3f.ZERO.clone());
lightAngles.setValue(VarType.Vector2, Vector2f.ZERO.clone());
lightIntensity.setValue(VarType.Float, 1.0f);
[/java]
Doing this, everything rendered as expected on my nVidia machine (point, directional, and spot light types all went to their correct if statement sections). However, on the ATI machine I still got the same crash as mentioned previously. Also, on someone else’s nVida machine, after many runs of the application, it was crashing out on something. Unfortunately, I do not have the log for that.
Full Fragment Shader
[java]
uniform bool m_PointSprite;
uniform sampler2D m_Texture; // The texture we are using for the particle
uniform vec2 g_LightAngles; // Angles for spot light (spread, concentration)
uniform vec4 g_LightAttenuation; // Type attenuation of the light we are using (constant, linear, quadratic)
uniform vec3 g_LightDirection; // Direction the light is pointing
uniform vec3 g_LightPosition; // Position of the light in world space
uniform mat4 g_ViewMatrix;
uniform vec4 g_LightColor; // The color of the light we are currently using
uniform int g_LightType; // Type of light we are currently using (0 = directional, 1 = point, 2 = spot)
uniform float g_LightIntensity; // Intensity of the light
varying vec4 texCoord; // texture coordinate
varying vec3 vertPos; // vertex position
varying vec4 color;
void main()
{
if (color.a <= 0.01)
discard;
// default values for declaration
float attenuation = 0;
// Transform light position and direction so we can use it in view space
vec4 lvPos = g_ViewMatrix * vec4(g_LightPosition, 1.0);
vec4 lvDir = g_ViewMatrix * vec4(g_LightDirection, 0.0);
vec3 dirFromLight = vertPos.xyz - lvPos.xyz;
// Do lighting calculation based on type of light
if (g_LightType == 0)
{
// Directional
attenuation = 1.0;
}
else if (g_LightType == 1)
{
// Point
// find out how far from the light we are
float distanceToLight = length(dirFromLight);
float radius = g_LightAttenuation.w;
if (distanceToLight <= radius)
{
attenuation = (1.0 - (distanceToLight / radius)) * g_LightAttenuation.x;
}
}
else if (g_LightType == 2)
{
// Spot
// Find out how much of an angle from the light we are
vec3 spotLightDir = normalize(lvDir.xyz);
vec3 dirFromLightNormalized = normalize(dirFromLight.xyz);
float cosCurrentAngle = dot(dirFromLightNormalized, spotLightDir);
float cosInnerAngle = g_LightAngles.y;
float cosOuterAngle = g_LightAngles.x;
// Check where we are in the cone
if (cosCurrentAngle > cosInnerAngle)
{
// inner cone, full light
// two fall offs. 1 for in the sphere distance, 1 for outside of it
// sphere radius is g_LightAttenuation.w
float distanceToLight = length(dirFromLight);
if (distanceToLight - g_LightAttenuation.w > 0)
{
//outside of inner sphere
attenuation = 1.0 / (g_LightAttenuation.y * distanceToLight + g_LightAttenuation.z * distanceToLight * distanceToLight);
}
else
{
// inside of inner sphere
attenuation = 1.0 / (g_LightAttenuation.x * distanceToLight);
}
}
else if (cosCurrentAngle > cosOuterAngle)
{
// outer cone, fall-off attenuation
// two fall offs. 1 for in the sphere distance, 1 for outside of it
// sphere radius is g_LightAttenuation.w
float distanceToLight = length(dirFromLight);
if (distanceToLight - g_LightAttenuation.w > 0)
{
//outside of inner sphere
attenuation = 1.0 / (g_LightAttenuation.y * distanceToLight + g_LightAttenuation.z * distanceToLight * distanceToLight);
}
else
{
// inside of inner sphere
attenuation = 1.0 / (g_LightAttenuation.x * distanceToLight);
}
}
}
else if (g_LightType == 3)
{
// Ambient
attenuation = 1.0;
}
// Find color contributed by this light, so we can combine with texture color
vec4 colorFromLight = g_LightColor * attenuation * g_LightIntensity;
colorFromLight.x = min(colorFromLight.x, 1);
colorFromLight.y = min(colorFromLight.y, 1);
colorFromLight.z = min(colorFromLight.z, 1);
colorFromLight.a = 1.0f;
if (m_PointSprite)
{
vec2 uv = mix(texCoord.xy, texCoord.zw, gl_PointCoord.xy);
vec4 texColor = texture2D(m_Texture, uv);
gl_FragColor = vec4(mix(colorFromLight.rgb, texColor.rgb, 0.0), texColor.a) * color;
}
else
{
vec4 texColor = texture2D(m_Texture, texCoord.xy);
gl_FragColor = vec4(mix(colorFromLight.rgb, texColor.rgb, 0.0), texColor.a);
}
}
[/java]
Material Definition
[java]
MaterialDef Particle Lighting {
MaterialParameters {
Texture2D Texture
Boolean PointSprite
}
Technique {
LightMode MultiPass
VertexShader GLSL100: ParticleLighting.vert
FragmentShader GLSL100: ParticleLighting.frag
WorldParameters {
WorldViewProjectionMatrix
WorldViewMatrix
WorldMatrix
CameraPosition
ViewMatrix
}
RenderState {
Blend AlphaAdditive
DepthWrite Off
PointSprite On
// AlphaTestFalloff 0.01
}
}
}
[/java]
ParticleLighting.vert
[java]
uniform mat4 g_WorldViewProjectionMatrix;
uniform mat4 g_WorldViewMatrix;
uniform mat4 g_WorldMatrix;
uniform vec3 g_CameraPosition;
uniform float m_Quadratic;
uniform bool m_PointSprite;
attribute float inSize;
attribute vec3 inPosition;
attribute vec4 inTexCoord;
attribute vec4 inColor;
varying vec4 texCoord;
varying vec3 vertPos;
varying vec4 color;
void main()
{
vec4 pos = vec4(inPosition, 1.0);
vec4 wvPos = g_WorldViewMatrix * pos;
// Remember position for per-pixel lighting
vertPos = wvPos.xyz;
// Remember the texture coordinate for the fragment shader
texCoord = inTexCoord;
// calculate color for frag shader
color = inColor;
if (m_PointSprite)
{
vec4 worldPos = g_WorldMatrix * pos;
float d = distance(g_CameraPosition.xyz, worldPos.xyz);
gl_PointSize = max(1.0, (inSize * 4.0 * m_Quadratic) / d);
color.a *= min(gl_PointSize, 1.0);
}
gl_Position = g_WorldViewProjectionMatrix * pos;
}
[/java]
Bonus Error, Yay!
With the fragment shader attached at the very bottom, same material definition and vertex shader, using a particle emitter and using JME’s Material, I get this error on my ATI machine :
[java]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.lwjgl.opengl.GL12.nglDrawRangeElementsBO(IIIIIJJ)V+0
j org.lwjgl.opengl.GL12.glDrawRangeElements(IIIIIJ)V+32
j com.jme3.renderer.lwjgl.LwjglRenderer.drawTriangleList(Lcom/jme3/scene/VertexBuffer;Lcom/jme3/scene/Mesh;I)V+361
j com.jme3.renderer.lwjgl.LwjglRenderer.renderMeshDefault(Lcom/jme3/scene/Mesh;II)V+183
j com.jme3.renderer.lwjgl.LwjglRenderer.renderMesh(Lcom/jme3/scene/Mesh;II)V+87
[/java]
Although it’s not the same error as before, I am uncertain why it happens and thought maybe some insight would help me to better understand crashes in the future.
ParticleLighting.frag for new error
[java]
varying vec4 texCoord;
varying vec3 vertPos;
varying vec4 color;
void main()
{
gl_FragColor = vec4(0);
}
[/java]
Can you post the entire log for the crash? Also, did you modify the renderMultipassLighting() method?
Here is the log, slightly trimmed:
[java]
#
A fatal error has been detected by the Java Runtime Environment:
#
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000069211e73, pid=736, tid=5196
#
JRE version: 6.0_24-b07
Java VM: Java HotSpot™ 64-Bit Server VM (19.1-b02 mixed mode windows-amd64 compressed oops)
Problematic frame:
C [atio6axx.dll+0x1e1e73]
#
If you would like to submit a bug report, please visit:
http://java.sun.com/webapps/bugreport/crash.jsp
The crash happened outside the Java Virtual Machine in native code.
See problematic frame for where to report the bug.
#
T H R E A D
Current thread (0x000000000776b000): JavaThread "LWJGL Renderer Thread" [_thread_in_native, id=5196, stack(0x000000000ca60000,0x000000000cb60000)]
siginfo: ExceptionCode=0xc0000005, reading address 0x000000000d7db0b0
Registers:
RAX=0x000000000093ff6c, RBX=0x000000000d0f08e0, RCX=0x0000000000000001, RDX=0x000000000cd60080
RSP=0x000000000cb5eb40, RBP=0x000000000ce9a758, RSI=0x000000000ce9a6f0, RDI=0x000000000d0ecd50
R8=0x000000000c71e4bc, R9=0x0000000000080000, R10=0x000000000d0f08e0, R11=0x000000000d0ecd50
R12=0x0000000000000001, R13=0x0000000000000000, R14=0x0000000000000000, R15=0x000000000ce9a6f0
RIP=0x0000000069211e73, EFLAGS=0x0000000000010246
Register to memory mapping:
RAX=0x000000000093ff6c
0x000000000093ff6c is pointing to unknown location
RBX=0x000000000d0f08e0
0x000000000d0f08e0 is pointing to unknown location
RCX=0x0000000000000001
0x0000000000000001 is pointing to unknown location
RDX=0x000000000cd60080
0x000000000cd60080 is pointing to unknown location
RSP=0x000000000cb5eb40
0x000000000cb5eb40 is pointing into the stack for thread: 0x000000000776b000
"LWJGL Renderer Thread" prio=6 tid=0x000000000776b000 nid=0x144c runnable [0x000000000cb5e000]
java.lang.Thread.State: RUNNABLE
RBP=0x000000000ce9a758
0x000000000ce9a758 is pointing to unknown location
RSI=0x000000000ce9a6f0
0x000000000ce9a6f0 is pointing to unknown location
RDI=0x000000000d0ecd50
0x000000000d0ecd50 is pointing to unknown location
R8 =0x000000000c71e4bc
0x000000000c71e4bc is pointing to unknown location
R9 =0x0000000000080000
0x0000000000080000 is pointing to unknown location
R10=0x000000000d0f08e0
0x000000000d0f08e0 is pointing to unknown location
R11=0x000000000d0ecd50
0x000000000d0ecd50 is pointing to unknown location
R12=0x0000000000000001
0x0000000000000001 is pointing to unknown location
R13=0x0000000000000000
0x0000000000000000 is pointing to unknown location
R14=0x0000000000000000
0x0000000000000000 is pointing to unknown location
R15=0x000000000ce9a6f0
0x000000000ce9a6f0 is pointing to unknown location
Top of Stack: (sp=0x000000000cb5eb40)
0x000000000cb5eb40: 000000000d0d6098 0000000000000001
0x000000000cb5eb50: 0000000000000000 000000000ce9a6f0
0x000000000cb5eb60: 0000000000000040 000000002b45d0f0
0x000000000cb5eb70: 0000000000000000 0000000000000000
0x000000000cb5eb80: 0000000000000002 0000000000000040
0x000000000cb5eb90: 0000000000000000 000000000d18af30
0x000000000cb5eba0: 0000000000000020 0000000000000000
0x000000000cb5ebb0: 0000000000000020 0000000069211768
0x000000000cb5ebc0: 000000003f800000 000000003f800000
0x000000000cb5ebd0: 0000000046000000 000000000ce9a758
0x000000000cb5ebe0: 0000000000000001 000000000d1d9b70
0x000000000cb5ebf0: 0000000000001403 000000000d18af30
0x000000000cb5ec00: 0000000000000004 0000000069216f92
0x000000000cb5ec10: 000000000ce9a758 0000000069030000
0x000000000cb5ec20: 000000000ce9a6f0 000000000d0d74c8
0x000000000cb5ec30: 0000000000000000 0000000069286afa
Instructions: (pc=0x0000000069211e73)
0x0000000069211e63: 0f 85 54 01 00 00 8b 45 4c 48 69 c0 94 00 00 00
0x0000000069211e73: 44 38 ac 30 54 0a 00 00 0f 84 3c 01 00 00 0f 57
Stack: [0x000000000ca60000,0x000000000cb60000], sp=0x000000000cb5eb40, free space=1018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [atio6axx.dll+0x1e1e73]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j org.lwjgl.opengl.GL20.nglUniform4f(IFFFFJ)V+0
j org.lwjgl.opengl.GL20.glUniform4f(IFFFF)V+25
j com.jme3.renderer.lwjgl.LwjglRenderer.updateUniform(Lcom/jme3/shader/Shader;Lcom/jme3/shader/Uniform;)V+360
j com.jme3.renderer.lwjgl.LwjglRenderer.updateShaderUniforms(Lcom/jme3/shader/Shader;)V+37
j com.jme3.renderer.lwjgl.LwjglRenderer.setShader(Lcom/jme3/shader/Shader;)V+58
j com.secretcorporation.simulation.sceneentities.SCMaterial.renderMultipassLighting(Lcom/jme3/shader/Shader;Lcom/jme3/scene/Geometry;Lcom/jme3/renderer/Renderer;)V+496
j com.jme3.material.Material.render(Lcom/jme3/scene/Geometry;Lcom/jme3/renderer/RenderManager;)V+285
j com.jme3.renderer.RenderManager.renderGeometry(Lcom/jme3/scene/Geometry;)V+161
j com.jme3.renderer.queue.RenderQueue.renderGeometryList(Lcom/jme3/renderer/queue/GeometryList;Lcom/jme3/renderer/RenderManager;Lcom/jme3/renderer/Camera;Z)V+66
j com.jme3.renderer.queue.RenderQueue.renderQueue(Lcom/jme3/renderer/queue/RenderQueue$Bucket;Lcom/jme3/renderer/RenderManager;Lcom/jme3/renderer/Camera;Z)V+94
j com.jme3.renderer.RenderManager.renderViewPortQueues(Lcom/jme3/renderer/ViewPort;Z)V+97
j com.jme3.renderer.RenderManager.flushQueue(Lcom/jme3/renderer/ViewPort;)V+3
j com.jme3.renderer.RenderManager.renderViewPort(Lcom/jme3/renderer/ViewPort;F)V+267
j com.jme3.water.SimpleWaterProcessor.postQueue(Lcom/jme3/renderer/queue/RenderQueue;)V+347
j com.jme3.renderer.RenderManager.renderViewPort(Lcom/jme3/renderer/ViewPort;F)V+257
j com.jme3.renderer.RenderManager.render(F)V+91
j com.secretcorporation.simulation.scenes.Scene.update()V+196
j com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop()V+22
j com.jme3.system.lwjgl.LwjglCanvas.runLoop()V+234
j com.jme3.system.lwjgl.LwjglAbstractDisplay.run()V+117
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
P R O C E S S
Java Threads: ( => current thread )
0x000000000f41a000 JavaThread "DestroyJavaVM" [_thread_blocked, id=6224, stack(0x0000000002340000,0x0000000002440000)]
0x000000000f419000 JavaThread "derby.rawStoreDaemon" daemon [_thread_blocked, id=4868, stack(0x000000006d6e0000,0x000000006d7e0000)]
0x000000000f418800 JavaThread "Timer-0" daemon [_thread_blocked, id=7676, stack(0x000000005ff60000,0x0000000060060000)]
0x000000000f417000 JavaThread "derby.antiGC" daemon [_thread_blocked, id=300, stack(0x000000000d4f0000,0x000000000d5f0000)]
0x00000000077b6800 JavaThread "jME3 Audio Thread" daemon [_thread_blocked, id=496, stack(0x000000000da00000,0x000000000db00000)]
0x00000000077ab800 JavaThread "D3D Screen Updater" daemon [_thread_blocked, id=7404, stack(0x000000000d360000,0x000000000d460000)]
=>0x000000000776b000 JavaThread "LWJGL Renderer Thread" [_thread_in_native, id=5196, stack(0x000000000ca60000,0x000000000cb60000)]
0x000000000773f800 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=7840, stack(0x000000000b670000,0x000000000b770000)]
0x0000000007568000 JavaThread "AWT-Windows" daemon [_thread_in_native, id=5132, stack(0x0000000008340000,0x0000000008440000)]
0x0000000007565000 JavaThread "AWT-Shutdown" [_thread_blocked, id=7048, stack(0x0000000008240000,0x0000000008340000)]
0x0000000007561800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=7436, stack(0x0000000008140000,0x0000000008240000)]
0x0000000006804000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=4880, stack(0x0000000007070000,0x0000000007170000)]
0x00000000067ed000 JavaThread "CompilerThread1" daemon [_thread_blocked, id=324, stack(0x0000000006f70000,0x0000000007070000)]
0x00000000067ef800 JavaThread "CompilerThread0" daemon [_thread_blocked, id=7600, stack(0x0000000006e70000,0x0000000006f70000)]
0x00000000067d7800 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=6808, stack(0x0000000006d70000,0x0000000006e70000)]
0x00000000067d6800 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=3252, stack(0x0000000006c70000,0x0000000006d70000)]
0x00000000067ce800 JavaThread "JDWP Transport Listener: dt_shmem" daemon [_thread_in_vm, id=4100, stack(0x0000000006b70000,0x0000000006c70000)]
0x00000000067c5800 JavaThread "Attach Listener" daemon [_thread_blocked, id=5448, stack(0x0000000006a70000,0x0000000006b70000)]
0x00000000067c0000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=7440, stack(0x0000000006970000,0x0000000006a70000)]
0x00000000007dd000 JavaThread "Finalizer" daemon [_thread_blocked, id=2540, stack(0x0000000006670000,0x0000000006770000)]
0x00000000007d6800 JavaThread "Reference Handler" daemon [_thread_blocked, id=6068, stack(0x0000000006570000,0x0000000006670000)]
Other Threads:
0x00000000007d0000 VMThread [stack: 0x0000000006470000,0x0000000006570000] [id=6584]
0x0000000006819800 WatcherThread [stack: 0x0000000007170000,0x0000000007270000] [id=8072]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
PSYoungGen total 611648K, used 209856K [0x00000007d5560000, 0x0000000800000000, 0x0000000800000000)
eden space 524288K, 40% used [0x00000007d5560000,0x00000007e2250388,0x00000007f5560000)
from space 87360K, 0% used [0x00000007faab0000,0x00000007faab0000,0x0000000800000000)
to space 87360K, 0% used [0x00000007f5560000,0x00000007f5560000,0x00000007faab0000)
PSOldGen total 1398144K, used 0K [0x0000000780000000, 0x00000007d5560000, 0x00000007d5560000)
object space 1398144K, 0% used [0x0000000780000000,0x0000000780000000,0x00000007d5560000)
PSPermGen total 43904K, used 43749K [0x000000077ae00000, 0x000000077d8e0000, 0x0000000780000000)
object space 43904K, 99% used [0x000000077ae00000,0x000000077d8b9560,0x000000077d8e0000)
VM Arguments:
jvm_args: -Xdebug -Xrunjdwp:transport=dt_shmem,address=javadebug -Dfile.encoding=UTF-8 -Xms2G -Xmx2G
java_command: com.secretcorporation.simulation.Main
Launcher Type: SUN_STANDARD
Environment Variables:
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 37 Stepping 2, GenuineIntel
S Y S T E M
OS: Windows 7 Build 7600
CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 37 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, ht
Memory: 4k page, physical 4117032k(1273804k free), swap 8232164k(1203296k free)
vm_info: Java HotSpot(TM) 64-Bit Server VM (19.1-b02) for windows-amd64 JRE (1.6.0_24-b07), built on Feb 2 2011 16:25:45 by "java_re" with MS VC++ 8.0 (VS2005)
time: Tue May 17 11:47:08 2011
elapsed time: 22 seconds
[/java]
Yes, I did modify the renderMultipassLighting() method to add spotlight support. What I did was make a new Material and extend the original Material. Then I just overloaded the renderMultipassLighting() method to add spotlight logic. It's almost identical to the original method except for an extra case statement and a couple of other variables being set on the shader.
I googled the atixo6axx.dll to see if anything came up and I was brought to a MineCraft forum of users having a similar error in that game. Unfortunately, I could not find any solution or reason as to why the crash occurs. It's quite baffling since I can change nothing and have the code work sometimes, and not others. I wonder if I am at the limits of concurrent shaders or something on the video card and depending on what's open on my PC I succeed or fail
Does it work correctly with the unmodified renderMultipassLighting?
Does it work correctly with the unmodified Lighting shader?
The error is just a default error, it happens for nearly any case (since that dll is the essential driver part)
You could post the shader if you changed anything in it, maybee someone will see the error?
Trying changing the 0 to 0.0 Yes, I know it sounds silly. Try it.
Silly or not, I will definitely try that
Unfortunately it has to wait until tomorrow because the ATI machine it out of batteries and it’s power supply is in another building. Long story
It’s quite likely to be the problem. I’ve had several of my shaders fail on ATI cards because I forgot the .0.
Amazing! Everything is working great now. Thanks a lot pspeed!
I was missing a bunch of .0s in my shader. As well I had a .0f on one line, so I removed the f as well. Dealing with ATI and nVidia I almost feel like Im back in web design, trying to make things compatible with IE, Firefox and the rest.
Is there a good shader IDE that can inform me about stuff like this? I am pretty new to practically writing shaders and am currently just using plain text to make write them
I don’t know about an IDE.
Usually if you can get someone to run it on a Mac successfully then it will run right everywhere else. At least, so I’ve found.
Probably you won’t find an IDE that will warn about everything … The amount of platform-specific issues with GLSL shaders is astounding.
There was a “GLSL Verifier” application, but its only for GLSL100 if I recall, still useful if you’re trying to stay compatible with old gpus.
Also there are some pages on the OpenGL wiki, but they only document a few of the issues you will encounter.
http://www.opengl.org/wiki/GLSL_:_common_mistakes
http://www.opengl.org/wiki/Hardware_specifics:_NVidia
Yeah, for compatibility’s sake, stick to using float values wherever possible, even if you know it’s always going to be an integer. Some GPU’s will laugh at your integer and convert it to float anyway. Others will just laugh at you outright, drop it on the floor, and run away as you saw
Cheers!
~FlaH
Well ints work on all real cards mostly (ati and nvidia). Actually if you follow the specification 1 to 1 you are mostly safe. However even the slightliest difference (like a implicit inter to float cast) can break anything, depening on how the driver developers implemented it