OLD | NEW |
(Empty) | |
| 1 <!-- |
| 2 Copyright (C) 2011 Apple Computer, Inc. All rights reserved. |
| 3 |
| 4 Redistribution and use in source and binary forms, with or without |
| 5 modification, are permitted provided that the following conditions |
| 6 are met: |
| 7 1. Redistributions of source code must retain the above copyright |
| 8 notice, this list of conditions and the following disclaimer. |
| 9 2. Redistributions in binary form must reproduce the above copyright |
| 10 notice, this list of conditions and the following disclaimer in the |
| 11 documentation and/or other materials provided with the distribution. |
| 12 |
| 13 THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 --> |
| 25 <!DOCTYPE html> |
| 26 <html> |
| 27 <head> |
| 28 <meta charset="utf-8"> |
| 29 <link rel="stylesheet" href="../../resources/js-test-style.css"/> |
| 30 <script src="../../resources/js-test-pre.js"></script> |
| 31 <script src="../resources/webgl-test.js"></script> |
| 32 </head> |
| 33 <body> |
| 34 <div id="description"></div> |
| 35 <div id="console"></div> |
| 36 |
| 37 <script> |
| 38 description("Tests calling WebGL APIs with objects from other contexts"); |
| 39 |
| 40 var contextA = create3DContext(); |
| 41 var contextB = create3DContext(); |
| 42 var programA = loadStandardProgram(contextA); |
| 43 var programB = loadStandardProgram(contextB); |
| 44 var shaderA = loadStandardVertexShader(contextA); |
| 45 var shaderB = loadStandardVertexShader(contextB); |
| 46 var textureA = contextA.createTexture(); |
| 47 var textureB = contextB.createTexture(); |
| 48 var frameBufferA = contextA.createFramebuffer(); |
| 49 var frameBufferB = contextB.createFramebuffer(); |
| 50 var renderBufferA = contextA.createRenderbuffer(); |
| 51 var renderBufferB = contextB.createRenderbuffer(); |
| 52 var locationA = contextA.getUniformLocation(programA, 'u_modelViewProjMatrix'); |
| 53 var locationB = contextB.getUniformLocation(programB, 'u_modelViewProjMatrix'); |
| 54 |
| 55 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.compileSha
der(shaderB)"); |
| 56 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.linkProgra
m(programB)"); |
| 57 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.attachShad
er(programA, shaderB)"); |
| 58 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.attachShad
er(programB, shaderA)"); |
| 59 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.attachShad
er(programB, shaderB)"); |
| 60 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.detachShad
er(programA, shaderB)"); |
| 61 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.detachShad
er(programB, shaderA)"); |
| 62 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.detachShad
er(programB, shaderB)"); |
| 63 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.shaderSour
ce(shaderB, 'foo')"); |
| 64 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.bindAttrib
Location(programB, 0, 'foo')"); |
| 65 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.bindFrameb
uffer(contextA.FRAMEBUFFER, frameBufferB)"); |
| 66 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.bindRender
buffer(contextA.RENDERBUFFER, renderBufferB)"); |
| 67 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.bindTextur
e(contextA.TEXTURE_2D, textureB)"); |
| 68 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.framebuffe
rRenderbuffer(contextA.FRAMEBUFFER, contextA.DEPTH_ATTACHMENT, contextA.RENDERBU
FFER, renderBufferB)"); |
| 69 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.framebuffe
rTexture2D(contextA.FRAMEBUFFER, contextA.COLOR_ATTACHMENT0, contextA.TEXTURE_2D
, textureB, 0)"); |
| 70 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getProgram
Parameter(programB, 0)"); |
| 71 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getProgram
InfoLog(programB, 0)"); |
| 72 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getShaderP
arameter(shaderB, 0)"); |
| 73 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getShaderI
nfoLog(shaderB, 0)"); |
| 74 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getShaderS
ource(shaderB)"); |
| 75 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getUniform
(programB, locationA)"); |
| 76 shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getUniform
Location(programB, 'u_modelViewProjMatrix')"); |
| 77 |
| 78 successfullyParsed = true; |
| 79 </script> |
| 80 |
| 81 <script src="../../resources/js-test-post.js"></script> |
| 82 </body> |
| 83 </html> |
OLD | NEW |