devwaker / angleproject

Automatically exported from code.google.com/p/angleproject
Other
0 stars 0 forks source link

texture2D in vertex shader #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Vertex shader program where texture2D function is used.

What is the expected output? What do you see instead?

Actually I'd expect that desktop OpenGL would be used in Chrome by default.

When linking the code, I get

error X3004: undeclared identifier 'gl_Texture2D'

I think there should be a better error message, or if possible
gl_Texture2D should be defined for vertex shaders (requires
shader model 3?).

What version of the product are you using? On what operating system?

Chrome Canary Build 7.0.521.0

Please provide any additional information below.

Original issue reported on code.google.com by mrs...@gmail.com on 13 Sep 2010 at 12:16

GoogleCodeExporter commented 9 years ago
Could you attach the vertex shader for which you are getting this error?

Original comment by alokp@chromium.org on 13 Sep 2010 at 3:25

GoogleCodeExporter commented 9 years ago
<script id="shader-vs" type="x-shader/x-vertex">
  attribute vec3 aVertexPosition;
  uniform mat4 uMVMatrix;
  uniform mat4 uPMatrix;
  uniform sampler2D tex;
  void main(void) {
    vec4 z = texture2D(tex, vec2(0.0, 0.0));
    gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
  }
</script>

You can also try
http://sami-code.110mb.com/gl/lesson1.html

Original comment by mrs...@gmail.com on 13 Sep 2010 at 10:23

GoogleCodeExporter commented 9 years ago
Vertex texture fetch is not guaranteed to be supported on any Desktop GL 2.0 or 
GL ES 2.0 implementation.  You should query GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 
before relying on this capability.

Original comment by dan...@transgaming.com on 13 Sep 2010 at 4:33

GoogleCodeExporter commented 9 years ago
I know all that. Anyway I think it should be supported if possible, at least if 
ANGLE is intended to be default GL implementation for Chrome. And the error 
could already happen when compiling the shader (the compiler knows the 
available resources).

Original comment by mrs...@gmail.com on 13 Sep 2010 at 4:59

GoogleCodeExporter commented 9 years ago
Daniel: Would it make sense to catch it in the shader validator? The error 
messages do not make much sense once the shader has been translated.

Original comment by alokp@chromium.org on 13 Sep 2010 at 6:03

GoogleCodeExporter commented 9 years ago
Alok: yes, there probably should be a better error message and it if could be 
caught in the shader validator that would be good.

Original comment by dan...@transgaming.com on 13 Sep 2010 at 8:38

GoogleCodeExporter commented 9 years ago
As of r433 there will now be an error if a vertex shader is compiled and no 
vertex texture fetch is supported.

Original comment by dan...@transgaming.com on 22 Sep 2010 at 5:19

GoogleCodeExporter commented 9 years ago
Why isn't the access from the vertex shader to the texture samplers guaranteed? 
Just began with some fancy water :O, Now just almost all reliable algorithms 
aren't possible. maybe just passing the Height/displacement Map to a vertex 
buffer? any tips???

Original comment by kaj.dijk...@gmail.com on 23 Jun 2011 at 7:18

GoogleCodeExporter commented 9 years ago
Because ES 2.0 doesn't guarantee that vertex texture fetch is supported.  You 
always need you check that the value of GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS is 
greater than 0 before using vertex textures.  (incidentally ANGLE does support 
this now on capable hardware so hopefully this is less of an issue for you.)

Original comment by dan...@transgaming.com on 23 Jun 2011 at 8:22