daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1 | // |
Geoff Lang | 48dcae7 | 2014-02-05 16:28:24 -0500 | [diff] [blame] | 2 | // Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | // libGLESv2.cpp: Implements the exported OpenGL ES 2.0 functions. |
| 8 | |
Geoff Lang | 2b5420c | 2014-11-19 14:20:15 -0500 | [diff] [blame] | 9 | #include "libGLESv2/main.h" |
| 10 | |
| 11 | #include "libANGLE/formatutils.h" |
| 12 | #include "libANGLE/Buffer.h" |
| 13 | #include "libANGLE/Fence.h" |
| 14 | #include "libANGLE/Framebuffer.h" |
| 15 | #include "libANGLE/Renderbuffer.h" |
| 16 | #include "libANGLE/Program.h" |
| 17 | #include "libANGLE/ProgramBinary.h" |
| 18 | #include "libANGLE/Texture.h" |
| 19 | #include "libANGLE/Query.h" |
| 20 | #include "libANGLE/Context.h" |
| 21 | #include "libANGLE/VertexArray.h" |
| 22 | #include "libANGLE/VertexAttribute.h" |
| 23 | #include "libANGLE/TransformFeedback.h" |
| 24 | #include "libANGLE/FramebufferAttachment.h" |
| 25 | |
| 26 | #include "libANGLE/validationES.h" |
| 27 | #include "libANGLE/validationES2.h" |
| 28 | #include "libANGLE/validationES3.h" |
| 29 | #include "libANGLE/queryconversions.h" |
Geoff Lang | f0a2c77 | 2014-11-20 15:15:01 -0500 | [diff] [blame^] | 30 | #include "libANGLE/version.h" |
Geoff Lang | 2b5420c | 2014-11-19 14:20:15 -0500 | [diff] [blame] | 31 | |
Geoff Lang | 0b7eef7 | 2014-06-12 14:10:47 -0400 | [diff] [blame] | 32 | #include "common/utilities.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 33 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 34 | extern "C" |
| 35 | { |
| 36 | |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 37 | // OpenGL ES 2.0 functions |
| 38 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 39 | void GL_APIENTRY glActiveTexture(GLenum texture) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 40 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 41 | EVENT("(GLenum texture = 0x%X)", texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 42 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 43 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 44 | if (context) |
| 45 | { |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 46 | if (texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + context->getCaps().maxCombinedTextureImageUnits - 1) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 47 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 48 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 49 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 50 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 51 | |
| 52 | context->getState().setActiveSampler(texture - GL_TEXTURE0); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 53 | } |
| 54 | } |
| 55 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 56 | void GL_APIENTRY glAttachShader(GLuint program, GLuint shader) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 57 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 58 | EVENT("(GLuint program = %d, GLuint shader = %d)", program, shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 59 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 60 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 61 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 62 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 63 | gl::Program *programObject = context->getProgram(program); |
| 64 | gl::Shader *shaderObject = context->getShader(shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 65 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 66 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 67 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 68 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 69 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 70 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 71 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 72 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 73 | else |
| 74 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 75 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 76 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 77 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 78 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 79 | |
| 80 | if (!shaderObject) |
| 81 | { |
| 82 | if (context->getProgram(shader)) |
| 83 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 84 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 85 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 86 | } |
| 87 | else |
| 88 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 89 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 90 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 91 | } |
| 92 | } |
| 93 | |
| 94 | if (!programObject->attachShader(shaderObject)) |
| 95 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 96 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 97 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 98 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 99 | } |
| 100 | } |
| 101 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 102 | void GL_APIENTRY glBeginQueryEXT(GLenum target, GLuint id) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 103 | { |
| 104 | EVENT("(GLenum target = 0x%X, GLuint %d)", target, id); |
| 105 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 106 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 107 | if (context) |
| 108 | { |
| 109 | if (!ValidateBeginQuery(context, target, id)) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 110 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 111 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 112 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 113 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 114 | gl::Error error = context->beginQuery(target, id); |
| 115 | if (error.isError()) |
| 116 | { |
| 117 | context->recordError(error); |
| 118 | return; |
| 119 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 120 | } |
| 121 | } |
| 122 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 123 | void GL_APIENTRY glBindAttribLocation(GLuint program, GLuint index, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 124 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 125 | EVENT("(GLuint program = %d, GLuint index = %d, const GLchar* name = 0x%0.8p)", program, index, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 126 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 127 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 128 | if (context) |
| 129 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 130 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 131 | { |
| 132 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 133 | return; |
| 134 | } |
| 135 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 136 | gl::Program *programObject = context->getProgram(program); |
| 137 | |
| 138 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 139 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 140 | if (context->getShader(program)) |
daniel@transgaming.com | 9807983 | 2010-04-13 03:26:29 +0000 | [diff] [blame] | 141 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 142 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 143 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 144 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 145 | else |
| 146 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 147 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 148 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 149 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 150 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 151 | |
| 152 | if (strncmp(name, "gl_", 3) == 0) |
| 153 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 154 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 155 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | programObject->bindAttributeLocation(index, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 159 | } |
| 160 | } |
| 161 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 162 | void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 163 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 164 | EVENT("(GLenum target = 0x%X, GLuint buffer = %d)", target, buffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 165 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 166 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 167 | if (context) |
| 168 | { |
| 169 | if (!gl::ValidBufferTarget(context, target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 170 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 171 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 172 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 173 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 174 | |
| 175 | switch (target) |
| 176 | { |
| 177 | case GL_ARRAY_BUFFER: |
| 178 | context->bindArrayBuffer(buffer); |
| 179 | return; |
| 180 | case GL_ELEMENT_ARRAY_BUFFER: |
| 181 | context->bindElementArrayBuffer(buffer); |
| 182 | return; |
| 183 | case GL_COPY_READ_BUFFER: |
| 184 | context->bindCopyReadBuffer(buffer); |
| 185 | return; |
| 186 | case GL_COPY_WRITE_BUFFER: |
| 187 | context->bindCopyWriteBuffer(buffer); |
| 188 | return; |
| 189 | case GL_PIXEL_PACK_BUFFER: |
| 190 | context->bindPixelPackBuffer(buffer); |
| 191 | return; |
| 192 | case GL_PIXEL_UNPACK_BUFFER: |
| 193 | context->bindPixelUnpackBuffer(buffer); |
| 194 | return; |
| 195 | case GL_UNIFORM_BUFFER: |
| 196 | context->bindGenericUniformBuffer(buffer); |
| 197 | return; |
| 198 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 199 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 200 | return; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 201 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 202 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 203 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 204 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 205 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 206 | } |
| 207 | } |
| 208 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 209 | void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 210 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 211 | EVENT("(GLenum target = 0x%X, GLuint framebuffer = %d)", target, framebuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 212 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 213 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 214 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 215 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 216 | if (!gl::ValidFramebufferTarget(target)) |
| 217 | { |
| 218 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 219 | return; |
| 220 | } |
| 221 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 222 | if (target == GL_READ_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER) |
| 223 | { |
| 224 | context->bindReadFramebuffer(framebuffer); |
| 225 | } |
| 226 | |
| 227 | if (target == GL_DRAW_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER) |
| 228 | { |
| 229 | context->bindDrawFramebuffer(framebuffer); |
| 230 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 231 | } |
| 232 | } |
| 233 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 234 | void GL_APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 235 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 236 | EVENT("(GLenum target = 0x%X, GLuint renderbuffer = %d)", target, renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 237 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 238 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 239 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 240 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 241 | if (target != GL_RENDERBUFFER) |
| 242 | { |
| 243 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 244 | return; |
| 245 | } |
| 246 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 247 | context->bindRenderbuffer(renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 248 | } |
| 249 | } |
| 250 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 251 | void GL_APIENTRY glBindTexture(GLenum target, GLuint texture) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 252 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 253 | EVENT("(GLenum target = 0x%X, GLuint texture = %d)", target, texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 254 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 255 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 256 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 257 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 258 | gl::Texture *textureObject = context->getTexture(texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 259 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 260 | if (textureObject && textureObject->getTarget() != target && texture != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 261 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 262 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 263 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 264 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 265 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 266 | switch (target) |
| 267 | { |
| 268 | case GL_TEXTURE_2D: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 269 | case GL_TEXTURE_CUBE_MAP: |
Geoff Lang | 76b10c9 | 2014-09-05 16:28:14 -0400 | [diff] [blame] | 270 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 271 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 272 | case GL_TEXTURE_3D: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 273 | case GL_TEXTURE_2D_ARRAY: |
| 274 | if (context->getClientVersion() < 3) |
| 275 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 276 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 277 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 278 | } |
Geoff Lang | 76b10c9 | 2014-09-05 16:28:14 -0400 | [diff] [blame] | 279 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 280 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 281 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 282 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 283 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 284 | } |
Geoff Lang | 76b10c9 | 2014-09-05 16:28:14 -0400 | [diff] [blame] | 285 | |
| 286 | context->bindTexture(target, texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 287 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 288 | } |
| 289 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 290 | void GL_APIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 291 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 292 | EVENT("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 293 | red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 294 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 295 | gl::Context* context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 296 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 297 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 298 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 299 | context->getState().setBlendColor(gl::clamp01(red), gl::clamp01(green), gl::clamp01(blue), gl::clamp01(alpha)); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 300 | } |
| 301 | } |
| 302 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 303 | void GL_APIENTRY glBlendEquation(GLenum mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 304 | { |
| 305 | glBlendEquationSeparate(mode, mode); |
| 306 | } |
| 307 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 308 | void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 309 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 310 | EVENT("(GLenum modeRGB = 0x%X, GLenum modeAlpha = 0x%X)", modeRGB, modeAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 311 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 312 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 313 | if (context) |
| 314 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 315 | switch (modeRGB) |
| 316 | { |
| 317 | case GL_FUNC_ADD: |
| 318 | case GL_FUNC_SUBTRACT: |
| 319 | case GL_FUNC_REVERSE_SUBTRACT: |
| 320 | case GL_MIN: |
| 321 | case GL_MAX: |
| 322 | break; |
| 323 | |
| 324 | default: |
| 325 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 326 | return; |
| 327 | } |
| 328 | |
| 329 | switch (modeAlpha) |
| 330 | { |
| 331 | case GL_FUNC_ADD: |
| 332 | case GL_FUNC_SUBTRACT: |
| 333 | case GL_FUNC_REVERSE_SUBTRACT: |
| 334 | case GL_MIN: |
| 335 | case GL_MAX: |
| 336 | break; |
| 337 | |
| 338 | default: |
| 339 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 340 | return; |
| 341 | } |
| 342 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 343 | context->getState().setBlendEquation(modeRGB, modeAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 344 | } |
| 345 | } |
| 346 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 347 | void GL_APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 348 | { |
| 349 | glBlendFuncSeparate(sfactor, dfactor, sfactor, dfactor); |
| 350 | } |
| 351 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 352 | void GL_APIENTRY glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 353 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 354 | EVENT("(GLenum srcRGB = 0x%X, GLenum dstRGB = 0x%X, GLenum srcAlpha = 0x%X, GLenum dstAlpha = 0x%X)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 355 | srcRGB, dstRGB, srcAlpha, dstAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 356 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 357 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 358 | if (context) |
| 359 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 360 | switch (srcRGB) |
| 361 | { |
| 362 | case GL_ZERO: |
| 363 | case GL_ONE: |
| 364 | case GL_SRC_COLOR: |
| 365 | case GL_ONE_MINUS_SRC_COLOR: |
| 366 | case GL_DST_COLOR: |
| 367 | case GL_ONE_MINUS_DST_COLOR: |
| 368 | case GL_SRC_ALPHA: |
| 369 | case GL_ONE_MINUS_SRC_ALPHA: |
| 370 | case GL_DST_ALPHA: |
| 371 | case GL_ONE_MINUS_DST_ALPHA: |
| 372 | case GL_CONSTANT_COLOR: |
| 373 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 374 | case GL_CONSTANT_ALPHA: |
| 375 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 376 | case GL_SRC_ALPHA_SATURATE: |
| 377 | break; |
| 378 | |
| 379 | default: |
| 380 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 381 | return; |
| 382 | } |
| 383 | |
| 384 | switch (dstRGB) |
| 385 | { |
| 386 | case GL_ZERO: |
| 387 | case GL_ONE: |
| 388 | case GL_SRC_COLOR: |
| 389 | case GL_ONE_MINUS_SRC_COLOR: |
| 390 | case GL_DST_COLOR: |
| 391 | case GL_ONE_MINUS_DST_COLOR: |
| 392 | case GL_SRC_ALPHA: |
| 393 | case GL_ONE_MINUS_SRC_ALPHA: |
| 394 | case GL_DST_ALPHA: |
| 395 | case GL_ONE_MINUS_DST_ALPHA: |
| 396 | case GL_CONSTANT_COLOR: |
| 397 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 398 | case GL_CONSTANT_ALPHA: |
| 399 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 400 | break; |
| 401 | |
| 402 | case GL_SRC_ALPHA_SATURATE: |
| 403 | if (context->getClientVersion() < 3) |
| 404 | { |
| 405 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 406 | return; |
| 407 | } |
| 408 | break; |
| 409 | |
| 410 | default: |
| 411 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 412 | return; |
| 413 | } |
| 414 | |
| 415 | switch (srcAlpha) |
| 416 | { |
| 417 | case GL_ZERO: |
| 418 | case GL_ONE: |
| 419 | case GL_SRC_COLOR: |
| 420 | case GL_ONE_MINUS_SRC_COLOR: |
| 421 | case GL_DST_COLOR: |
| 422 | case GL_ONE_MINUS_DST_COLOR: |
| 423 | case GL_SRC_ALPHA: |
| 424 | case GL_ONE_MINUS_SRC_ALPHA: |
| 425 | case GL_DST_ALPHA: |
| 426 | case GL_ONE_MINUS_DST_ALPHA: |
| 427 | case GL_CONSTANT_COLOR: |
| 428 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 429 | case GL_CONSTANT_ALPHA: |
| 430 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 431 | case GL_SRC_ALPHA_SATURATE: |
| 432 | break; |
| 433 | |
| 434 | default: |
| 435 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 436 | return; |
| 437 | } |
| 438 | |
| 439 | switch (dstAlpha) |
| 440 | { |
| 441 | case GL_ZERO: |
| 442 | case GL_ONE: |
| 443 | case GL_SRC_COLOR: |
| 444 | case GL_ONE_MINUS_SRC_COLOR: |
| 445 | case GL_DST_COLOR: |
| 446 | case GL_ONE_MINUS_DST_COLOR: |
| 447 | case GL_SRC_ALPHA: |
| 448 | case GL_ONE_MINUS_SRC_ALPHA: |
| 449 | case GL_DST_ALPHA: |
| 450 | case GL_ONE_MINUS_DST_ALPHA: |
| 451 | case GL_CONSTANT_COLOR: |
| 452 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 453 | case GL_CONSTANT_ALPHA: |
| 454 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 455 | break; |
| 456 | |
| 457 | case GL_SRC_ALPHA_SATURATE: |
| 458 | if (context->getClientVersion() < 3) |
| 459 | { |
| 460 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 461 | return; |
| 462 | } |
| 463 | break; |
| 464 | |
| 465 | default: |
| 466 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 467 | return; |
| 468 | } |
| 469 | |
| 470 | bool constantColorUsed = (srcRGB == GL_CONSTANT_COLOR || srcRGB == GL_ONE_MINUS_CONSTANT_COLOR || |
| 471 | dstRGB == GL_CONSTANT_COLOR || dstRGB == GL_ONE_MINUS_CONSTANT_COLOR); |
| 472 | |
| 473 | bool constantAlphaUsed = (srcRGB == GL_CONSTANT_ALPHA || srcRGB == GL_ONE_MINUS_CONSTANT_ALPHA || |
| 474 | dstRGB == GL_CONSTANT_ALPHA || dstRGB == GL_ONE_MINUS_CONSTANT_ALPHA); |
| 475 | |
| 476 | if (constantColorUsed && constantAlphaUsed) |
| 477 | { |
| 478 | ERR("Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR invalid under WebGL"); |
| 479 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 480 | return; |
| 481 | } |
| 482 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 483 | context->getState().setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 484 | } |
| 485 | } |
| 486 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 487 | void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 488 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 489 | EVENT("(GLenum target = 0x%X, GLsizeiptr size = %d, const GLvoid* data = 0x%0.8p, GLenum usage = %d)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 490 | target, size, data, usage); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 491 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 492 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 493 | if (context) |
| 494 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 495 | if (size < 0) |
| 496 | { |
| 497 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 498 | return; |
| 499 | } |
| 500 | |
| 501 | switch (usage) |
| 502 | { |
| 503 | case GL_STREAM_DRAW: |
| 504 | case GL_STATIC_DRAW: |
| 505 | case GL_DYNAMIC_DRAW: |
| 506 | break; |
| 507 | |
| 508 | case GL_STREAM_READ: |
| 509 | case GL_STREAM_COPY: |
| 510 | case GL_STATIC_READ: |
| 511 | case GL_STATIC_COPY: |
| 512 | case GL_DYNAMIC_READ: |
| 513 | case GL_DYNAMIC_COPY: |
| 514 | if (context->getClientVersion() < 3) |
| 515 | { |
| 516 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 517 | return; |
| 518 | } |
| 519 | break; |
| 520 | |
| 521 | default: |
| 522 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 523 | return; |
| 524 | } |
| 525 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 526 | if (!gl::ValidBufferTarget(context, target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 527 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 528 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 529 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 530 | } |
| 531 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 532 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 533 | |
| 534 | if (!buffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 535 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 536 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 537 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 538 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 539 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 540 | gl::Error error = buffer->bufferData(data, size, usage); |
| 541 | if (error.isError()) |
| 542 | { |
| 543 | context->recordError(error); |
| 544 | return; |
| 545 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 546 | } |
| 547 | } |
| 548 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 549 | void GL_APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 550 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 551 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr size = %d, const GLvoid* data = 0x%0.8p)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 552 | target, offset, size, data); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 553 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 554 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 555 | if (context) |
| 556 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 557 | if (size < 0 || offset < 0) |
| 558 | { |
| 559 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 560 | return; |
| 561 | } |
| 562 | |
| 563 | if (data == NULL) |
| 564 | { |
| 565 | return; |
| 566 | } |
| 567 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 568 | if (!gl::ValidBufferTarget(context, target)) |
| 569 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 570 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 571 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 572 | } |
| 573 | |
| 574 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 575 | |
| 576 | if (!buffer) |
| 577 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 578 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 579 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 580 | } |
| 581 | |
| 582 | if (buffer->isMapped()) |
| 583 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 584 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 585 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 586 | } |
| 587 | |
| 588 | // Check for possible overflow of size + offset |
| 589 | if (!rx::IsUnsignedAdditionSafe<size_t>(size, offset)) |
| 590 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 591 | context->recordError(gl::Error(GL_OUT_OF_MEMORY)); |
| 592 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 593 | } |
| 594 | |
| 595 | if (size + offset > buffer->getSize()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 596 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 597 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 598 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 599 | } |
| 600 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 601 | gl::Error error = buffer->bufferSubData(data, size, offset); |
| 602 | if (error.isError()) |
| 603 | { |
| 604 | context->recordError(error); |
| 605 | return; |
| 606 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 607 | } |
| 608 | } |
| 609 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 610 | GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 611 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 612 | EVENT("(GLenum target = 0x%X)", target); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 613 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 614 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 615 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 616 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 617 | if (!gl::ValidFramebufferTarget(target)) |
| 618 | { |
| 619 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 620 | return 0; |
| 621 | } |
| 622 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 623 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 624 | ASSERT(framebuffer); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 625 | |
| 626 | return framebuffer->completeness(context->getData()); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 627 | } |
| 628 | |
| 629 | return 0; |
| 630 | } |
| 631 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 632 | void GL_APIENTRY glClear(GLbitfield mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 633 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 634 | EVENT("(GLbitfield mask = 0x%X)", mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 635 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 636 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 637 | if (context) |
| 638 | { |
| 639 | gl::Framebuffer *framebufferObject = context->getState().getDrawFramebuffer(); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 640 | ASSERT(framebufferObject); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 641 | |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 642 | if (framebufferObject->completeness(context->getData()) != GL_FRAMEBUFFER_COMPLETE) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 643 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 644 | context->recordError(gl::Error(GL_INVALID_FRAMEBUFFER_OPERATION)); |
| 645 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 646 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 647 | |
| 648 | if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0) |
| 649 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 650 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 651 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 652 | } |
| 653 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 654 | gl::Error error = context->clear(mask); |
| 655 | if (error.isError()) |
| 656 | { |
| 657 | context->recordError(error); |
| 658 | return; |
| 659 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 660 | } |
| 661 | } |
| 662 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 663 | void GL_APIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 664 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 665 | EVENT("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 666 | red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 667 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 668 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 669 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 670 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 671 | context->getState().setClearColor(red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 672 | } |
| 673 | } |
| 674 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 675 | void GL_APIENTRY glClearDepthf(GLclampf depth) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 676 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 677 | EVENT("(GLclampf depth = %f)", depth); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 678 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 679 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 680 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 681 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 682 | context->getState().setClearDepth(depth); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 683 | } |
| 684 | } |
| 685 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 686 | void GL_APIENTRY glClearStencil(GLint s) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 687 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 688 | EVENT("(GLint s = %d)", s); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 689 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 690 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 691 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 692 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 693 | context->getState().setClearStencil(s); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 694 | } |
| 695 | } |
| 696 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 697 | void GL_APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 698 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 699 | EVENT("(GLboolean red = %d, GLboolean green = %u, GLboolean blue = %u, GLboolean alpha = %u)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 700 | red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 701 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 702 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 703 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 704 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 705 | context->getState().setColorMask(red == GL_TRUE, green == GL_TRUE, blue == GL_TRUE, alpha == GL_TRUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 706 | } |
| 707 | } |
| 708 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 709 | void GL_APIENTRY glCompileShader(GLuint shader) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 710 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 711 | EVENT("(GLuint shader = %d)", shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 712 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 713 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 714 | if (context) |
| 715 | { |
| 716 | gl::Shader *shaderObject = context->getShader(shader); |
| 717 | |
| 718 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 719 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 720 | if (context->getProgram(shader)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 721 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 722 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 723 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 724 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 725 | else |
daniel@transgaming.com | 5d752f2 | 2010-10-07 13:37:20 +0000 | [diff] [blame] | 726 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 727 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 728 | return; |
daniel@transgaming.com | 5d752f2 | 2010-10-07 13:37:20 +0000 | [diff] [blame] | 729 | } |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 730 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 731 | |
Jamie Madill | 245d360 | 2014-11-13 10:03:30 -0500 | [diff] [blame] | 732 | shaderObject->compile(context->getData()); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 733 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 734 | } |
| 735 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 736 | void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 737 | GLint border, GLsizei imageSize, const GLvoid* data) |
| 738 | { |
| 739 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " |
| 740 | "GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
| 741 | target, level, internalformat, width, height, border, imageSize, data); |
| 742 | |
| 743 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 744 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 745 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 746 | if (context->getClientVersion() < 3 && |
| 747 | !ValidateES2TexImageParameters(context, target, level, internalformat, true, false, |
| 748 | 0, 0, width, height, border, GL_NONE, GL_NONE, data)) |
| 749 | { |
| 750 | return; |
| 751 | } |
| 752 | |
| 753 | if (context->getClientVersion() >= 3 && |
| 754 | !ValidateES3TexImageParameters(context, target, level, internalformat, true, false, |
| 755 | 0, 0, 0, width, height, 1, border, GL_NONE, GL_NONE, data)) |
| 756 | { |
| 757 | return; |
| 758 | } |
| 759 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 760 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat); |
| 761 | if (imageSize < 0 || static_cast<GLuint>(imageSize) != formatInfo.computeBlockSize(GL_UNSIGNED_BYTE, width, height)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 762 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 763 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 764 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 765 | } |
| 766 | |
| 767 | switch (target) |
| 768 | { |
| 769 | case GL_TEXTURE_2D: |
| 770 | { |
| 771 | gl::Texture2D *texture = context->getTexture2D(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 772 | gl::Error error = texture->setCompressedImage(level, internalformat, width, height, imageSize, context->getState().getUnpackState(), data); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 773 | if (error.isError()) |
| 774 | { |
| 775 | context->recordError(error); |
| 776 | return; |
| 777 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 778 | } |
| 779 | break; |
| 780 | |
| 781 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 782 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 783 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 784 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 785 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 786 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 787 | { |
| 788 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 789 | gl::Error error = texture->setCompressedImage(target, level, internalformat, width, height, imageSize, context->getState().getUnpackState(), data); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 790 | if (error.isError()) |
| 791 | { |
| 792 | context->recordError(error); |
| 793 | return; |
| 794 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 795 | } |
| 796 | break; |
| 797 | |
| 798 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 799 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 800 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 801 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 802 | } |
| 803 | } |
| 804 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 805 | void GL_APIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 806 | GLenum format, GLsizei imageSize, const GLvoid* data) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 807 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 808 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 809 | "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, " |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 810 | "GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 811 | target, level, xoffset, yoffset, width, height, format, imageSize, data); |
| 812 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 813 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 814 | if (context) |
| 815 | { |
| 816 | if (context->getClientVersion() < 3 && |
| 817 | !ValidateES2TexImageParameters(context, target, level, GL_NONE, true, true, |
| 818 | xoffset, yoffset, width, height, 0, GL_NONE, GL_NONE, data)) |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 819 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 820 | return; |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 821 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 822 | |
| 823 | if (context->getClientVersion() >= 3 && |
| 824 | !ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true, |
| 825 | xoffset, yoffset, 0, width, height, 1, 0, GL_NONE, GL_NONE, data)) |
| 826 | { |
| 827 | return; |
| 828 | } |
| 829 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 830 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format); |
| 831 | if (imageSize < 0 || static_cast<GLuint>(imageSize) != formatInfo.computeBlockSize(GL_UNSIGNED_BYTE, width, height)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 832 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 833 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 834 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 835 | } |
| 836 | |
| 837 | switch (target) |
| 838 | { |
| 839 | case GL_TEXTURE_2D: |
| 840 | { |
| 841 | gl::Texture2D *texture = context->getTexture2D(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 842 | gl::Error error = texture->subImageCompressed(level, xoffset, yoffset, width, height, format, imageSize, context->getState().getUnpackState(), data); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 843 | if (error.isError()) |
| 844 | { |
| 845 | context->recordError(error); |
| 846 | return; |
| 847 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 848 | } |
| 849 | break; |
| 850 | |
| 851 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 852 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 853 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 854 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 855 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 856 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 857 | { |
| 858 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 859 | gl::Error error = texture->subImageCompressed(target, level, xoffset, yoffset, width, height, format, imageSize, context->getState().getUnpackState(), data); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 860 | if (error.isError()) |
| 861 | { |
| 862 | context->recordError(error); |
| 863 | return; |
| 864 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 865 | } |
| 866 | break; |
| 867 | |
| 868 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 869 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 870 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 871 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 872 | } |
| 873 | } |
| 874 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 875 | void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 876 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 877 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, " |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 878 | "GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLint border = %d)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 879 | target, level, internalformat, x, y, width, height, border); |
| 880 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 881 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 882 | if (context) |
| 883 | { |
| 884 | if (context->getClientVersion() < 3 && |
| 885 | !ValidateES2CopyTexImageParameters(context, target, level, internalformat, false, |
| 886 | 0, 0, x, y, width, height, border)) |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 887 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 888 | return; |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 889 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 890 | |
| 891 | if (context->getClientVersion() >= 3 && |
| 892 | !ValidateES3CopyTexImageParameters(context, target, level, internalformat, false, |
| 893 | 0, 0, 0, x, y, width, height, border)) |
| 894 | { |
| 895 | return; |
| 896 | } |
| 897 | |
| 898 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 899 | |
| 900 | switch (target) |
| 901 | { |
| 902 | case GL_TEXTURE_2D: |
| 903 | { |
| 904 | gl::Texture2D *texture = context->getTexture2D(); |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 905 | gl::Error error = texture->copyImage(level, internalformat, x, y, width, height, framebuffer); |
| 906 | if (error.isError()) |
| 907 | { |
| 908 | context->recordError(error); |
| 909 | return; |
| 910 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 911 | } |
| 912 | break; |
| 913 | |
| 914 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 915 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 916 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 917 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 918 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 919 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 920 | { |
| 921 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 922 | gl::Error error = texture->copyImage(target, level, internalformat, x, y, width, height, framebuffer); |
| 923 | if (error.isError()) |
| 924 | { |
| 925 | context->recordError(error); |
| 926 | return; |
| 927 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 928 | } |
| 929 | break; |
| 930 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 931 | default: |
| 932 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 933 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 934 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 935 | } |
| 936 | } |
| 937 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 938 | void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 939 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 940 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 941 | "GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 942 | target, level, xoffset, yoffset, x, y, width, height); |
| 943 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 944 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 945 | if (context) |
| 946 | { |
| 947 | if (context->getClientVersion() < 3 && |
| 948 | !ValidateES2CopyTexImageParameters(context, target, level, GL_NONE, true, |
| 949 | xoffset, yoffset, x, y, width, height, 0)) |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 950 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 951 | return; |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 952 | } |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 953 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 954 | if (context->getClientVersion() >= 3 && |
| 955 | !ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true, |
| 956 | xoffset, yoffset, 0, x, y, width, height, 0)) |
| 957 | { |
| 958 | return; |
| 959 | } |
| 960 | |
| 961 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 962 | |
| 963 | switch (target) |
| 964 | { |
| 965 | case GL_TEXTURE_2D: |
| 966 | { |
| 967 | gl::Texture2D *texture = context->getTexture2D(); |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 968 | gl::Error error = texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer); |
| 969 | if (error.isError()) |
| 970 | { |
| 971 | context->recordError(error); |
| 972 | return; |
| 973 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 974 | } |
| 975 | break; |
| 976 | |
| 977 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 978 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 979 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 980 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 981 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 982 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 983 | { |
| 984 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 985 | gl::Error error = texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer); |
| 986 | if (error.isError()) |
| 987 | { |
| 988 | context->recordError(error); |
| 989 | return; |
| 990 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 991 | } |
| 992 | break; |
| 993 | |
| 994 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 995 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 996 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 997 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 998 | } |
| 999 | } |
| 1000 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1001 | GLuint GL_APIENTRY glCreateProgram(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1002 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1003 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1004 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1005 | gl::Context *context = gl::getNonLostContext(); |
| 1006 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1007 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1008 | return context->createProgram(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1009 | } |
| 1010 | |
| 1011 | return 0; |
| 1012 | } |
| 1013 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1014 | GLuint GL_APIENTRY glCreateShader(GLenum type) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1015 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1016 | EVENT("(GLenum type = 0x%X)", type); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1017 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1018 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1019 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1020 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1021 | switch (type) |
| 1022 | { |
| 1023 | case GL_FRAGMENT_SHADER: |
| 1024 | case GL_VERTEX_SHADER: |
| 1025 | return context->createShader(type); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1026 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1027 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1028 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1029 | return 0; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1030 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1031 | } |
| 1032 | |
| 1033 | return 0; |
| 1034 | } |
| 1035 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1036 | void GL_APIENTRY glCullFace(GLenum mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1037 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1038 | EVENT("(GLenum mode = 0x%X)", mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1039 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1040 | gl::Context *context = gl::getNonLostContext(); |
| 1041 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1042 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1043 | switch (mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1044 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1045 | case GL_FRONT: |
| 1046 | case GL_BACK: |
| 1047 | case GL_FRONT_AND_BACK: |
| 1048 | break; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1049 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1050 | default: |
| 1051 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1052 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1053 | } |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1054 | |
| 1055 | context->getState().setCullMode(mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1056 | } |
| 1057 | } |
| 1058 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1059 | void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint* buffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1060 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1061 | EVENT("(GLsizei n = %d, const GLuint* buffers = 0x%0.8p)", n, buffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1062 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1063 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1064 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1065 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1066 | if (n < 0) |
| 1067 | { |
| 1068 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1069 | return; |
| 1070 | } |
| 1071 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1072 | for (int i = 0; i < n; i++) |
| 1073 | { |
| 1074 | context->deleteBuffer(buffers[i]); |
| 1075 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1076 | } |
| 1077 | } |
| 1078 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1079 | void GL_APIENTRY glDeleteFencesNV(GLsizei n, const GLuint* fences) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1080 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1081 | EVENT("(GLsizei n = %d, const GLuint* fences = 0x%0.8p)", n, fences); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1082 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1083 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1084 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1085 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1086 | if (n < 0) |
| 1087 | { |
| 1088 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1089 | return; |
| 1090 | } |
| 1091 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1092 | for (int i = 0; i < n; i++) |
| 1093 | { |
| 1094 | context->deleteFenceNV(fences[i]); |
| 1095 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1096 | } |
| 1097 | } |
| 1098 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1099 | void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1100 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1101 | EVENT("(GLsizei n = %d, const GLuint* framebuffers = 0x%0.8p)", n, framebuffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1102 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1103 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1104 | if (context) |
| 1105 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1106 | if (n < 0) |
| 1107 | { |
| 1108 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1109 | return; |
| 1110 | } |
| 1111 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1112 | for (int i = 0; i < n; i++) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1113 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1114 | if (framebuffers[i] != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1115 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1116 | context->deleteFramebuffer(framebuffers[i]); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1117 | } |
| 1118 | } |
| 1119 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1120 | } |
| 1121 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1122 | void GL_APIENTRY glDeleteProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1123 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1124 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1125 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1126 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1127 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1128 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1129 | if (program == 0) |
| 1130 | { |
| 1131 | return; |
| 1132 | } |
| 1133 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1134 | if (!context->getProgram(program)) |
| 1135 | { |
| 1136 | if(context->getShader(program)) |
| 1137 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1138 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1139 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1140 | } |
| 1141 | else |
| 1142 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1143 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1144 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1145 | } |
| 1146 | } |
| 1147 | |
| 1148 | context->deleteProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1149 | } |
| 1150 | } |
| 1151 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1152 | void GL_APIENTRY glDeleteQueriesEXT(GLsizei n, const GLuint *ids) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1153 | { |
| 1154 | EVENT("(GLsizei n = %d, const GLuint *ids = 0x%0.8p)", n, ids); |
| 1155 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1156 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1157 | if (context) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1158 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1159 | if (n < 0) |
| 1160 | { |
| 1161 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1162 | return; |
| 1163 | } |
| 1164 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1165 | for (int i = 0; i < n; i++) |
| 1166 | { |
| 1167 | context->deleteQuery(ids[i]); |
| 1168 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1169 | } |
| 1170 | } |
| 1171 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1172 | void GL_APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1173 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1174 | EVENT("(GLsizei n = %d, const GLuint* renderbuffers = 0x%0.8p)", n, renderbuffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1175 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1176 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1177 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1178 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1179 | if (n < 0) |
| 1180 | { |
| 1181 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1182 | return; |
| 1183 | } |
| 1184 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1185 | for (int i = 0; i < n; i++) |
| 1186 | { |
| 1187 | context->deleteRenderbuffer(renderbuffers[i]); |
| 1188 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1189 | } |
| 1190 | } |
| 1191 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1192 | void GL_APIENTRY glDeleteShader(GLuint shader) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1193 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1194 | EVENT("(GLuint shader = %d)", shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1195 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1196 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1197 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1198 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1199 | if (shader == 0) |
| 1200 | { |
| 1201 | return; |
| 1202 | } |
| 1203 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1204 | if (!context->getShader(shader)) |
| 1205 | { |
| 1206 | if(context->getProgram(shader)) |
| 1207 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1208 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1209 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1210 | } |
| 1211 | else |
| 1212 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1213 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1214 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1215 | } |
| 1216 | } |
| 1217 | |
| 1218 | context->deleteShader(shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1219 | } |
| 1220 | } |
| 1221 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1222 | void GL_APIENTRY glDeleteTextures(GLsizei n, const GLuint* textures) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1223 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1224 | EVENT("(GLsizei n = %d, const GLuint* textures = 0x%0.8p)", n, textures); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1225 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1226 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1227 | if (context) |
| 1228 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1229 | if (n < 0) |
| 1230 | { |
| 1231 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1232 | return; |
| 1233 | } |
| 1234 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1235 | for (int i = 0; i < n; i++) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1236 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1237 | if (textures[i] != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1238 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1239 | context->deleteTexture(textures[i]); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1240 | } |
| 1241 | } |
| 1242 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1243 | } |
| 1244 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1245 | void GL_APIENTRY glDepthFunc(GLenum func) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1246 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1247 | EVENT("(GLenum func = 0x%X)", func); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1248 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1249 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1250 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1251 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1252 | switch (func) |
| 1253 | { |
| 1254 | case GL_NEVER: |
| 1255 | case GL_ALWAYS: |
| 1256 | case GL_LESS: |
| 1257 | case GL_LEQUAL: |
| 1258 | case GL_EQUAL: |
| 1259 | case GL_GREATER: |
| 1260 | case GL_GEQUAL: |
| 1261 | case GL_NOTEQUAL: |
| 1262 | context->getState().setDepthFunc(func); |
| 1263 | break; |
| 1264 | |
| 1265 | default: |
| 1266 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1267 | return; |
| 1268 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1269 | } |
| 1270 | } |
| 1271 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1272 | void GL_APIENTRY glDepthMask(GLboolean flag) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1273 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 1274 | EVENT("(GLboolean flag = %u)", flag); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1275 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1276 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1277 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1278 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1279 | context->getState().setDepthMask(flag != GL_FALSE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1280 | } |
| 1281 | } |
| 1282 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1283 | void GL_APIENTRY glDepthRangef(GLclampf zNear, GLclampf zFar) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1284 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1285 | EVENT("(GLclampf zNear = %f, GLclampf zFar = %f)", zNear, zFar); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1286 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1287 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1288 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1289 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1290 | context->getState().setDepthRange(zNear, zFar); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1291 | } |
| 1292 | } |
| 1293 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1294 | void GL_APIENTRY glDetachShader(GLuint program, GLuint shader) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1295 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1296 | EVENT("(GLuint program = %d, GLuint shader = %d)", program, shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1297 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1298 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1299 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1300 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1301 | gl::Program *programObject = context->getProgram(program); |
| 1302 | gl::Shader *shaderObject = context->getShader(shader); |
| 1303 | |
| 1304 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1305 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1306 | gl::Shader *shaderByProgramHandle; |
| 1307 | shaderByProgramHandle = context->getShader(program); |
| 1308 | if (!shaderByProgramHandle) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1309 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1310 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1311 | return; |
daniel@transgaming.com | 73c2c2e | 2010-04-13 03:26:11 +0000 | [diff] [blame] | 1312 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1313 | else |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1314 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1315 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1316 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1317 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1318 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1319 | |
| 1320 | if (!shaderObject) |
| 1321 | { |
| 1322 | gl::Program *programByShaderHandle = context->getProgram(shader); |
| 1323 | if (!programByShaderHandle) |
| 1324 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1325 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1326 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1327 | } |
| 1328 | else |
| 1329 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1330 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1331 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1332 | } |
| 1333 | } |
| 1334 | |
| 1335 | if (!programObject->detachShader(shaderObject)) |
| 1336 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1337 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1338 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1339 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1340 | } |
| 1341 | } |
| 1342 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1343 | void GL_APIENTRY glDisable(GLenum cap) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1344 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1345 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1346 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1347 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1348 | if (context) |
| 1349 | { |
| 1350 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1351 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1352 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1353 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1354 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1355 | |
| 1356 | context->getState().setEnableFeature(cap, false); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1357 | } |
| 1358 | } |
| 1359 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1360 | void GL_APIENTRY glDisableVertexAttribArray(GLuint index) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1361 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1362 | EVENT("(GLuint index = %d)", index); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1363 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1364 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1365 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1366 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1367 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 1368 | { |
| 1369 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1370 | return; |
| 1371 | } |
| 1372 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1373 | context->getState().setEnableVertexAttribArray(index, false); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1374 | } |
| 1375 | } |
| 1376 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1377 | void GL_APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1378 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1379 | EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d)", mode, first, count); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1380 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1381 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1382 | if (context) |
| 1383 | { |
Jamie Madill | 2b97681 | 2014-08-25 15:47:49 -0400 | [diff] [blame] | 1384 | if (!ValidateDrawArrays(context, mode, first, count, 0)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1385 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1386 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1387 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1388 | |
Geoff Lang | c77e8c3 | 2014-09-08 16:28:24 -0400 | [diff] [blame] | 1389 | gl::Error error = context->drawArrays(mode, first, count, 0); |
| 1390 | if (error.isError()) |
| 1391 | { |
| 1392 | context->recordError(error); |
| 1393 | return; |
| 1394 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1395 | } |
| 1396 | } |
| 1397 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1398 | void GL_APIENTRY glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1399 | { |
| 1400 | EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei primcount = %d)", mode, first, count, primcount); |
| 1401 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1402 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1403 | if (context) |
| 1404 | { |
Geoff Lang | 87a9330 | 2014-09-16 13:29:43 -0400 | [diff] [blame] | 1405 | if (!ValidateDrawArraysInstancedANGLE(context, mode, first, count, primcount)) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1406 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1407 | return; |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1408 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1409 | |
Geoff Lang | c77e8c3 | 2014-09-08 16:28:24 -0400 | [diff] [blame] | 1410 | gl::Error error = context->drawArrays(mode, first, count, primcount); |
| 1411 | if (error.isError()) |
| 1412 | { |
| 1413 | context->recordError(error); |
| 1414 | return; |
| 1415 | } |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1416 | } |
| 1417 | } |
| 1418 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1419 | void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1420 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1421 | EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 1422 | mode, count, type, indices); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1423 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1424 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1425 | if (context) |
| 1426 | { |
Jamie Madill | 2b97681 | 2014-08-25 15:47:49 -0400 | [diff] [blame] | 1427 | rx::RangeUI indexRange; |
| 1428 | if (!ValidateDrawElements(context, mode, count, type, indices, 0, &indexRange)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1429 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1430 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1431 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1432 | |
Geoff Lang | c77e8c3 | 2014-09-08 16:28:24 -0400 | [diff] [blame] | 1433 | gl::Error error = context->drawElements(mode, count, type, indices, 0, indexRange); |
| 1434 | if (error.isError()) |
| 1435 | { |
| 1436 | context->recordError(error); |
| 1437 | return; |
| 1438 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1439 | } |
| 1440 | } |
| 1441 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1442 | void GL_APIENTRY glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1443 | { |
| 1444 | EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei primcount = %d)", |
| 1445 | mode, count, type, indices, primcount); |
| 1446 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1447 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1448 | if (context) |
| 1449 | { |
Jamie Madill | 2b97681 | 2014-08-25 15:47:49 -0400 | [diff] [blame] | 1450 | rx::RangeUI indexRange; |
Geoff Lang | 87a9330 | 2014-09-16 13:29:43 -0400 | [diff] [blame] | 1451 | if (!ValidateDrawElementsInstancedANGLE(context, mode, count, type, indices, primcount, &indexRange)) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1452 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1453 | return; |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1454 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1455 | |
Geoff Lang | c77e8c3 | 2014-09-08 16:28:24 -0400 | [diff] [blame] | 1456 | gl::Error error = context->drawElements(mode, count, type, indices, primcount, indexRange); |
| 1457 | if (error.isError()) |
| 1458 | { |
| 1459 | context->recordError(error); |
| 1460 | return; |
| 1461 | } |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1462 | } |
| 1463 | } |
| 1464 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1465 | void GL_APIENTRY glEnable(GLenum cap) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1466 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1467 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1468 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1469 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1470 | if (context) |
| 1471 | { |
| 1472 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1473 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1474 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1475 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1476 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1477 | |
| 1478 | context->getState().setEnableFeature(cap, true); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1479 | } |
| 1480 | } |
| 1481 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1482 | void GL_APIENTRY glEnableVertexAttribArray(GLuint index) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1483 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1484 | EVENT("(GLuint index = %d)", index); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1485 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1486 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1487 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1488 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1489 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 1490 | { |
| 1491 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1492 | return; |
| 1493 | } |
| 1494 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1495 | context->getState().setEnableVertexAttribArray(index, true); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1496 | } |
| 1497 | } |
| 1498 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1499 | void GL_APIENTRY glEndQueryEXT(GLenum target) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1500 | { |
| 1501 | EVENT("GLenum target = 0x%X)", target); |
| 1502 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1503 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1504 | if (context) |
| 1505 | { |
| 1506 | if (!ValidateEndQuery(context, target)) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1507 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1508 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1509 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1510 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 1511 | gl::Error error = context->endQuery(target); |
| 1512 | if (error.isError()) |
| 1513 | { |
| 1514 | context->recordError(error); |
| 1515 | return; |
| 1516 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1517 | } |
| 1518 | } |
| 1519 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1520 | void GL_APIENTRY glFinishFenceNV(GLuint fence) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1521 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1522 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1523 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1524 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1525 | if (context) |
| 1526 | { |
| 1527 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 1528 | |
| 1529 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1530 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1531 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1532 | return; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1533 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1534 | |
| 1535 | if (fenceObject->isFence() != GL_TRUE) |
| 1536 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1537 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1538 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1539 | } |
| 1540 | |
| 1541 | fenceObject->finishFence(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1542 | } |
| 1543 | } |
| 1544 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1545 | void GL_APIENTRY glFinish(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1546 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1547 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1548 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1549 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1550 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1551 | { |
Geoff Lang | 2629856 | 2014-10-01 10:49:03 -0400 | [diff] [blame] | 1552 | gl::Error error = context->sync(true); |
| 1553 | if (error.isError()) |
| 1554 | { |
| 1555 | context->recordError(error); |
| 1556 | return; |
| 1557 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1558 | } |
| 1559 | } |
| 1560 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1561 | void GL_APIENTRY glFlush(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1562 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1563 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1564 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1565 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1566 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1567 | { |
Geoff Lang | 2629856 | 2014-10-01 10:49:03 -0400 | [diff] [blame] | 1568 | gl::Error error = context->sync(false); |
| 1569 | if (error.isError()) |
| 1570 | { |
| 1571 | context->recordError(error); |
| 1572 | return; |
| 1573 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1574 | } |
| 1575 | } |
| 1576 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1577 | void GL_APIENTRY glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1578 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1579 | EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum renderbuffertarget = 0x%X, " |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 1580 | "GLuint renderbuffer = %d)", target, attachment, renderbuffertarget, renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1581 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1582 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1583 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1584 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1585 | if (!gl::ValidFramebufferTarget(target) || (renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0)) |
| 1586 | { |
| 1587 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1588 | return; |
| 1589 | } |
| 1590 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1591 | if (!gl::ValidateFramebufferRenderbufferParameters(context, target, attachment, renderbuffertarget, renderbuffer)) |
| 1592 | { |
| 1593 | return; |
| 1594 | } |
| 1595 | |
| 1596 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 1597 | ASSERT(framebuffer); |
| 1598 | |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 1599 | if (renderbuffer != 0) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1600 | { |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 1601 | gl::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer); |
| 1602 | framebuffer->setRenderbufferAttachment(attachment, renderbufferObject); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1603 | } |
| 1604 | else |
| 1605 | { |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 1606 | framebuffer->setNULLAttachment(attachment); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1607 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1608 | } |
| 1609 | } |
| 1610 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1611 | void GL_APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1612 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1613 | EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, " |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 1614 | "GLuint texture = %d, GLint level = %d)", target, attachment, textarget, texture, level); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1615 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1616 | gl::Context *context = gl::getNonLostContext(); |
| 1617 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1618 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1619 | if (!ValidateFramebufferTexture2D(context, target, attachment, textarget, texture, level)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1620 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1621 | return; |
| 1622 | } |
shannon.woods%transgaming.com@gtempaccount.com | 89ae113 | 2013-04-13 03:28:43 +0000 | [diff] [blame] | 1623 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1624 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 1625 | ASSERT(framebuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1626 | |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 1627 | if (texture != 0) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1628 | { |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 1629 | gl::Texture *textureObj = context->getTexture(texture); |
| 1630 | gl::ImageIndex index(textarget, level, gl::ImageIndex::ENTIRE_LEVEL); |
| 1631 | framebuffer->setTextureAttachment(attachment, textureObj, index); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1632 | } |
| 1633 | else |
| 1634 | { |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 1635 | framebuffer->setNULLAttachment(attachment); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1636 | } |
| 1637 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1638 | } |
| 1639 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1640 | void GL_APIENTRY glFrontFace(GLenum mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1641 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1642 | EVENT("(GLenum mode = 0x%X)", mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1643 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1644 | gl::Context *context = gl::getNonLostContext(); |
| 1645 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1646 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1647 | switch (mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1648 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1649 | case GL_CW: |
| 1650 | case GL_CCW: |
| 1651 | context->getState().setFrontFace(mode); |
| 1652 | break; |
| 1653 | default: |
| 1654 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1655 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1656 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1657 | } |
| 1658 | } |
| 1659 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1660 | void GL_APIENTRY glGenBuffers(GLsizei n, GLuint* buffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1661 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1662 | EVENT("(GLsizei n = %d, GLuint* buffers = 0x%0.8p)", n, buffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1663 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1664 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1665 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1666 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1667 | if (n < 0) |
| 1668 | { |
| 1669 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1670 | return; |
| 1671 | } |
| 1672 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1673 | for (int i = 0; i < n; i++) |
| 1674 | { |
| 1675 | buffers[i] = context->createBuffer(); |
| 1676 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1677 | } |
| 1678 | } |
| 1679 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1680 | void GL_APIENTRY glGenerateMipmap(GLenum target) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1681 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1682 | EVENT("(GLenum target = 0x%X)", target); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1683 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1684 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1685 | if (context) |
| 1686 | { |
| 1687 | if (!ValidTextureTarget(context, target)) |
daniel@transgaming.com | 8fd99e2 | 2010-04-20 18:52:00 +0000 | [diff] [blame] | 1688 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1689 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1690 | return; |
daniel@transgaming.com | 8fd99e2 | 2010-04-20 18:52:00 +0000 | [diff] [blame] | 1691 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1692 | |
| 1693 | gl::Texture *texture = context->getTargetTexture(target); |
| 1694 | |
| 1695 | if (texture == NULL) |
| 1696 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1697 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1698 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1699 | } |
| 1700 | |
| 1701 | GLenum internalFormat = texture->getBaseLevelInternalFormat(); |
| 1702 | const gl::TextureCaps &formatCaps = context->getTextureCaps().get(internalFormat); |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 1703 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1704 | |
| 1705 | // GenerateMipmap should not generate an INVALID_OPERATION for textures created with |
| 1706 | // unsized formats or that are color renderable and filterable. Since we do not track if |
| 1707 | // the texture was created with sized or unsized format (only sized formats are stored), |
| 1708 | // it is not possible to make sure the the LUMA formats can generate mipmaps (they should |
| 1709 | // be able to) because they aren't color renderable. Simply do a special case for LUMA |
| 1710 | // textures since they're the only texture format that can be created with unsized formats |
| 1711 | // that is not color renderable. New unsized formats are unlikely to be added, since ES2 |
| 1712 | // was the last version to use add them. |
| 1713 | bool isLUMA = internalFormat == GL_LUMINANCE8_EXT || |
| 1714 | internalFormat == GL_LUMINANCE8_ALPHA8_EXT || |
| 1715 | internalFormat == GL_ALPHA8_EXT; |
| 1716 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 1717 | if (formatInfo.depthBits > 0 || formatInfo.stencilBits > 0 || !formatCaps.filterable || |
| 1718 | (!formatCaps.renderable && !isLUMA) || formatInfo.compressed) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1719 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1720 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1721 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1722 | } |
| 1723 | |
| 1724 | // GL_EXT_sRGB does not support mipmap generation on sRGB textures |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 1725 | if (context->getClientVersion() == 2 && formatInfo.colorEncoding == GL_SRGB) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1726 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1727 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1728 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1729 | } |
| 1730 | |
| 1731 | // Non-power of 2 ES2 check |
| 1732 | if (!context->getExtensions().textureNPOT && (!gl::isPow2(texture->getBaseLevelWidth()) || !gl::isPow2(texture->getBaseLevelHeight()))) |
| 1733 | { |
| 1734 | ASSERT(context->getClientVersion() <= 2 && (target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP)); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1735 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1736 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1737 | } |
| 1738 | |
| 1739 | // Cube completeness check |
| 1740 | if (target == GL_TEXTURE_CUBE_MAP) |
| 1741 | { |
| 1742 | gl::TextureCubeMap *textureCube = static_cast<gl::TextureCubeMap *>(texture); |
| 1743 | if (!textureCube->isCubeComplete()) |
| 1744 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1745 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1746 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1747 | } |
| 1748 | } |
| 1749 | |
Geoff Lang | 06ecf3d | 2014-09-23 16:39:50 -0400 | [diff] [blame] | 1750 | gl::Error error = texture->generateMipmaps(); |
| 1751 | if (error.isError()) |
| 1752 | { |
| 1753 | context->recordError(error); |
| 1754 | return; |
| 1755 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1756 | } |
| 1757 | } |
| 1758 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1759 | void GL_APIENTRY glGenFencesNV(GLsizei n, GLuint* fences) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1760 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1761 | EVENT("(GLsizei n = %d, GLuint* fences = 0x%0.8p)", n, fences); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1762 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1763 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1764 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1765 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1766 | if (n < 0) |
| 1767 | { |
| 1768 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1769 | return; |
| 1770 | } |
| 1771 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1772 | for (int i = 0; i < n; i++) |
| 1773 | { |
| 1774 | fences[i] = context->createFenceNV(); |
| 1775 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1776 | } |
| 1777 | } |
| 1778 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1779 | void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1780 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1781 | EVENT("(GLsizei n = %d, GLuint* framebuffers = 0x%0.8p)", n, framebuffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1782 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1783 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1784 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1785 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1786 | if (n < 0) |
| 1787 | { |
| 1788 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1789 | return; |
| 1790 | } |
| 1791 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1792 | for (int i = 0; i < n; i++) |
| 1793 | { |
| 1794 | framebuffers[i] = context->createFramebuffer(); |
| 1795 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1796 | } |
| 1797 | } |
| 1798 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1799 | void GL_APIENTRY glGenQueriesEXT(GLsizei n, GLuint* ids) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1800 | { |
| 1801 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 1802 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1803 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1804 | if (context) |
| 1805 | { |
| 1806 | if (n < 0) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1807 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1808 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1809 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1810 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1811 | |
| 1812 | for (GLsizei i = 0; i < n; i++) |
| 1813 | { |
| 1814 | ids[i] = context->createQuery(); |
| 1815 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1816 | } |
| 1817 | } |
| 1818 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1819 | void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1820 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1821 | EVENT("(GLsizei n = %d, GLuint* renderbuffers = 0x%0.8p)", n, renderbuffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1822 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1823 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1824 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1825 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1826 | if (n < 0) |
| 1827 | { |
| 1828 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1829 | return; |
| 1830 | } |
| 1831 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1832 | for (int i = 0; i < n; i++) |
| 1833 | { |
| 1834 | renderbuffers[i] = context->createRenderbuffer(); |
| 1835 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1836 | } |
| 1837 | } |
| 1838 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1839 | void GL_APIENTRY glGenTextures(GLsizei n, GLuint* textures) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1840 | { |
Jamie Madill | 1fc7e2c | 2014-01-21 16:47:10 -0500 | [diff] [blame] | 1841 | EVENT("(GLsizei n = %d, GLuint* textures = 0x%0.8p)", n, textures); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1842 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1843 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1844 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1845 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1846 | if (n < 0) |
| 1847 | { |
| 1848 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1849 | return; |
| 1850 | } |
| 1851 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1852 | for (int i = 0; i < n; i++) |
| 1853 | { |
| 1854 | textures[i] = context->createTexture(); |
| 1855 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1856 | } |
| 1857 | } |
| 1858 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1859 | void GL_APIENTRY glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1860 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1861 | EVENT("(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, GLsizei *length = 0x%0.8p, " |
daniel@transgaming.com | 8542318 | 2010-04-22 13:35:27 +0000 | [diff] [blame] | 1862 | "GLint *size = 0x%0.8p, GLenum *type = %0.8p, GLchar *name = %0.8p)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1863 | program, index, bufsize, length, size, type, name); |
| 1864 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1865 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1866 | if (context) |
| 1867 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1868 | if (bufsize < 0) |
| 1869 | { |
| 1870 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1871 | return; |
| 1872 | } |
| 1873 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1874 | gl::Program *programObject = context->getProgram(program); |
| 1875 | |
| 1876 | if (!programObject) |
| 1877 | { |
| 1878 | if (context->getShader(program)) |
| 1879 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1880 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1881 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1882 | } |
| 1883 | else |
| 1884 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1885 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1886 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1887 | } |
| 1888 | } |
| 1889 | |
| 1890 | if (index >= (GLuint)programObject->getActiveAttributeCount()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1891 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1892 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1893 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1894 | } |
| 1895 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1896 | programObject->getActiveAttribute(index, bufsize, length, size, type, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1897 | } |
| 1898 | } |
| 1899 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1900 | void GL_APIENTRY glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1901 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1902 | EVENT("(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, " |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 1903 | "GLsizei* length = 0x%0.8p, GLint* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1904 | program, index, bufsize, length, size, type, name); |
| 1905 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1906 | |
| 1907 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1908 | if (context) |
| 1909 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1910 | if (bufsize < 0) |
| 1911 | { |
| 1912 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1913 | return; |
| 1914 | } |
| 1915 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1916 | gl::Program *programObject = context->getProgram(program); |
| 1917 | |
| 1918 | if (!programObject) |
| 1919 | { |
| 1920 | if (context->getShader(program)) |
| 1921 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1922 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1923 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1924 | } |
| 1925 | else |
| 1926 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1927 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1928 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1929 | } |
| 1930 | } |
| 1931 | |
| 1932 | if (index >= (GLuint)programObject->getActiveUniformCount()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1933 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1934 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1935 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1936 | } |
| 1937 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1938 | programObject->getActiveUniform(index, bufsize, length, size, type, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1939 | } |
| 1940 | } |
| 1941 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1942 | void GL_APIENTRY glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1943 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1944 | EVENT("(GLuint program = %d, GLsizei maxcount = %d, GLsizei* count = 0x%0.8p, GLuint* shaders = 0x%0.8p)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 1945 | program, maxcount, count, shaders); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1946 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1947 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1948 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1949 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1950 | if (maxcount < 0) |
| 1951 | { |
| 1952 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1953 | return; |
| 1954 | } |
| 1955 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1956 | gl::Program *programObject = context->getProgram(program); |
| 1957 | |
| 1958 | if (!programObject) |
| 1959 | { |
| 1960 | if (context->getShader(program)) |
| 1961 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1962 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1963 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1964 | } |
| 1965 | else |
| 1966 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1967 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1968 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1969 | } |
| 1970 | } |
| 1971 | |
| 1972 | return programObject->getAttachedShaders(maxcount, count, shaders); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1973 | } |
| 1974 | } |
| 1975 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1976 | GLint GL_APIENTRY glGetAttribLocation(GLuint program, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1977 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1978 | EVENT("(GLuint program = %d, const GLchar* name = %s)", program, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1979 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1980 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1981 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1982 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1983 | gl::Program *programObject = context->getProgram(program); |
| 1984 | |
| 1985 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1986 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1987 | if (context->getShader(program)) |
daniel@transgaming.com | cf4aa87 | 2010-04-13 03:26:27 +0000 | [diff] [blame] | 1988 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1989 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1990 | return -1; |
daniel@transgaming.com | cf4aa87 | 2010-04-13 03:26:27 +0000 | [diff] [blame] | 1991 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1992 | else |
| 1993 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1994 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1995 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1996 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1997 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1998 | |
| 1999 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 2000 | if (!programObject->isLinked() || !programBinary) |
| 2001 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2002 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2003 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2004 | } |
| 2005 | |
| 2006 | return programBinary->getAttributeLocation(name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2007 | } |
| 2008 | |
| 2009 | return -1; |
| 2010 | } |
| 2011 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2012 | void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2013 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2014 | EVENT("(GLenum pname = 0x%X, GLboolean* params = 0x%0.8p)", pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2015 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2016 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2017 | if (context) |
| 2018 | { |
| 2019 | GLenum nativeType; |
| 2020 | unsigned int numParams = 0; |
| 2021 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2022 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2023 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2024 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2025 | |
| 2026 | if (nativeType == GL_BOOL) |
| 2027 | { |
| 2028 | context->getBooleanv(pname, params); |
| 2029 | } |
| 2030 | else |
| 2031 | { |
| 2032 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2033 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2034 | } |
| 2035 | } |
| 2036 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2037 | void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2038 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2039 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2040 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2041 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2042 | if (context) |
| 2043 | { |
| 2044 | if (!gl::ValidBufferTarget(context, target)) |
daniel@transgaming.com | aa0ccbd | 2010-04-15 20:45:05 +0000 | [diff] [blame] | 2045 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2046 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2047 | return; |
daniel@transgaming.com | aa0ccbd | 2010-04-15 20:45:05 +0000 | [diff] [blame] | 2048 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2049 | |
| 2050 | if (!gl::ValidBufferParameter(context, pname)) |
| 2051 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2052 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2053 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2054 | } |
| 2055 | |
| 2056 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 2057 | |
| 2058 | if (!buffer) |
| 2059 | { |
| 2060 | // A null buffer means that "0" is bound to the requested buffer target |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2061 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2062 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2063 | } |
| 2064 | |
| 2065 | switch (pname) |
| 2066 | { |
| 2067 | case GL_BUFFER_USAGE: |
| 2068 | *params = static_cast<GLint>(buffer->getUsage()); |
| 2069 | break; |
| 2070 | case GL_BUFFER_SIZE: |
| 2071 | *params = gl::clampCast<GLint>(buffer->getSize()); |
| 2072 | break; |
| 2073 | case GL_BUFFER_ACCESS_FLAGS: |
| 2074 | *params = buffer->getAccessFlags(); |
| 2075 | break; |
| 2076 | case GL_BUFFER_MAPPED: |
| 2077 | *params = static_cast<GLint>(buffer->isMapped()); |
| 2078 | break; |
| 2079 | case GL_BUFFER_MAP_OFFSET: |
| 2080 | *params = gl::clampCast<GLint>(buffer->getMapOffset()); |
| 2081 | break; |
| 2082 | case GL_BUFFER_MAP_LENGTH: |
| 2083 | *params = gl::clampCast<GLint>(buffer->getMapLength()); |
| 2084 | break; |
| 2085 | default: UNREACHABLE(); break; |
| 2086 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2087 | } |
| 2088 | } |
| 2089 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2090 | GLenum GL_APIENTRY glGetError(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2091 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2092 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2093 | |
| 2094 | gl::Context *context = gl::getContext(); |
| 2095 | |
| 2096 | if (context) |
| 2097 | { |
daniel@transgaming.com | 82b2891 | 2011-12-12 21:01:35 +0000 | [diff] [blame] | 2098 | return context->getError(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2099 | } |
| 2100 | |
| 2101 | return GL_NO_ERROR; |
| 2102 | } |
| 2103 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2104 | void GL_APIENTRY glGetFenceivNV(GLuint fence, GLenum pname, GLint *params) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2105 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2106 | EVENT("(GLuint fence = %d, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", fence, pname, params); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2107 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2108 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2109 | if (context) |
| 2110 | { |
| 2111 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 2112 | |
| 2113 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2114 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2115 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2116 | return; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2117 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2118 | |
| 2119 | if (fenceObject->isFence() != GL_TRUE) |
| 2120 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2121 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2122 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2123 | } |
| 2124 | |
| 2125 | switch (pname) |
| 2126 | { |
| 2127 | case GL_FENCE_STATUS_NV: |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 2128 | { |
| 2129 | // GL_NV_fence spec: |
| 2130 | // Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV |
| 2131 | // or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence. |
| 2132 | GLboolean status = GL_TRUE; |
| 2133 | if (fenceObject->getStatus() != GL_TRUE) |
| 2134 | { |
| 2135 | gl::Error error = fenceObject->testFence(&status); |
| 2136 | if (error.isError()) |
| 2137 | { |
| 2138 | context->recordError(error); |
| 2139 | return; |
| 2140 | } |
| 2141 | } |
| 2142 | *params = status; |
| 2143 | break; |
| 2144 | } |
| 2145 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2146 | case GL_FENCE_CONDITION_NV: |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 2147 | { |
| 2148 | *params = fenceObject->getCondition(); |
| 2149 | break; |
| 2150 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2151 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2152 | default: |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 2153 | { |
| 2154 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2155 | return; |
| 2156 | } |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 2157 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2158 | } |
| 2159 | } |
| 2160 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2161 | void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2162 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2163 | EVENT("(GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2164 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2165 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2166 | if (context) |
| 2167 | { |
| 2168 | GLenum nativeType; |
| 2169 | unsigned int numParams = 0; |
| 2170 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 32e58cd | 2010-03-24 09:44:10 +0000 | [diff] [blame] | 2171 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2172 | return; |
daniel@transgaming.com | 32e58cd | 2010-03-24 09:44:10 +0000 | [diff] [blame] | 2173 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2174 | |
| 2175 | if (nativeType == GL_FLOAT) |
| 2176 | { |
| 2177 | context->getFloatv(pname, params); |
| 2178 | } |
| 2179 | else |
| 2180 | { |
| 2181 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2182 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2183 | } |
| 2184 | } |
| 2185 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2186 | void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2187 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2188 | EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 2189 | target, attachment, pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2190 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2191 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2192 | if (context) |
| 2193 | { |
| 2194 | if (!gl::ValidFramebufferTarget(target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2195 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2196 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2197 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2198 | } |
| 2199 | |
| 2200 | int clientVersion = context->getClientVersion(); |
| 2201 | |
| 2202 | switch (pname) |
| 2203 | { |
| 2204 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2205 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2206 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| 2207 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| 2208 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2209 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2210 | case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: |
| 2211 | if (clientVersion < 3 && !context->getExtensions().sRGB) |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2212 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2213 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2214 | return; |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2215 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2216 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2217 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2218 | case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: |
| 2219 | case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: |
| 2220 | case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: |
| 2221 | case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: |
| 2222 | case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: |
| 2223 | case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: |
| 2224 | case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: |
| 2225 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: |
| 2226 | if (clientVersion < 3) |
| 2227 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2228 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2229 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2230 | } |
| 2231 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2232 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2233 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2234 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2235 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2236 | } |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2237 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2238 | // Determine if the attachment is a valid enum |
| 2239 | switch (attachment) |
| 2240 | { |
| 2241 | case GL_BACK: |
| 2242 | case GL_FRONT: |
| 2243 | case GL_DEPTH: |
| 2244 | case GL_STENCIL: |
| 2245 | case GL_DEPTH_STENCIL_ATTACHMENT: |
| 2246 | if (clientVersion < 3) |
| 2247 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2248 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2249 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2250 | } |
| 2251 | break; |
| 2252 | |
| 2253 | case GL_DEPTH_ATTACHMENT: |
| 2254 | case GL_STENCIL_ATTACHMENT: |
| 2255 | break; |
| 2256 | |
| 2257 | default: |
| 2258 | if (attachment < GL_COLOR_ATTACHMENT0_EXT || |
| 2259 | (attachment - GL_COLOR_ATTACHMENT0_EXT) >= context->getCaps().maxColorAttachments) |
| 2260 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2261 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2262 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2263 | } |
| 2264 | break; |
| 2265 | } |
| 2266 | |
Geoff Lang | 6a1e6b9 | 2014-11-06 10:42:45 -0500 | [diff] [blame] | 2267 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 2268 | ASSERT(framebuffer); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2269 | |
Geoff Lang | 6a1e6b9 | 2014-11-06 10:42:45 -0500 | [diff] [blame] | 2270 | if (framebuffer->id() == 0) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2271 | { |
| 2272 | if (clientVersion < 3) |
| 2273 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2274 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2275 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2276 | } |
| 2277 | |
| 2278 | switch (attachment) |
| 2279 | { |
| 2280 | case GL_BACK: |
| 2281 | case GL_DEPTH: |
| 2282 | case GL_STENCIL: |
| 2283 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2284 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2285 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2286 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2287 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2288 | } |
| 2289 | } |
| 2290 | else |
| 2291 | { |
| 2292 | if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT) |
| 2293 | { |
| 2294 | // Valid attachment query |
| 2295 | } |
| 2296 | else |
| 2297 | { |
| 2298 | switch (attachment) |
| 2299 | { |
| 2300 | case GL_DEPTH_ATTACHMENT: |
| 2301 | case GL_STENCIL_ATTACHMENT: |
| 2302 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2303 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2304 | case GL_DEPTH_STENCIL_ATTACHMENT: |
| 2305 | if (framebuffer->hasValidDepthStencil()) |
| 2306 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2307 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2308 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2309 | } |
| 2310 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2311 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2312 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2313 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2314 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2315 | } |
| 2316 | } |
| 2317 | } |
| 2318 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2319 | const gl::FramebufferAttachment *attachmentObject = framebuffer->getAttachment(attachment); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2320 | if (attachmentObject) |
| 2321 | { |
Geoff Lang | 6a1e6b9 | 2014-11-06 10:42:45 -0500 | [diff] [blame] | 2322 | ASSERT(attachmentObject->type() == GL_RENDERBUFFER || |
| 2323 | attachmentObject->type() == GL_TEXTURE || |
| 2324 | attachmentObject->type() == GL_FRAMEBUFFER_DEFAULT); |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 2325 | |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2326 | switch (pname) |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2327 | { |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2328 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
Geoff Lang | 6a1e6b9 | 2014-11-06 10:42:45 -0500 | [diff] [blame] | 2329 | *params = attachmentObject->type(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2330 | break; |
| 2331 | |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2332 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
Geoff Lang | 6a1e6b9 | 2014-11-06 10:42:45 -0500 | [diff] [blame] | 2333 | if (attachmentObject->type() != GL_RENDERBUFFER && attachmentObject->type() != GL_TEXTURE) |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2334 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2335 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2336 | return; |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2337 | } |
Geoff Lang | 6a1e6b9 | 2014-11-06 10:42:45 -0500 | [diff] [blame] | 2338 | *params = attachmentObject->id(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2339 | break; |
| 2340 | |
| 2341 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
Geoff Lang | 6a1e6b9 | 2014-11-06 10:42:45 -0500 | [diff] [blame] | 2342 | if (attachmentObject->type() != GL_TEXTURE) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2343 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2344 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2345 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2346 | } |
Geoff Lang | 6a1e6b9 | 2014-11-06 10:42:45 -0500 | [diff] [blame] | 2347 | *params = attachmentObject->mipLevel(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2348 | break; |
| 2349 | |
| 2350 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
Geoff Lang | 6a1e6b9 | 2014-11-06 10:42:45 -0500 | [diff] [blame] | 2351 | if (attachmentObject->type() != GL_TEXTURE) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2352 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2353 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2354 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2355 | } |
Geoff Lang | 6a1e6b9 | 2014-11-06 10:42:45 -0500 | [diff] [blame] | 2356 | *params = attachmentObject->cubeMapFace(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2357 | break; |
| 2358 | |
| 2359 | case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: |
| 2360 | *params = attachmentObject->getRedSize(); |
| 2361 | break; |
| 2362 | |
| 2363 | case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: |
| 2364 | *params = attachmentObject->getGreenSize(); |
| 2365 | break; |
| 2366 | |
| 2367 | case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: |
| 2368 | *params = attachmentObject->getBlueSize(); |
| 2369 | break; |
| 2370 | |
| 2371 | case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: |
| 2372 | *params = attachmentObject->getAlphaSize(); |
| 2373 | break; |
| 2374 | |
| 2375 | case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: |
| 2376 | *params = attachmentObject->getDepthSize(); |
| 2377 | break; |
| 2378 | |
| 2379 | case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: |
| 2380 | *params = attachmentObject->getStencilSize(); |
| 2381 | break; |
| 2382 | |
| 2383 | case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: |
Jamie Madill | ee85d1b | 2014-09-17 10:35:23 -0400 | [diff] [blame] | 2384 | if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2385 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2386 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2387 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2388 | } |
| 2389 | *params = attachmentObject->getComponentType(); |
| 2390 | break; |
| 2391 | |
| 2392 | case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: |
| 2393 | *params = attachmentObject->getColorEncoding(); |
| 2394 | break; |
| 2395 | |
| 2396 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: |
Geoff Lang | 6a1e6b9 | 2014-11-06 10:42:45 -0500 | [diff] [blame] | 2397 | if (attachmentObject->type() != GL_TEXTURE) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2398 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2399 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2400 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2401 | } |
Geoff Lang | 6a1e6b9 | 2014-11-06 10:42:45 -0500 | [diff] [blame] | 2402 | *params = attachmentObject->layer(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2403 | break; |
| 2404 | |
| 2405 | default: |
| 2406 | UNREACHABLE(); |
| 2407 | break; |
| 2408 | } |
| 2409 | } |
Geoff Lang | 6a1e6b9 | 2014-11-06 10:42:45 -0500 | [diff] [blame] | 2410 | else |
| 2411 | { |
| 2412 | // ES 2.0.25 spec pg 127 states that if the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE |
| 2413 | // is NONE, then querying any other pname will generate INVALID_ENUM. |
| 2414 | |
| 2415 | // ES 3.0.2 spec pg 235 states that if the attachment type is none, |
| 2416 | // GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero and be an |
| 2417 | // INVALID_OPERATION for all other pnames |
| 2418 | |
| 2419 | switch (pname) |
| 2420 | { |
| 2421 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2422 | *params = GL_NONE; |
| 2423 | break; |
| 2424 | |
| 2425 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2426 | if (clientVersion < 3) |
| 2427 | { |
| 2428 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2429 | return; |
| 2430 | } |
| 2431 | *params = 0; |
| 2432 | break; |
| 2433 | |
| 2434 | default: |
| 2435 | if (clientVersion < 3) |
| 2436 | { |
| 2437 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2438 | return; |
| 2439 | } |
| 2440 | else |
| 2441 | { |
| 2442 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2443 | return; |
| 2444 | } |
| 2445 | } |
| 2446 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2447 | } |
| 2448 | } |
| 2449 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2450 | GLenum GL_APIENTRY glGetGraphicsResetStatusEXT(void) |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2451 | { |
| 2452 | EVENT("()"); |
| 2453 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2454 | gl::Context *context = gl::getContext(); |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2455 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2456 | if (context) |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2457 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2458 | return context->getResetStatus(); |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2459 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2460 | |
| 2461 | return GL_NO_ERROR; |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2462 | } |
| 2463 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2464 | void GL_APIENTRY glGetIntegerv(GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2465 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2466 | EVENT("(GLenum pname = 0x%X, GLint* params = 0x%0.8p)", pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2467 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2468 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2469 | if (context) |
| 2470 | { |
| 2471 | GLenum nativeType; |
| 2472 | unsigned int numParams = 0; |
| 2473 | |
| 2474 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2475 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2476 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2477 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2478 | |
| 2479 | if (nativeType == GL_INT) |
| 2480 | { |
| 2481 | context->getIntegerv(pname, params); |
| 2482 | } |
| 2483 | else |
| 2484 | { |
| 2485 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2486 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2487 | } |
| 2488 | } |
| 2489 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2490 | void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2491 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2492 | EVENT("(GLuint program = %d, GLenum pname = %d, GLint* params = 0x%0.8p)", program, pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2493 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2494 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2495 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2496 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2497 | gl::Program *programObject = context->getProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2498 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2499 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2500 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2501 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2502 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2503 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2504 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2505 | if (context->getClientVersion() < 3) |
| 2506 | { |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2507 | switch (pname) |
| 2508 | { |
shannonwoods@chromium.org | e684b58 | 2013-05-30 00:07:42 +0000 | [diff] [blame] | 2509 | case GL_ACTIVE_UNIFORM_BLOCKS: |
shannonwoods@chromium.org | e684b58 | 2013-05-30 00:07:42 +0000 | [diff] [blame] | 2510 | case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2511 | case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2512 | case GL_TRANSFORM_FEEDBACK_VARYINGS: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2513 | case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2514 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2515 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2516 | } |
| 2517 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2518 | |
| 2519 | switch (pname) |
| 2520 | { |
| 2521 | case GL_DELETE_STATUS: |
| 2522 | *params = programObject->isFlaggedForDeletion(); |
| 2523 | return; |
| 2524 | case GL_LINK_STATUS: |
| 2525 | *params = programObject->isLinked(); |
| 2526 | return; |
| 2527 | case GL_VALIDATE_STATUS: |
| 2528 | *params = programObject->isValidated(); |
| 2529 | return; |
| 2530 | case GL_INFO_LOG_LENGTH: |
| 2531 | *params = programObject->getInfoLogLength(); |
| 2532 | return; |
| 2533 | case GL_ATTACHED_SHADERS: |
| 2534 | *params = programObject->getAttachedShadersCount(); |
| 2535 | return; |
| 2536 | case GL_ACTIVE_ATTRIBUTES: |
| 2537 | *params = programObject->getActiveAttributeCount(); |
| 2538 | return; |
| 2539 | case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH: |
| 2540 | *params = programObject->getActiveAttributeMaxLength(); |
| 2541 | return; |
| 2542 | case GL_ACTIVE_UNIFORMS: |
| 2543 | *params = programObject->getActiveUniformCount(); |
| 2544 | return; |
| 2545 | case GL_ACTIVE_UNIFORM_MAX_LENGTH: |
| 2546 | *params = programObject->getActiveUniformMaxLength(); |
| 2547 | return; |
| 2548 | case GL_PROGRAM_BINARY_LENGTH_OES: |
| 2549 | *params = programObject->getProgramBinaryLength(); |
| 2550 | return; |
| 2551 | case GL_ACTIVE_UNIFORM_BLOCKS: |
| 2552 | *params = programObject->getActiveUniformBlockCount(); |
| 2553 | return; |
| 2554 | case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: |
| 2555 | *params = programObject->getActiveUniformBlockMaxLength(); |
| 2556 | break; |
| 2557 | case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: |
| 2558 | *params = programObject->getTransformFeedbackBufferMode(); |
| 2559 | break; |
| 2560 | case GL_TRANSFORM_FEEDBACK_VARYINGS: |
| 2561 | *params = programObject->getTransformFeedbackVaryingCount(); |
| 2562 | break; |
| 2563 | case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: |
| 2564 | *params = programObject->getTransformFeedbackVaryingMaxLength(); |
| 2565 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2566 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2567 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2568 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2569 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2570 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2571 | } |
| 2572 | } |
| 2573 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2574 | void GL_APIENTRY glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2575 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2576 | EVENT("(GLuint program = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* infolog = 0x%0.8p)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 2577 | program, bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2578 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2579 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2580 | if (context) |
| 2581 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2582 | if (bufsize < 0) |
| 2583 | { |
| 2584 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2585 | return; |
| 2586 | } |
| 2587 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2588 | gl::Program *programObject = context->getProgram(program); |
| 2589 | |
| 2590 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2591 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2592 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2593 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2594 | } |
| 2595 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2596 | programObject->getInfoLog(bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2597 | } |
| 2598 | } |
| 2599 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2600 | void GL_APIENTRY glGetQueryivEXT(GLenum target, GLenum pname, GLint *params) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2601 | { |
| 2602 | EVENT("GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname, params); |
| 2603 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2604 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2605 | if (context) |
| 2606 | { |
| 2607 | if (!ValidQueryType(context, target)) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2608 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2609 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2610 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2611 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2612 | |
| 2613 | switch (pname) |
| 2614 | { |
| 2615 | case GL_CURRENT_QUERY_EXT: |
| 2616 | params[0] = context->getState().getActiveQueryId(target); |
| 2617 | break; |
| 2618 | |
| 2619 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2620 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2621 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2622 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2623 | } |
| 2624 | } |
| 2625 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2626 | void GL_APIENTRY glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2627 | { |
| 2628 | EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)", id, pname, params); |
| 2629 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2630 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2631 | if (context) |
| 2632 | { |
| 2633 | gl::Query *queryObject = context->getQuery(id, false, GL_NONE); |
| 2634 | |
| 2635 | if (!queryObject) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2636 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2637 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2638 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2639 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2640 | |
| 2641 | if (context->getState().getActiveQueryId(queryObject->getType()) == id) |
| 2642 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2643 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2644 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2645 | } |
| 2646 | |
| 2647 | switch(pname) |
| 2648 | { |
| 2649 | case GL_QUERY_RESULT_EXT: |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2650 | { |
| 2651 | gl::Error error = queryObject->getResult(params); |
| 2652 | if (error.isError()) |
| 2653 | { |
| 2654 | context->recordError(error); |
| 2655 | return; |
| 2656 | } |
| 2657 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2658 | break; |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2659 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2660 | case GL_QUERY_RESULT_AVAILABLE_EXT: |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2661 | { |
| 2662 | gl::Error error = queryObject->isResultAvailable(params); |
| 2663 | if (error.isError()) |
| 2664 | { |
| 2665 | context->recordError(error); |
| 2666 | return; |
| 2667 | } |
| 2668 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2669 | break; |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2670 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2671 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2672 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2673 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2674 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2675 | } |
| 2676 | } |
| 2677 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2678 | void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2679 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2680 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2681 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2682 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2683 | if (context) |
| 2684 | { |
| 2685 | if (target != GL_RENDERBUFFER) |
daniel@transgaming.com | 4901fca | 2010-04-20 18:52:41 +0000 | [diff] [blame] | 2686 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2687 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2688 | return; |
daniel@transgaming.com | 4901fca | 2010-04-20 18:52:41 +0000 | [diff] [blame] | 2689 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2690 | |
| 2691 | if (context->getState().getRenderbufferId() == 0) |
| 2692 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2693 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2694 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2695 | } |
| 2696 | |
| 2697 | gl::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getState().getRenderbufferId()); |
| 2698 | |
| 2699 | switch (pname) |
| 2700 | { |
| 2701 | case GL_RENDERBUFFER_WIDTH: *params = renderbuffer->getWidth(); break; |
| 2702 | case GL_RENDERBUFFER_HEIGHT: *params = renderbuffer->getHeight(); break; |
| 2703 | case GL_RENDERBUFFER_INTERNAL_FORMAT: *params = renderbuffer->getInternalFormat(); break; |
| 2704 | case GL_RENDERBUFFER_RED_SIZE: *params = renderbuffer->getRedSize(); break; |
| 2705 | case GL_RENDERBUFFER_GREEN_SIZE: *params = renderbuffer->getGreenSize(); break; |
| 2706 | case GL_RENDERBUFFER_BLUE_SIZE: *params = renderbuffer->getBlueSize(); break; |
| 2707 | case GL_RENDERBUFFER_ALPHA_SIZE: *params = renderbuffer->getAlphaSize(); break; |
| 2708 | case GL_RENDERBUFFER_DEPTH_SIZE: *params = renderbuffer->getDepthSize(); break; |
| 2709 | case GL_RENDERBUFFER_STENCIL_SIZE: *params = renderbuffer->getStencilSize(); break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2710 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2711 | case GL_RENDERBUFFER_SAMPLES_ANGLE: |
| 2712 | if (!context->getExtensions().framebufferMultisample) |
| 2713 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2714 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2715 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2716 | } |
| 2717 | *params = renderbuffer->getSamples(); |
| 2718 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2719 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2720 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2721 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2722 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2723 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2724 | } |
| 2725 | } |
| 2726 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2727 | void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2728 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2729 | EVENT("(GLuint shader = %d, GLenum pname = %d, GLint* params = 0x%0.8p)", shader, pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2730 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2731 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2732 | if (context) |
| 2733 | { |
| 2734 | gl::Shader *shaderObject = context->getShader(shader); |
| 2735 | |
| 2736 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2737 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2738 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2739 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2740 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2741 | |
| 2742 | switch (pname) |
| 2743 | { |
| 2744 | case GL_SHADER_TYPE: |
| 2745 | *params = shaderObject->getType(); |
| 2746 | return; |
| 2747 | case GL_DELETE_STATUS: |
| 2748 | *params = shaderObject->isFlaggedForDeletion(); |
| 2749 | return; |
| 2750 | case GL_COMPILE_STATUS: |
| 2751 | *params = shaderObject->isCompiled() ? GL_TRUE : GL_FALSE; |
| 2752 | return; |
| 2753 | case GL_INFO_LOG_LENGTH: |
| 2754 | *params = shaderObject->getInfoLogLength(); |
| 2755 | return; |
| 2756 | case GL_SHADER_SOURCE_LENGTH: |
| 2757 | *params = shaderObject->getSourceLength(); |
| 2758 | return; |
| 2759 | case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: |
| 2760 | *params = shaderObject->getTranslatedSourceLength(); |
| 2761 | return; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2762 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2763 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2764 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2765 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2766 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2767 | } |
| 2768 | } |
| 2769 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2770 | void GL_APIENTRY glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2771 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2772 | EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* infolog = 0x%0.8p)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 2773 | shader, bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2774 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2775 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2776 | if (context) |
| 2777 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2778 | if (bufsize < 0) |
| 2779 | { |
| 2780 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2781 | return; |
| 2782 | } |
| 2783 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2784 | gl::Shader *shaderObject = context->getShader(shader); |
| 2785 | |
| 2786 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2787 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2788 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2789 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2790 | } |
| 2791 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2792 | shaderObject->getInfoLog(bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2793 | } |
| 2794 | } |
| 2795 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2796 | void GL_APIENTRY glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2797 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2798 | EVENT("(GLenum shadertype = 0x%X, GLenum precisiontype = 0x%X, GLint* range = 0x%0.8p, GLint* precision = 0x%0.8p)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 2799 | shadertype, precisiontype, range, precision); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2800 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2801 | gl::Context *context = gl::getNonLostContext(); |
| 2802 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2803 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2804 | switch (shadertype) |
| 2805 | { |
| 2806 | case GL_VERTEX_SHADER: |
| 2807 | case GL_FRAGMENT_SHADER: |
| 2808 | break; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2809 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2810 | default: |
| 2811 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2812 | return; |
| 2813 | } |
| 2814 | |
| 2815 | switch (precisiontype) |
| 2816 | { |
| 2817 | case GL_LOW_FLOAT: |
| 2818 | case GL_MEDIUM_FLOAT: |
| 2819 | case GL_HIGH_FLOAT: |
| 2820 | // Assume IEEE 754 precision |
| 2821 | range[0] = 127; |
| 2822 | range[1] = 127; |
| 2823 | *precision = 23; |
| 2824 | break; |
| 2825 | |
| 2826 | case GL_LOW_INT: |
| 2827 | case GL_MEDIUM_INT: |
| 2828 | case GL_HIGH_INT: |
| 2829 | // Some (most) hardware only supports single-precision floating-point numbers, |
| 2830 | // which can accurately represent integers up to +/-16777216 |
| 2831 | range[0] = 24; |
| 2832 | range[1] = 24; |
| 2833 | *precision = 0; |
| 2834 | break; |
| 2835 | |
| 2836 | default: |
| 2837 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2838 | return; |
| 2839 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2840 | } |
| 2841 | } |
| 2842 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2843 | void GL_APIENTRY glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2844 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2845 | EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 2846 | shader, bufsize, length, source); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2847 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2848 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2849 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2850 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2851 | if (bufsize < 0) |
| 2852 | { |
| 2853 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2854 | return; |
| 2855 | } |
| 2856 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2857 | gl::Shader *shaderObject = context->getShader(shader); |
| 2858 | |
| 2859 | if (!shaderObject) |
| 2860 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2861 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2862 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2863 | } |
| 2864 | |
| 2865 | shaderObject->getSource(bufsize, length, source); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2866 | } |
| 2867 | } |
| 2868 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2869 | void GL_APIENTRY glGetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2870 | { |
| 2871 | EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)", |
| 2872 | shader, bufsize, length, source); |
| 2873 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2874 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2875 | if (context) |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2876 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2877 | if (bufsize < 0) |
| 2878 | { |
| 2879 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2880 | return; |
| 2881 | } |
| 2882 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2883 | gl::Shader *shaderObject = context->getShader(shader); |
| 2884 | |
| 2885 | if (!shaderObject) |
| 2886 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2887 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2888 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2889 | } |
| 2890 | |
Tibor den Ouden | 97049c6 | 2014-10-06 21:39:16 +0200 | [diff] [blame] | 2891 | // Only returns extra info if ANGLE_GENERATE_SHADER_DEBUG_INFO is defined |
| 2892 | shaderObject->getTranslatedSourceWithDebugInfo(bufsize, length, source); |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2893 | } |
| 2894 | } |
| 2895 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2896 | const GLubyte* GL_APIENTRY glGetString(GLenum name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2897 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2898 | EVENT("(GLenum name = 0x%X)", name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2899 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2900 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 3e4c600 | 2010-05-05 18:50:13 +0000 | [diff] [blame] | 2901 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2902 | switch (name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2903 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2904 | case GL_VENDOR: |
| 2905 | return (GLubyte*)"Google Inc."; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2906 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2907 | case GL_RENDERER: |
| 2908 | return (GLubyte*)((context != NULL) ? context->getRendererString().c_str() : "ANGLE"); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2909 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2910 | case GL_VERSION: |
| 2911 | if (context->getClientVersion() == 2) |
| 2912 | { |
| 2913 | return (GLubyte*)"OpenGL ES 2.0 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2914 | } |
| 2915 | else |
| 2916 | { |
| 2917 | return (GLubyte*)"OpenGL ES 3.0 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2918 | } |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2919 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2920 | case GL_SHADING_LANGUAGE_VERSION: |
| 2921 | if (context->getClientVersion() == 2) |
| 2922 | { |
| 2923 | return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2924 | } |
| 2925 | else |
| 2926 | { |
| 2927 | return (GLubyte*)"OpenGL ES GLSL ES 3.00 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2928 | } |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2929 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2930 | case GL_EXTENSIONS: |
| 2931 | return (GLubyte*)((context != NULL) ? context->getExtensionString().c_str() : ""); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2932 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2933 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2934 | if (context) |
| 2935 | { |
| 2936 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2937 | } |
| 2938 | return NULL; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2939 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2940 | } |
| 2941 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2942 | void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2943 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2944 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", target, pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2945 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2946 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2947 | if (context) |
| 2948 | { |
| 2949 | gl::Texture *texture = context->getTargetTexture(target); |
| 2950 | |
| 2951 | if (!texture) |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 2952 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2953 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2954 | return; |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 2955 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2956 | |
| 2957 | switch (pname) |
| 2958 | { |
| 2959 | case GL_TEXTURE_MAG_FILTER: |
| 2960 | *params = (GLfloat)texture->getSamplerState().magFilter; |
| 2961 | break; |
| 2962 | case GL_TEXTURE_MIN_FILTER: |
| 2963 | *params = (GLfloat)texture->getSamplerState().minFilter; |
| 2964 | break; |
| 2965 | case GL_TEXTURE_WRAP_S: |
| 2966 | *params = (GLfloat)texture->getSamplerState().wrapS; |
| 2967 | break; |
| 2968 | case GL_TEXTURE_WRAP_T: |
| 2969 | *params = (GLfloat)texture->getSamplerState().wrapT; |
| 2970 | break; |
| 2971 | case GL_TEXTURE_WRAP_R: |
| 2972 | if (context->getClientVersion() < 3) |
| 2973 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2974 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2975 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2976 | } |
| 2977 | *params = (GLfloat)texture->getSamplerState().wrapR; |
| 2978 | break; |
| 2979 | case GL_TEXTURE_IMMUTABLE_FORMAT: |
| 2980 | // Exposed to ES2.0 through EXT_texture_storage, no client version validation. |
| 2981 | *params = (GLfloat)(texture->isImmutable() ? GL_TRUE : GL_FALSE); |
| 2982 | break; |
| 2983 | case GL_TEXTURE_IMMUTABLE_LEVELS: |
| 2984 | if (context->getClientVersion() < 3) |
| 2985 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2986 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2987 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2988 | } |
| 2989 | *params = (GLfloat)texture->immutableLevelCount(); |
| 2990 | break; |
| 2991 | case GL_TEXTURE_USAGE_ANGLE: |
| 2992 | *params = (GLfloat)texture->getUsage(); |
| 2993 | break; |
| 2994 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
| 2995 | if (!context->getExtensions().textureFilterAnisotropic) |
| 2996 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2997 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2998 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2999 | } |
| 3000 | *params = (GLfloat)texture->getSamplerState().maxAnisotropy; |
| 3001 | break; |
| 3002 | case GL_TEXTURE_SWIZZLE_R: |
| 3003 | if (context->getClientVersion() < 3) |
| 3004 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3005 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3006 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3007 | } |
| 3008 | *params = (GLfloat)texture->getSamplerState().swizzleRed; |
| 3009 | break; |
| 3010 | case GL_TEXTURE_SWIZZLE_G: |
| 3011 | if (context->getClientVersion() < 3) |
| 3012 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3013 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3014 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3015 | } |
| 3016 | *params = (GLfloat)texture->getSamplerState().swizzleGreen; |
| 3017 | break; |
| 3018 | case GL_TEXTURE_SWIZZLE_B: |
| 3019 | if (context->getClientVersion() < 3) |
| 3020 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3021 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3022 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3023 | } |
| 3024 | *params = (GLfloat)texture->getSamplerState().swizzleBlue; |
| 3025 | break; |
| 3026 | case GL_TEXTURE_SWIZZLE_A: |
| 3027 | if (context->getClientVersion() < 3) |
| 3028 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3029 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3030 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3031 | } |
| 3032 | *params = (GLfloat)texture->getSamplerState().swizzleAlpha; |
| 3033 | break; |
| 3034 | case GL_TEXTURE_BASE_LEVEL: |
| 3035 | if (context->getClientVersion() < 3) |
| 3036 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3037 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3038 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3039 | } |
| 3040 | *params = (GLfloat)texture->getSamplerState().baseLevel; |
| 3041 | break; |
| 3042 | case GL_TEXTURE_MAX_LEVEL: |
| 3043 | if (context->getClientVersion() < 3) |
| 3044 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3045 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3046 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3047 | } |
| 3048 | *params = (GLfloat)texture->getSamplerState().maxLevel; |
| 3049 | break; |
| 3050 | case GL_TEXTURE_MIN_LOD: |
| 3051 | if (context->getClientVersion() < 3) |
| 3052 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3053 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3054 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3055 | } |
| 3056 | *params = texture->getSamplerState().minLod; |
| 3057 | break; |
| 3058 | case GL_TEXTURE_MAX_LOD: |
| 3059 | if (context->getClientVersion() < 3) |
| 3060 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3061 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3062 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3063 | } |
| 3064 | *params = texture->getSamplerState().maxLod; |
| 3065 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3066 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3067 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3068 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3069 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3070 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3071 | } |
| 3072 | } |
| 3073 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3074 | void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3075 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3076 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3077 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3078 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3079 | if (context) |
| 3080 | { |
| 3081 | gl::Texture *texture = context->getTargetTexture(target); |
| 3082 | |
| 3083 | if (!texture) |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 3084 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3085 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3086 | return; |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 3087 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3088 | |
| 3089 | switch (pname) |
| 3090 | { |
| 3091 | case GL_TEXTURE_MAG_FILTER: |
| 3092 | *params = texture->getSamplerState().magFilter; |
| 3093 | break; |
| 3094 | case GL_TEXTURE_MIN_FILTER: |
| 3095 | *params = texture->getSamplerState().minFilter; |
| 3096 | break; |
| 3097 | case GL_TEXTURE_WRAP_S: |
| 3098 | *params = texture->getSamplerState().wrapS; |
| 3099 | break; |
| 3100 | case GL_TEXTURE_WRAP_T: |
| 3101 | *params = texture->getSamplerState().wrapT; |
| 3102 | break; |
| 3103 | case GL_TEXTURE_WRAP_R: |
| 3104 | if (context->getClientVersion() < 3) |
| 3105 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3106 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3107 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3108 | } |
| 3109 | *params = texture->getSamplerState().wrapR; |
| 3110 | break; |
| 3111 | case GL_TEXTURE_IMMUTABLE_FORMAT: |
| 3112 | // Exposed to ES2.0 through EXT_texture_storage, no client version validation. |
| 3113 | *params = texture->isImmutable() ? GL_TRUE : GL_FALSE; |
| 3114 | break; |
| 3115 | case GL_TEXTURE_IMMUTABLE_LEVELS: |
| 3116 | if (context->getClientVersion() < 3) |
| 3117 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3118 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3119 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3120 | } |
Jamie Madill | 6948e30 | 2014-10-20 17:04:33 -0400 | [diff] [blame] | 3121 | *params = static_cast<GLint>(texture->immutableLevelCount()); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3122 | break; |
| 3123 | case GL_TEXTURE_USAGE_ANGLE: |
| 3124 | *params = texture->getUsage(); |
| 3125 | break; |
| 3126 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
| 3127 | if (!context->getExtensions().textureFilterAnisotropic) |
| 3128 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3129 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3130 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3131 | } |
| 3132 | *params = (GLint)texture->getSamplerState().maxAnisotropy; |
| 3133 | break; |
| 3134 | case GL_TEXTURE_SWIZZLE_R: |
| 3135 | if (context->getClientVersion() < 3) |
| 3136 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3137 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3138 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3139 | } |
| 3140 | *params = texture->getSamplerState().swizzleRed; |
| 3141 | break; |
| 3142 | case GL_TEXTURE_SWIZZLE_G: |
| 3143 | if (context->getClientVersion() < 3) |
| 3144 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3145 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3146 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3147 | } |
| 3148 | *params = texture->getSamplerState().swizzleGreen; |
| 3149 | break; |
| 3150 | case GL_TEXTURE_SWIZZLE_B: |
| 3151 | if (context->getClientVersion() < 3) |
| 3152 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3153 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3154 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3155 | } |
| 3156 | *params = texture->getSamplerState().swizzleBlue; |
| 3157 | break; |
| 3158 | case GL_TEXTURE_SWIZZLE_A: |
| 3159 | if (context->getClientVersion() < 3) |
| 3160 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3161 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3162 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3163 | } |
| 3164 | *params = texture->getSamplerState().swizzleAlpha; |
| 3165 | break; |
| 3166 | case GL_TEXTURE_BASE_LEVEL: |
| 3167 | if (context->getClientVersion() < 3) |
| 3168 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3169 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3170 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3171 | } |
| 3172 | *params = texture->getSamplerState().baseLevel; |
| 3173 | break; |
| 3174 | case GL_TEXTURE_MAX_LEVEL: |
| 3175 | if (context->getClientVersion() < 3) |
| 3176 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3177 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3178 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3179 | } |
| 3180 | *params = texture->getSamplerState().maxLevel; |
| 3181 | break; |
| 3182 | case GL_TEXTURE_MIN_LOD: |
| 3183 | if (context->getClientVersion() < 3) |
| 3184 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3185 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3186 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3187 | } |
| 3188 | *params = (GLint)texture->getSamplerState().minLod; |
| 3189 | break; |
| 3190 | case GL_TEXTURE_MAX_LOD: |
| 3191 | if (context->getClientVersion() < 3) |
| 3192 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3193 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3194 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3195 | } |
| 3196 | *params = (GLint)texture->getSamplerState().maxLod; |
| 3197 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3198 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3199 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3200 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3201 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3202 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3203 | } |
| 3204 | } |
| 3205 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3206 | void GL_APIENTRY glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat* params) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3207 | { |
| 3208 | EVENT("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLfloat* params = 0x%0.8p)", |
| 3209 | program, location, bufSize, params); |
| 3210 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3211 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3212 | if (context) |
| 3213 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3214 | if (!ValidateGetnUniformfvEXT(context, program, location, bufSize, params)) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3215 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3216 | return; |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3217 | } |
| 3218 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3219 | gl::Program *programObject = context->getProgram(program); |
| 3220 | ASSERT(programObject); |
| 3221 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3222 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3223 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3224 | programBinary->getUniformfv(location, params); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3225 | } |
| 3226 | } |
| 3227 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3228 | void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3229 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3230 | EVENT("(GLuint program = %d, GLint location = %d, GLfloat* params = 0x%0.8p)", program, location, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3231 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3232 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3233 | if (context) |
| 3234 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3235 | if (!ValidateGetUniformfv(context, program, location, params)) |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3236 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3237 | return; |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3238 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3239 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3240 | gl::Program *programObject = context->getProgram(program); |
| 3241 | ASSERT(programObject); |
| 3242 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3243 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3244 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3245 | programBinary->getUniformfv(location, params); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3246 | } |
| 3247 | } |
| 3248 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3249 | void GL_APIENTRY glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint* params) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3250 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3251 | EVENT("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLint* params = 0x%0.8p)", |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3252 | program, location, bufSize, params); |
| 3253 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3254 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3255 | if (context) |
| 3256 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3257 | if (!ValidateGetnUniformivEXT(context, program, location, bufSize, params)) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3258 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3259 | return; |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3260 | } |
| 3261 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3262 | gl::Program *programObject = context->getProgram(program); |
| 3263 | ASSERT(programObject); |
| 3264 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3265 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3266 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3267 | programBinary->getUniformiv(location, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3268 | } |
| 3269 | } |
| 3270 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3271 | void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3272 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3273 | EVENT("(GLuint program = %d, GLint location = %d, GLint* params = 0x%0.8p)", program, location, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3274 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3275 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3276 | if (context) |
| 3277 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3278 | if (!ValidateGetUniformiv(context, program, location, params)) |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3279 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3280 | return; |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3281 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3282 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3283 | gl::Program *programObject = context->getProgram(program); |
| 3284 | ASSERT(programObject); |
| 3285 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3286 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3287 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3288 | programBinary->getUniformiv(location, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3289 | } |
| 3290 | } |
| 3291 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3292 | GLint GL_APIENTRY glGetUniformLocation(GLuint program, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3293 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3294 | EVENT("(GLuint program = %d, const GLchar* name = 0x%0.8p)", program, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3295 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3296 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3297 | if (context) |
| 3298 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3299 | if (strstr(name, "gl_") == name) |
| 3300 | { |
| 3301 | return -1; |
| 3302 | } |
| 3303 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3304 | gl::Program *programObject = context->getProgram(program); |
| 3305 | |
| 3306 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3307 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3308 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3309 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3310 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3311 | return -1; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3312 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3313 | else |
| 3314 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3315 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3316 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3317 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3318 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3319 | |
| 3320 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 3321 | if (!programObject->isLinked() || !programBinary) |
| 3322 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3323 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3324 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3325 | } |
| 3326 | |
| 3327 | return programBinary->getUniformLocation(name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3328 | } |
| 3329 | |
| 3330 | return -1; |
| 3331 | } |
| 3332 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3333 | void GL_APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3334 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3335 | EVENT("(GLuint index = %d, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", index, pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3336 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3337 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3338 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3339 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3340 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3341 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3342 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3343 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3344 | } |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3345 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3346 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3347 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3348 | { |
| 3349 | return; |
| 3350 | } |
daniel@transgaming.com | 428d158 | 2010-05-04 03:35:25 +0000 | [diff] [blame] | 3351 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3352 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 3353 | { |
| 3354 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 3355 | for (int i = 0; i < 4; ++i) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3356 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3357 | params[i] = currentValueData.FloatValues[i]; |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3358 | } |
| 3359 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3360 | else |
| 3361 | { |
| 3362 | *params = gl::QuerySingleVertexAttributeParameter<GLfloat>(attribState, pname); |
| 3363 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3364 | } |
| 3365 | } |
| 3366 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3367 | void GL_APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3368 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3369 | EVENT("(GLuint index = %d, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", index, pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3370 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3371 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3372 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3373 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3374 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3375 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3376 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3377 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3378 | } |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3379 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3380 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
daniel@transgaming.com | 428d158 | 2010-05-04 03:35:25 +0000 | [diff] [blame] | 3381 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3382 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3383 | { |
| 3384 | return; |
| 3385 | } |
Jamie Madill | aff7150 | 2013-07-02 11:57:05 -0400 | [diff] [blame] | 3386 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3387 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 3388 | { |
| 3389 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 3390 | for (int i = 0; i < 4; ++i) |
Jamie Madill | aff7150 | 2013-07-02 11:57:05 -0400 | [diff] [blame] | 3391 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3392 | float currentValue = currentValueData.FloatValues[i]; |
| 3393 | params[i] = gl::iround<GLint>(currentValue); |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3394 | } |
| 3395 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3396 | else |
| 3397 | { |
| 3398 | *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname); |
| 3399 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3400 | } |
| 3401 | } |
| 3402 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3403 | void GL_APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3404 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3405 | EVENT("(GLuint index = %d, GLenum pname = 0x%X, GLvoid** pointer = 0x%0.8p)", index, pname, pointer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3406 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3407 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3408 | if (context) |
| 3409 | { |
| 3410 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3411 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3412 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3413 | return; |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3414 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3415 | |
| 3416 | if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER) |
| 3417 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3418 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3419 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3420 | } |
| 3421 | |
| 3422 | *pointer = const_cast<GLvoid*>(context->getState().getVertexAttribPointer(index)); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3423 | } |
| 3424 | } |
| 3425 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3426 | void GL_APIENTRY glHint(GLenum target, GLenum mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3427 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3428 | EVENT("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3429 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3430 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3431 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3432 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3433 | switch (mode) |
| 3434 | { |
| 3435 | case GL_FASTEST: |
| 3436 | case GL_NICEST: |
| 3437 | case GL_DONT_CARE: |
| 3438 | break; |
| 3439 | |
| 3440 | default: |
| 3441 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3442 | return; |
| 3443 | } |
| 3444 | |
| 3445 | switch (target) |
| 3446 | { |
| 3447 | case GL_GENERATE_MIPMAP_HINT: |
| 3448 | context->getState().setGenerateMipmapHint(mode); |
| 3449 | break; |
| 3450 | |
| 3451 | case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: |
| 3452 | context->getState().setFragmentShaderDerivativeHint(mode); |
| 3453 | break; |
| 3454 | |
| 3455 | default: |
| 3456 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3457 | return; |
| 3458 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3459 | } |
| 3460 | } |
| 3461 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3462 | GLboolean GL_APIENTRY glIsBuffer(GLuint buffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3463 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3464 | EVENT("(GLuint buffer = %d)", buffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3465 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3466 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3467 | if (context && buffer) |
| 3468 | { |
| 3469 | gl::Buffer *bufferObject = context->getBuffer(buffer); |
| 3470 | |
| 3471 | if (bufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3472 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3473 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3474 | } |
| 3475 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3476 | |
| 3477 | return GL_FALSE; |
| 3478 | } |
| 3479 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3480 | GLboolean GL_APIENTRY glIsEnabled(GLenum cap) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3481 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3482 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3483 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3484 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3485 | if (context) |
| 3486 | { |
| 3487 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3488 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3489 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3490 | return GL_FALSE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3491 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3492 | |
| 3493 | return context->getState().getEnableFeature(cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3494 | } |
| 3495 | |
| 3496 | return false; |
| 3497 | } |
| 3498 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3499 | GLboolean GL_APIENTRY glIsFenceNV(GLuint fence) |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3500 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3501 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3502 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3503 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3504 | if (context) |
| 3505 | { |
| 3506 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 3507 | |
| 3508 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3509 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3510 | return GL_FALSE; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3511 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3512 | |
| 3513 | return fenceObject->isFence(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3514 | } |
| 3515 | |
| 3516 | return GL_FALSE; |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3517 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3518 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3519 | GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3520 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3521 | EVENT("(GLuint framebuffer = %d)", framebuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3522 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3523 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3524 | if (context && framebuffer) |
| 3525 | { |
| 3526 | gl::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer); |
| 3527 | |
| 3528 | if (framebufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3529 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3530 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3531 | } |
| 3532 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3533 | |
| 3534 | return GL_FALSE; |
| 3535 | } |
| 3536 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3537 | GLboolean GL_APIENTRY glIsProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3538 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3539 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3540 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3541 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3542 | if (context && program) |
| 3543 | { |
| 3544 | gl::Program *programObject = context->getProgram(program); |
| 3545 | |
| 3546 | if (programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3547 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3548 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3549 | } |
| 3550 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3551 | |
| 3552 | return GL_FALSE; |
| 3553 | } |
| 3554 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3555 | GLboolean GL_APIENTRY glIsQueryEXT(GLuint id) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 3556 | { |
| 3557 | EVENT("(GLuint id = %d)", id); |
| 3558 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3559 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3560 | if (context) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 3561 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3562 | return (context->getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 3563 | } |
| 3564 | |
| 3565 | return GL_FALSE; |
| 3566 | } |
| 3567 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3568 | GLboolean GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3569 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3570 | EVENT("(GLuint renderbuffer = %d)", renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3571 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3572 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3573 | if (context && renderbuffer) |
| 3574 | { |
| 3575 | gl::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer); |
| 3576 | |
| 3577 | if (renderbufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3578 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3579 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3580 | } |
| 3581 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3582 | |
| 3583 | return GL_FALSE; |
| 3584 | } |
| 3585 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3586 | GLboolean GL_APIENTRY glIsShader(GLuint shader) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3587 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3588 | EVENT("(GLuint shader = %d)", shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3589 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3590 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3591 | if (context && shader) |
| 3592 | { |
| 3593 | gl::Shader *shaderObject = context->getShader(shader); |
| 3594 | |
| 3595 | if (shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3596 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3597 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3598 | } |
| 3599 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3600 | |
| 3601 | return GL_FALSE; |
| 3602 | } |
| 3603 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3604 | GLboolean GL_APIENTRY glIsTexture(GLuint texture) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3605 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3606 | EVENT("(GLuint texture = %d)", texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3607 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3608 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3609 | if (context && texture) |
| 3610 | { |
| 3611 | gl::Texture *textureObject = context->getTexture(texture); |
| 3612 | |
| 3613 | if (textureObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3614 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3615 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3616 | } |
| 3617 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3618 | |
| 3619 | return GL_FALSE; |
| 3620 | } |
| 3621 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3622 | void GL_APIENTRY glLineWidth(GLfloat width) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3623 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3624 | EVENT("(GLfloat width = %f)", width); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3625 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3626 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3627 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3628 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3629 | if (width <= 0.0f) |
| 3630 | { |
| 3631 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3632 | return; |
| 3633 | } |
| 3634 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3635 | context->getState().setLineWidth(width); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3636 | } |
| 3637 | } |
| 3638 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3639 | void GL_APIENTRY glLinkProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3640 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3641 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3642 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3643 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3644 | if (context) |
| 3645 | { |
| 3646 | gl::Program *programObject = context->getProgram(program); |
| 3647 | |
| 3648 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3649 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3650 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3651 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3652 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3653 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3654 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3655 | else |
| 3656 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3657 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3658 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3659 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3660 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3661 | |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 3662 | gl::Error error = context->linkProgram(program); |
| 3663 | if (error.isError()) |
| 3664 | { |
| 3665 | context->recordError(error); |
| 3666 | return; |
| 3667 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3668 | } |
| 3669 | } |
| 3670 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3671 | void GL_APIENTRY glPixelStorei(GLenum pname, GLint param) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3672 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3673 | EVENT("(GLenum pname = 0x%X, GLint param = %d)", pname, param); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3674 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3675 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3676 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3677 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3678 | switch (pname) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3679 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3680 | case GL_UNPACK_ALIGNMENT: |
| 3681 | if (param != 1 && param != 2 && param != 4 && param != 8) |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3682 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3683 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3684 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3685 | } |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3686 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3687 | context->getState().setUnpackAlignment(param); |
| 3688 | break; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3689 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3690 | case GL_PACK_ALIGNMENT: |
| 3691 | if (param != 1 && param != 2 && param != 4 && param != 8) |
| 3692 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3693 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3694 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3695 | } |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3696 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3697 | context->getState().setPackAlignment(param); |
| 3698 | break; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3699 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3700 | case GL_PACK_REVERSE_ROW_ORDER_ANGLE: |
| 3701 | context->getState().setPackReverseRowOrder(param != 0); |
| 3702 | break; |
bsalomon@google.com | 56d46ab | 2011-11-23 14:53:10 +0000 | [diff] [blame] | 3703 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3704 | case GL_UNPACK_IMAGE_HEIGHT: |
| 3705 | case GL_UNPACK_SKIP_IMAGES: |
| 3706 | case GL_UNPACK_ROW_LENGTH: |
| 3707 | case GL_UNPACK_SKIP_ROWS: |
| 3708 | case GL_UNPACK_SKIP_PIXELS: |
| 3709 | case GL_PACK_ROW_LENGTH: |
| 3710 | case GL_PACK_SKIP_ROWS: |
| 3711 | case GL_PACK_SKIP_PIXELS: |
| 3712 | if (context->getClientVersion() < 3) |
| 3713 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3714 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3715 | return; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3716 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3717 | UNIMPLEMENTED(); |
| 3718 | break; |
| 3719 | |
| 3720 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3721 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3722 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3723 | } |
| 3724 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3725 | } |
| 3726 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3727 | void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3728 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3729 | EVENT("(GLfloat factor = %f, GLfloat units = %f)", factor, units); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3730 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3731 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3732 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3733 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3734 | context->getState().setPolygonOffsetParams(factor, units); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3735 | } |
| 3736 | } |
| 3737 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3738 | void GL_APIENTRY glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3739 | GLenum format, GLenum type, GLsizei bufSize, |
| 3740 | GLvoid *data) |
| 3741 | { |
| 3742 | EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, " |
| 3743 | "GLenum format = 0x%X, GLenum type = 0x%X, GLsizei bufSize = 0x%d, GLvoid *data = 0x%0.8p)", |
| 3744 | x, y, width, height, format, type, bufSize, data); |
| 3745 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3746 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3747 | if (context) |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3748 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3749 | if (width < 0 || height < 0 || bufSize < 0) |
| 3750 | { |
| 3751 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3752 | return; |
| 3753 | } |
| 3754 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3755 | if (!gl::ValidateReadPixelsParameters(context, x, y, width, height, |
| 3756 | format, type, &bufSize, data)) |
| 3757 | { |
| 3758 | return; |
| 3759 | } |
| 3760 | |
Geoff Lang | 63d2fc7 | 2014-07-25 14:51:41 -0400 | [diff] [blame] | 3761 | gl::Error error = context->readPixels(x, y, width, height, format, type, &bufSize, data); |
| 3762 | if (error.isError()) |
| 3763 | { |
| 3764 | context->recordError(error); |
| 3765 | return; |
| 3766 | } |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3767 | } |
| 3768 | } |
| 3769 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3770 | void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3771 | GLenum format, GLenum type, GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3772 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3773 | EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, " |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 3774 | "GLenum format = 0x%X, GLenum type = 0x%X, GLvoid* pixels = 0x%0.8p)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 3775 | x, y, width, height, format, type, pixels); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3776 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3777 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3778 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3779 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3780 | if (width < 0 || height < 0) |
| 3781 | { |
| 3782 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3783 | return; |
| 3784 | } |
| 3785 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3786 | if (!gl::ValidateReadPixelsParameters(context, x, y, width, height, |
| 3787 | format, type, NULL, pixels)) |
| 3788 | { |
| 3789 | return; |
| 3790 | } |
| 3791 | |
Geoff Lang | 63d2fc7 | 2014-07-25 14:51:41 -0400 | [diff] [blame] | 3792 | gl::Error error = context->readPixels(x, y, width, height, format, type, NULL, pixels); |
| 3793 | if (error.isError()) |
| 3794 | { |
| 3795 | context->recordError(error); |
| 3796 | return; |
| 3797 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3798 | } |
| 3799 | } |
| 3800 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3801 | void GL_APIENTRY glReleaseShaderCompiler(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3802 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3803 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3804 | |
Brandon Jones | f05cdee | 2014-08-27 15:24:07 -0700 | [diff] [blame] | 3805 | gl::Context *context = gl::getNonLostContext(); |
| 3806 | |
| 3807 | if (context) |
| 3808 | { |
| 3809 | context->releaseShaderCompiler(); |
| 3810 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3811 | } |
| 3812 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3813 | void GL_APIENTRY glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3814 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3815 | EVENT("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 3816 | target, samples, internalformat, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3817 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3818 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3819 | if (context) |
| 3820 | { |
Corentin Wallez | e090264 | 2014-11-04 12:32:15 -0800 | [diff] [blame] | 3821 | if (!ValidateRenderbufferStorageParametersANGLE(context, target, samples, internalformat, |
| 3822 | width, height)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3823 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3824 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3825 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3826 | |
Shannon Woods | e2632d2 | 2014-10-17 13:08:51 -0400 | [diff] [blame] | 3827 | gl::Renderbuffer *renderbuffer = context->getState().getCurrentRenderbuffer(); |
Geoff Lang | bafefdf | 2014-10-10 14:26:35 -0400 | [diff] [blame] | 3828 | gl::Error error = renderbuffer->setStorage(width, height, internalformat, samples); |
| 3829 | if (error.isError()) |
| 3830 | { |
| 3831 | context->recordError(error); |
| 3832 | return; |
| 3833 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3834 | } |
| 3835 | } |
| 3836 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3837 | void GL_APIENTRY glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 3838 | { |
| 3839 | glRenderbufferStorageMultisampleANGLE(target, 0, internalformat, width, height); |
| 3840 | } |
| 3841 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3842 | void GL_APIENTRY glSampleCoverage(GLclampf value, GLboolean invert) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3843 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 3844 | EVENT("(GLclampf value = %f, GLboolean invert = %u)", value, invert); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3845 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3846 | gl::Context* context = gl::getNonLostContext(); |
daniel@transgaming.com | fab5a1a | 2010-03-11 19:22:30 +0000 | [diff] [blame] | 3847 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3848 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3849 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3850 | context->getState().setSampleCoverageParams(gl::clamp01(value), invert == GL_TRUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3851 | } |
| 3852 | } |
| 3853 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3854 | void GL_APIENTRY glSetFenceNV(GLuint fence, GLenum condition) |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3855 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3856 | EVENT("(GLuint fence = %d, GLenum condition = 0x%X)", fence, condition); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3857 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3858 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3859 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3860 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3861 | if (condition != GL_ALL_COMPLETED_NV) |
| 3862 | { |
| 3863 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3864 | return; |
| 3865 | } |
| 3866 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3867 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 3868 | |
| 3869 | if (fenceObject == NULL) |
| 3870 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3871 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3872 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3873 | } |
| 3874 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 3875 | gl::Error error = fenceObject->setFence(condition); |
| 3876 | if (error.isError()) |
| 3877 | { |
| 3878 | context->recordError(error); |
| 3879 | return; |
| 3880 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3881 | } |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3882 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3883 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3884 | void GL_APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3885 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3886 | EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3887 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3888 | gl::Context* context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3889 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3890 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3891 | if (width < 0 || height < 0) |
| 3892 | { |
| 3893 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3894 | return; |
| 3895 | } |
| 3896 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3897 | context->getState().setScissorParams(x, y, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3898 | } |
| 3899 | } |
| 3900 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3901 | void GL_APIENTRY glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3902 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3903 | EVENT("(GLsizei n = %d, const GLuint* shaders = 0x%0.8p, GLenum binaryformat = 0x%X, " |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 3904 | "const GLvoid* binary = 0x%0.8p, GLsizei length = %d)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 3905 | n, shaders, binaryformat, binary, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3906 | |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 3907 | gl::Context* context = gl::getNonLostContext(); |
| 3908 | if (context) |
| 3909 | { |
| 3910 | const std::vector<GLenum> &shaderBinaryFormats = context->getCaps().shaderBinaryFormats; |
| 3911 | if (std::find(shaderBinaryFormats.begin(), shaderBinaryFormats.end(), binaryformat) == shaderBinaryFormats.end()) |
| 3912 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3913 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3914 | return; |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 3915 | } |
| 3916 | |
| 3917 | // No binary shader formats are supported. |
| 3918 | UNIMPLEMENTED(); |
| 3919 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3920 | } |
| 3921 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3922 | void GL_APIENTRY glShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3923 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3924 | EVENT("(GLuint shader = %d, GLsizei count = %d, const GLchar** string = 0x%0.8p, const GLint* length = 0x%0.8p)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 3925 | shader, count, string, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3926 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3927 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3928 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3929 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3930 | if (count < 0) |
| 3931 | { |
| 3932 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3933 | return; |
| 3934 | } |
| 3935 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3936 | gl::Shader *shaderObject = context->getShader(shader); |
| 3937 | |
| 3938 | if (!shaderObject) |
| 3939 | { |
| 3940 | if (context->getProgram(shader)) |
| 3941 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3942 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3943 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3944 | } |
| 3945 | else |
| 3946 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3947 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3948 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3949 | } |
| 3950 | } |
| 3951 | |
| 3952 | shaderObject->setSource(count, string, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3953 | } |
| 3954 | } |
| 3955 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3956 | void GL_APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3957 | { |
daniel@transgaming.com | fab5a1a | 2010-03-11 19:22:30 +0000 | [diff] [blame] | 3958 | glStencilFuncSeparate(GL_FRONT_AND_BACK, func, ref, mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3959 | } |
| 3960 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3961 | void GL_APIENTRY glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3962 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3963 | EVENT("(GLenum face = 0x%X, GLenum func = 0x%X, GLint ref = %d, GLuint mask = %d)", face, func, ref, mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3964 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3965 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3966 | if (context) |
| 3967 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3968 | switch (face) |
| 3969 | { |
| 3970 | case GL_FRONT: |
| 3971 | case GL_BACK: |
| 3972 | case GL_FRONT_AND_BACK: |
| 3973 | break; |
| 3974 | |
| 3975 | default: |
| 3976 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3977 | return; |
| 3978 | } |
| 3979 | |
| 3980 | switch (func) |
| 3981 | { |
| 3982 | case GL_NEVER: |
| 3983 | case GL_ALWAYS: |
| 3984 | case GL_LESS: |
| 3985 | case GL_LEQUAL: |
| 3986 | case GL_EQUAL: |
| 3987 | case GL_GEQUAL: |
| 3988 | case GL_GREATER: |
| 3989 | case GL_NOTEQUAL: |
| 3990 | break; |
| 3991 | |
| 3992 | default: |
| 3993 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3994 | return; |
| 3995 | } |
| 3996 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3997 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 3998 | { |
| 3999 | context->getState().setStencilParams(func, ref, mask); |
| 4000 | } |
| 4001 | |
| 4002 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 4003 | { |
| 4004 | context->getState().setStencilBackParams(func, ref, mask); |
| 4005 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4006 | } |
| 4007 | } |
| 4008 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4009 | void GL_APIENTRY glStencilMask(GLuint mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4010 | { |
| 4011 | glStencilMaskSeparate(GL_FRONT_AND_BACK, mask); |
| 4012 | } |
| 4013 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4014 | void GL_APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4015 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4016 | EVENT("(GLenum face = 0x%X, GLuint mask = %d)", face, mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4017 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4018 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4019 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4020 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4021 | switch (face) |
| 4022 | { |
| 4023 | case GL_FRONT: |
| 4024 | case GL_BACK: |
| 4025 | case GL_FRONT_AND_BACK: |
| 4026 | break; |
| 4027 | |
| 4028 | default: |
| 4029 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4030 | return; |
| 4031 | } |
| 4032 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4033 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 4034 | { |
| 4035 | context->getState().setStencilWritemask(mask); |
| 4036 | } |
| 4037 | |
| 4038 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 4039 | { |
| 4040 | context->getState().setStencilBackWritemask(mask); |
| 4041 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4042 | } |
| 4043 | } |
| 4044 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4045 | void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4046 | { |
| 4047 | glStencilOpSeparate(GL_FRONT_AND_BACK, fail, zfail, zpass); |
| 4048 | } |
| 4049 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4050 | void GL_APIENTRY glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4051 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4052 | EVENT("(GLenum face = 0x%X, GLenum fail = 0x%X, GLenum zfail = 0x%X, GLenum zpas = 0x%Xs)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 4053 | face, fail, zfail, zpass); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4054 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4055 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4056 | if (context) |
| 4057 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4058 | switch (face) |
| 4059 | { |
| 4060 | case GL_FRONT: |
| 4061 | case GL_BACK: |
| 4062 | case GL_FRONT_AND_BACK: |
| 4063 | break; |
| 4064 | |
| 4065 | default: |
| 4066 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4067 | return; |
| 4068 | } |
| 4069 | |
| 4070 | switch (fail) |
| 4071 | { |
| 4072 | case GL_ZERO: |
| 4073 | case GL_KEEP: |
| 4074 | case GL_REPLACE: |
| 4075 | case GL_INCR: |
| 4076 | case GL_DECR: |
| 4077 | case GL_INVERT: |
| 4078 | case GL_INCR_WRAP: |
| 4079 | case GL_DECR_WRAP: |
| 4080 | break; |
| 4081 | |
| 4082 | default: |
| 4083 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4084 | return; |
| 4085 | } |
| 4086 | |
| 4087 | switch (zfail) |
| 4088 | { |
| 4089 | case GL_ZERO: |
| 4090 | case GL_KEEP: |
| 4091 | case GL_REPLACE: |
| 4092 | case GL_INCR: |
| 4093 | case GL_DECR: |
| 4094 | case GL_INVERT: |
| 4095 | case GL_INCR_WRAP: |
| 4096 | case GL_DECR_WRAP: |
| 4097 | break; |
| 4098 | |
| 4099 | default: |
| 4100 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4101 | return; |
| 4102 | } |
| 4103 | |
| 4104 | switch (zpass) |
| 4105 | { |
| 4106 | case GL_ZERO: |
| 4107 | case GL_KEEP: |
| 4108 | case GL_REPLACE: |
| 4109 | case GL_INCR: |
| 4110 | case GL_DECR: |
| 4111 | case GL_INVERT: |
| 4112 | case GL_INCR_WRAP: |
| 4113 | case GL_DECR_WRAP: |
| 4114 | break; |
| 4115 | |
| 4116 | default: |
| 4117 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4118 | return; |
| 4119 | } |
| 4120 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4121 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 4122 | { |
| 4123 | context->getState().setStencilOperations(fail, zfail, zpass); |
| 4124 | } |
| 4125 | |
| 4126 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 4127 | { |
| 4128 | context->getState().setStencilBackOperations(fail, zfail, zpass); |
| 4129 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4130 | } |
| 4131 | } |
| 4132 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4133 | GLboolean GL_APIENTRY glTestFenceNV(GLuint fence) |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 4134 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4135 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4136 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4137 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4138 | if (context) |
| 4139 | { |
| 4140 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 4141 | |
| 4142 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4143 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4144 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4145 | return GL_TRUE; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4146 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4147 | |
| 4148 | if (fenceObject->isFence() != GL_TRUE) |
| 4149 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4150 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4151 | return GL_TRUE; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4152 | } |
| 4153 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 4154 | GLboolean result; |
| 4155 | gl::Error error = fenceObject->testFence(&result); |
| 4156 | if (error.isError()) |
| 4157 | { |
| 4158 | context->recordError(error); |
| 4159 | return GL_TRUE; |
| 4160 | } |
| 4161 | |
| 4162 | return result; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4163 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4164 | |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4165 | return GL_TRUE; |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 4166 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4167 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4168 | void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 4169 | GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4170 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4171 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, GLsizei height = %d, " |
Jamie Madill | 1fc7e2c | 2014-01-21 16:47:10 -0500 | [diff] [blame] | 4172 | "GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 4173 | target, level, internalformat, width, height, border, format, type, pixels); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4174 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4175 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4176 | if (context) |
| 4177 | { |
| 4178 | if (context->getClientVersion() < 3 && |
| 4179 | !ValidateES2TexImageParameters(context, target, level, internalformat, false, false, |
| 4180 | 0, 0, width, height, border, format, type, pixels)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4181 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4182 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4183 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4184 | |
| 4185 | if (context->getClientVersion() >= 3 && |
| 4186 | !ValidateES3TexImageParameters(context, target, level, internalformat, false, false, |
| 4187 | 0, 0, 0, width, height, 1, border, format, type, pixels)) |
| 4188 | { |
| 4189 | return; |
| 4190 | } |
| 4191 | |
| 4192 | switch (target) |
| 4193 | { |
| 4194 | case GL_TEXTURE_2D: |
| 4195 | { |
| 4196 | gl::Texture2D *texture = context->getTexture2D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 4197 | gl::Error error = texture->setImage(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4198 | if (error.isError()) |
| 4199 | { |
| 4200 | context->recordError(error); |
| 4201 | return; |
| 4202 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4203 | } |
| 4204 | break; |
Geoff Lang | 8376cea | 2014-09-02 11:47:07 -0400 | [diff] [blame] | 4205 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4206 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4207 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4208 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4209 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4210 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4211 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 4212 | { |
| 4213 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Geoff Lang | 8376cea | 2014-09-02 11:47:07 -0400 | [diff] [blame] | 4214 | gl::Error error = texture->setImage(target, level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 4215 | if (error.isError()) |
| 4216 | { |
| 4217 | context->recordError(error); |
| 4218 | return; |
| 4219 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4220 | } |
| 4221 | break; |
Geoff Lang | 8376cea | 2014-09-02 11:47:07 -0400 | [diff] [blame] | 4222 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4223 | default: UNREACHABLE(); |
| 4224 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4225 | } |
| 4226 | } |
| 4227 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4228 | void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4229 | { |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4230 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %f)", target, pname, param); |
| 4231 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4232 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4233 | if (context) |
| 4234 | { |
| 4235 | if (!ValidateTexParamParameters(context, pname, static_cast<GLint>(param))) |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4236 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4237 | return; |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4238 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4239 | |
| 4240 | gl::Texture *texture = context->getTargetTexture(target); |
| 4241 | |
| 4242 | if (!texture) |
| 4243 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4244 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4245 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4246 | } |
| 4247 | |
| 4248 | switch (pname) |
| 4249 | { |
| 4250 | case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = gl::uiround<GLenum>(param); break; |
| 4251 | case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = gl::uiround<GLenum>(param); break; |
| 4252 | case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = gl::uiround<GLenum>(param); break; |
| 4253 | case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = gl::uiround<GLenum>(param); break; |
| 4254 | case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = gl::uiround<GLenum>(param); break; |
| 4255 | case GL_TEXTURE_USAGE_ANGLE: texture->setUsage(gl::uiround<GLenum>(param)); break; |
| 4256 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min(param, context->getExtensions().maxTextureAnisotropy); break; |
| 4257 | case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = gl::uiround<GLenum>(param); break; |
| 4258 | case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = gl::uiround<GLenum>(param); break; |
| 4259 | case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = gl::uiround<GLenum>(param); break; |
| 4260 | case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = gl::uiround<GLenum>(param); break; |
| 4261 | case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = gl::uiround<GLenum>(param); break; |
| 4262 | case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = gl::uiround<GLenum>(param); break; |
| 4263 | case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = gl::iround<GLint>(param); break; |
| 4264 | case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = gl::iround<GLint>(param); break; |
| 4265 | case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = param; break; |
| 4266 | case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = param; break; |
| 4267 | default: UNREACHABLE(); break; |
| 4268 | } |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4269 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4270 | } |
| 4271 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4272 | void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4273 | { |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4274 | glTexParameterf(target, pname, (GLfloat)*params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4275 | } |
| 4276 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4277 | void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4278 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4279 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4280 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4281 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4282 | if (context) |
| 4283 | { |
| 4284 | if (!ValidateTexParamParameters(context, pname, param)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4285 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4286 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4287 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4288 | |
| 4289 | gl::Texture *texture = context->getTargetTexture(target); |
| 4290 | |
| 4291 | if (!texture) |
| 4292 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4293 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4294 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4295 | } |
| 4296 | |
| 4297 | switch (pname) |
| 4298 | { |
| 4299 | case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = (GLenum)param; break; |
| 4300 | case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = (GLenum)param; break; |
| 4301 | case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = (GLenum)param; break; |
| 4302 | case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = (GLenum)param; break; |
| 4303 | case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = (GLenum)param; break; |
| 4304 | case GL_TEXTURE_USAGE_ANGLE: texture->setUsage((GLenum)param); break; |
| 4305 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min((float)param, context->getExtensions().maxTextureAnisotropy); break; |
| 4306 | case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = (GLenum)param; break; |
| 4307 | case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = (GLenum)param; break; |
| 4308 | case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = (GLenum)param; break; |
| 4309 | case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = (GLenum)param; break; |
| 4310 | case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = (GLenum)param; break; |
| 4311 | case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = (GLenum)param; break; |
| 4312 | case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = param; break; |
| 4313 | case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = param; break; |
| 4314 | case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = (GLfloat)param; break; |
| 4315 | case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = (GLfloat)param; break; |
| 4316 | default: UNREACHABLE(); break; |
| 4317 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4318 | } |
| 4319 | } |
| 4320 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4321 | void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4322 | { |
| 4323 | glTexParameteri(target, pname, *params); |
| 4324 | } |
| 4325 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4326 | void GL_APIENTRY glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4327 | { |
| 4328 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 4329 | target, levels, internalformat, width, height); |
| 4330 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4331 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4332 | if (context) |
| 4333 | { |
| 4334 | if (!context->getExtensions().textureStorage) |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4335 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4336 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4337 | return; |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4338 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4339 | |
| 4340 | if (context->getClientVersion() < 3 && |
| 4341 | !ValidateES2TexStorageParameters(context, target, levels, internalformat, width, height)) |
| 4342 | { |
| 4343 | return; |
| 4344 | } |
| 4345 | |
| 4346 | if (context->getClientVersion() >= 3 && |
| 4347 | !ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1)) |
| 4348 | { |
| 4349 | return; |
| 4350 | } |
| 4351 | |
| 4352 | switch (target) |
| 4353 | { |
| 4354 | case GL_TEXTURE_2D: |
| 4355 | { |
| 4356 | gl::Texture2D *texture2d = context->getTexture2D(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 4357 | gl::Error error = texture2d->storage(levels, internalformat, width, height); |
| 4358 | if (error.isError()) |
| 4359 | { |
| 4360 | context->recordError(error); |
| 4361 | return; |
| 4362 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4363 | } |
| 4364 | break; |
| 4365 | |
| 4366 | case GL_TEXTURE_CUBE_MAP: |
| 4367 | { |
| 4368 | gl::TextureCubeMap *textureCube = context->getTextureCubeMap(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 4369 | gl::Error error = textureCube->storage(levels, internalformat, width); |
| 4370 | if (error.isError()) |
| 4371 | { |
| 4372 | context->recordError(error); |
| 4373 | return; |
| 4374 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4375 | } |
| 4376 | break; |
| 4377 | |
| 4378 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4379 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4380 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4381 | } |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4382 | } |
| 4383 | } |
| 4384 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4385 | void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 4386 | GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4387 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4388 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 4389 | "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, " |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 4390 | "const GLvoid* pixels = 0x%0.8p)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4391 | target, level, xoffset, yoffset, width, height, format, type, pixels); |
| 4392 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4393 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4394 | if (context) |
| 4395 | { |
| 4396 | if (context->getClientVersion() < 3 && |
| 4397 | !ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true, |
| 4398 | xoffset, yoffset, width, height, 0, format, type, pixels)) |
daniel@transgaming.com | 00c7596 | 2010-03-11 20:36:15 +0000 | [diff] [blame] | 4399 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4400 | return; |
daniel@transgaming.com | 00c7596 | 2010-03-11 20:36:15 +0000 | [diff] [blame] | 4401 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4402 | |
| 4403 | if (context->getClientVersion() >= 3 && |
| 4404 | !ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true, |
| 4405 | xoffset, yoffset, 0, width, height, 1, 0, format, type, pixels)) |
| 4406 | { |
| 4407 | return; |
| 4408 | } |
| 4409 | |
| 4410 | // Zero sized uploads are valid but no-ops |
| 4411 | if (width == 0 || height == 0) |
| 4412 | { |
| 4413 | return; |
| 4414 | } |
| 4415 | |
| 4416 | switch (target) |
| 4417 | { |
| 4418 | case GL_TEXTURE_2D: |
| 4419 | { |
| 4420 | gl::Texture2D *texture = context->getTexture2D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 4421 | gl::Error error = texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels); |
| 4422 | if (error.isError()) |
| 4423 | { |
| 4424 | context->recordError(error); |
| 4425 | return; |
| 4426 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4427 | } |
| 4428 | break; |
| 4429 | |
| 4430 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 4431 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 4432 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 4433 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 4434 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 4435 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 4436 | { |
| 4437 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 4438 | gl::Error error = texture->subImage(target, level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels); |
| 4439 | if (error.isError()) |
| 4440 | { |
| 4441 | context->recordError(error); |
| 4442 | return; |
| 4443 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4444 | } |
| 4445 | break; |
| 4446 | |
| 4447 | default: |
| 4448 | UNREACHABLE(); |
| 4449 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4450 | } |
| 4451 | } |
| 4452 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4453 | void GL_APIENTRY glUniform1f(GLint location, GLfloat x) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4454 | { |
| 4455 | glUniform1fv(location, 1, &x); |
| 4456 | } |
| 4457 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4458 | void GL_APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4459 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4460 | EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4461 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4462 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4463 | if (context) |
| 4464 | { |
| 4465 | if (!ValidateUniform(context, GL_FLOAT, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4466 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4467 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4468 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4469 | |
| 4470 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4471 | programBinary->setUniform1fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4472 | } |
| 4473 | } |
| 4474 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4475 | void GL_APIENTRY glUniform1i(GLint location, GLint x) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4476 | { |
| 4477 | glUniform1iv(location, 1, &x); |
| 4478 | } |
| 4479 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4480 | void GL_APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4481 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4482 | EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4483 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4484 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4485 | if (context) |
| 4486 | { |
| 4487 | if (!ValidateUniform(context, GL_INT, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4488 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4489 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4490 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4491 | |
| 4492 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4493 | programBinary->setUniform1iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4494 | } |
| 4495 | } |
| 4496 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4497 | void GL_APIENTRY glUniform2f(GLint location, GLfloat x, GLfloat y) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4498 | { |
| 4499 | GLfloat xy[2] = {x, y}; |
| 4500 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4501 | glUniform2fv(location, 1, xy); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4502 | } |
| 4503 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4504 | void GL_APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4505 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4506 | EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4507 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4508 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4509 | if (context) |
| 4510 | { |
| 4511 | if (!ValidateUniform(context, GL_FLOAT_VEC2, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4512 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4513 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4514 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4515 | |
| 4516 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4517 | programBinary->setUniform2fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4518 | } |
| 4519 | } |
| 4520 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4521 | void GL_APIENTRY glUniform2i(GLint location, GLint x, GLint y) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4522 | { |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4523 | GLint xy[2] = {x, y}; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4524 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4525 | glUniform2iv(location, 1, xy); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4526 | } |
| 4527 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4528 | void GL_APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4529 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4530 | EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4531 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4532 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4533 | if (context) |
| 4534 | { |
| 4535 | if (!ValidateUniform(context, GL_INT_VEC2, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4536 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4537 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4538 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4539 | |
| 4540 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4541 | programBinary->setUniform2iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4542 | } |
| 4543 | } |
| 4544 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4545 | void GL_APIENTRY glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4546 | { |
| 4547 | GLfloat xyz[3] = {x, y, z}; |
| 4548 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4549 | glUniform3fv(location, 1, xyz); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4550 | } |
| 4551 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4552 | void GL_APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4553 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4554 | EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4555 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4556 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4557 | if (context) |
| 4558 | { |
| 4559 | if (!ValidateUniform(context, GL_FLOAT_VEC3, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4560 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4561 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4562 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4563 | |
| 4564 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4565 | programBinary->setUniform3fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4566 | } |
| 4567 | } |
| 4568 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4569 | void GL_APIENTRY glUniform3i(GLint location, GLint x, GLint y, GLint z) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4570 | { |
| 4571 | GLint xyz[3] = {x, y, z}; |
| 4572 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4573 | glUniform3iv(location, 1, xyz); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4574 | } |
| 4575 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4576 | void GL_APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4577 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4578 | EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4579 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4580 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4581 | if (context) |
| 4582 | { |
| 4583 | if (!ValidateUniform(context, GL_INT_VEC3, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4584 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4585 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4586 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4587 | |
| 4588 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4589 | programBinary->setUniform3iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4590 | } |
| 4591 | } |
| 4592 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4593 | void GL_APIENTRY glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4594 | { |
| 4595 | GLfloat xyzw[4] = {x, y, z, w}; |
| 4596 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4597 | glUniform4fv(location, 1, xyzw); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4598 | } |
| 4599 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4600 | void GL_APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4601 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4602 | EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4603 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4604 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4605 | if (context) |
| 4606 | { |
| 4607 | if (!ValidateUniform(context, GL_FLOAT_VEC4, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4608 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4609 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4610 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4611 | |
| 4612 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4613 | programBinary->setUniform4fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4614 | } |
| 4615 | } |
| 4616 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4617 | void GL_APIENTRY glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4618 | { |
| 4619 | GLint xyzw[4] = {x, y, z, w}; |
| 4620 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4621 | glUniform4iv(location, 1, xyzw); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4622 | } |
| 4623 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4624 | void GL_APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4625 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4626 | EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4627 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4628 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4629 | if (context) |
| 4630 | { |
| 4631 | if (!ValidateUniform(context, GL_INT_VEC4, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4632 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4633 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4634 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4635 | |
| 4636 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4637 | programBinary->setUniform4iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4638 | } |
| 4639 | } |
| 4640 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4641 | void GL_APIENTRY glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4642 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4643 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 4644 | location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4645 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4646 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4647 | if (context) |
| 4648 | { |
| 4649 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4650 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4651 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4652 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4653 | |
| 4654 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4655 | programBinary->setUniformMatrix2fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4656 | } |
| 4657 | } |
| 4658 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4659 | void GL_APIENTRY glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4660 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4661 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 4662 | location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4663 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4664 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4665 | if (context) |
| 4666 | { |
| 4667 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4668 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4669 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4670 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4671 | |
| 4672 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4673 | programBinary->setUniformMatrix3fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4674 | } |
| 4675 | } |
| 4676 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4677 | void GL_APIENTRY glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4678 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4679 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 4680 | location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4681 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4682 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4683 | if (context) |
| 4684 | { |
| 4685 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4686 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4687 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4688 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4689 | |
| 4690 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4691 | programBinary->setUniformMatrix4fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4692 | } |
| 4693 | } |
| 4694 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4695 | void GL_APIENTRY glUseProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4696 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4697 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4698 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4699 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4700 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4701 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4702 | gl::Program *programObject = context->getProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4703 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4704 | if (!programObject && program != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4705 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4706 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4707 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4708 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4709 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4710 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4711 | else |
| 4712 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4713 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4714 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4715 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4716 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4717 | |
| 4718 | if (program != 0 && !programObject->isLinked()) |
| 4719 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4720 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4721 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4722 | } |
| 4723 | |
| 4724 | context->useProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4725 | } |
| 4726 | } |
| 4727 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4728 | void GL_APIENTRY glValidateProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4729 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4730 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4731 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4732 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4733 | if (context) |
| 4734 | { |
| 4735 | gl::Program *programObject = context->getProgram(program); |
| 4736 | |
| 4737 | if (!programObject) |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4738 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4739 | if (context->getShader(program)) |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4740 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4741 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4742 | return; |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4743 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4744 | else |
| 4745 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4746 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4747 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4748 | } |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4749 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4750 | |
Brandon Jones | 43a53e2 | 2014-08-28 16:23:22 -0700 | [diff] [blame] | 4751 | programObject->validate(context->getCaps()); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4752 | } |
| 4753 | } |
| 4754 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4755 | void GL_APIENTRY glVertexAttrib1f(GLuint index, GLfloat x) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4756 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4757 | EVENT("(GLuint index = %d, GLfloat x = %f)", index, x); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4758 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4759 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4760 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4761 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4762 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4763 | { |
| 4764 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4765 | return; |
| 4766 | } |
| 4767 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4768 | GLfloat vals[4] = { x, 0, 0, 1 }; |
| 4769 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4770 | } |
| 4771 | } |
| 4772 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4773 | void GL_APIENTRY glVertexAttrib1fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4774 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4775 | EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4776 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4777 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4778 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4779 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4780 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4781 | { |
| 4782 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4783 | return; |
| 4784 | } |
| 4785 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4786 | GLfloat vals[4] = { values[0], 0, 0, 1 }; |
| 4787 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4788 | } |
| 4789 | } |
| 4790 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4791 | void GL_APIENTRY glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4792 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4793 | EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f)", index, x, y); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4794 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4795 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4796 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4797 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4798 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4799 | { |
| 4800 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4801 | return; |
| 4802 | } |
| 4803 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4804 | GLfloat vals[4] = { x, y, 0, 1 }; |
| 4805 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4806 | } |
| 4807 | } |
| 4808 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4809 | void GL_APIENTRY glVertexAttrib2fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4810 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4811 | EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4812 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4813 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4814 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4815 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4816 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4817 | { |
| 4818 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4819 | return; |
| 4820 | } |
| 4821 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4822 | GLfloat vals[4] = { values[0], values[1], 0, 1 }; |
| 4823 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4824 | } |
| 4825 | } |
| 4826 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4827 | void GL_APIENTRY glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4828 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4829 | EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", index, x, y, z); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4830 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4831 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4832 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4833 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4834 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4835 | { |
| 4836 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4837 | return; |
| 4838 | } |
| 4839 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4840 | GLfloat vals[4] = { x, y, z, 1 }; |
| 4841 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4842 | } |
| 4843 | } |
| 4844 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4845 | void GL_APIENTRY glVertexAttrib3fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4846 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4847 | EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4848 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4849 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4850 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4851 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4852 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4853 | { |
| 4854 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4855 | return; |
| 4856 | } |
| 4857 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4858 | GLfloat vals[4] = { values[0], values[1], values[2], 1 }; |
| 4859 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4860 | } |
| 4861 | } |
| 4862 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4863 | void GL_APIENTRY glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4864 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4865 | EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f, GLfloat w = %f)", index, x, y, z, w); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4866 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4867 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4868 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4869 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4870 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4871 | { |
| 4872 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4873 | return; |
| 4874 | } |
| 4875 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4876 | GLfloat vals[4] = { x, y, z, w }; |
| 4877 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4878 | } |
| 4879 | } |
| 4880 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4881 | void GL_APIENTRY glVertexAttrib4fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4882 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4883 | EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4884 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4885 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4886 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4887 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4888 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4889 | { |
| 4890 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4891 | return; |
| 4892 | } |
| 4893 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4894 | context->getState().setVertexAttribf(index, values); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4895 | } |
| 4896 | } |
| 4897 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4898 | void GL_APIENTRY glVertexAttribDivisorANGLE(GLuint index, GLuint divisor) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4899 | { |
| 4900 | EVENT("(GLuint index = %d, GLuint divisor = %d)", index, divisor); |
| 4901 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4902 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4903 | if (context) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4904 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4905 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4906 | { |
| 4907 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4908 | return; |
| 4909 | } |
| 4910 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4911 | context->setVertexAttribDivisor(index, divisor); |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4912 | } |
| 4913 | } |
| 4914 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4915 | void GL_APIENTRY glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4916 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4917 | EVENT("(GLuint index = %d, GLint size = %d, GLenum type = 0x%X, " |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4918 | "GLboolean normalized = %u, GLsizei stride = %d, const GLvoid* ptr = 0x%0.8p)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 4919 | index, size, type, normalized, stride, ptr); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4920 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4921 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4922 | if (context) |
| 4923 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4924 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4925 | { |
| 4926 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4927 | return; |
| 4928 | } |
| 4929 | |
| 4930 | if (size < 1 || size > 4) |
| 4931 | { |
| 4932 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4933 | return; |
| 4934 | } |
| 4935 | |
| 4936 | switch (type) |
| 4937 | { |
| 4938 | case GL_BYTE: |
| 4939 | case GL_UNSIGNED_BYTE: |
| 4940 | case GL_SHORT: |
| 4941 | case GL_UNSIGNED_SHORT: |
| 4942 | case GL_FIXED: |
| 4943 | case GL_FLOAT: |
| 4944 | break; |
| 4945 | |
| 4946 | case GL_HALF_FLOAT: |
| 4947 | case GL_INT: |
| 4948 | case GL_UNSIGNED_INT: |
| 4949 | case GL_INT_2_10_10_10_REV: |
| 4950 | case GL_UNSIGNED_INT_2_10_10_10_REV: |
| 4951 | if (context->getClientVersion() < 3) |
| 4952 | { |
| 4953 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4954 | return; |
| 4955 | } |
| 4956 | break; |
| 4957 | |
| 4958 | default: |
| 4959 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4960 | return; |
| 4961 | } |
| 4962 | |
| 4963 | if (stride < 0) |
| 4964 | { |
| 4965 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4966 | return; |
| 4967 | } |
| 4968 | |
| 4969 | if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4) |
| 4970 | { |
| 4971 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4972 | return; |
| 4973 | } |
| 4974 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4975 | // [OpenGL ES 3.0.2] Section 2.8 page 24: |
| 4976 | // An INVALID_OPERATION error is generated when a non-zero vertex array object |
| 4977 | // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point, |
| 4978 | // and the pointer argument is not NULL. |
| 4979 | if (context->getState().getVertexArray()->id() != 0 && context->getState().getArrayBufferId() == 0 && ptr != NULL) |
shannon.woods%transgaming.com@gtempaccount.com | 1ab57be | 2013-04-13 03:38:39 +0000 | [diff] [blame] | 4980 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4981 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4982 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 1ab57be | 2013-04-13 03:38:39 +0000 | [diff] [blame] | 4983 | } |
| 4984 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4985 | context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type, |
| 4986 | normalized == GL_TRUE, false, stride, ptr); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4987 | } |
| 4988 | } |
| 4989 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4990 | void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4991 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4992 | EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4993 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4994 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4995 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4996 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4997 | if (width < 0 || height < 0) |
| 4998 | { |
| 4999 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5000 | return; |
| 5001 | } |
| 5002 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5003 | context->getState().setViewportParams(x, y, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 5004 | } |
| 5005 | } |
| 5006 | |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5007 | // OpenGL ES 3.0 functions |
| 5008 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5009 | void GL_APIENTRY glReadBuffer(GLenum mode) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5010 | { |
| 5011 | EVENT("(GLenum mode = 0x%X)", mode); |
| 5012 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5013 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5014 | if (context) |
| 5015 | { |
| 5016 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5017 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5018 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5019 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5020 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5021 | |
| 5022 | // glReadBuffer |
| 5023 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5024 | } |
| 5025 | } |
| 5026 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5027 | void GL_APIENTRY glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5028 | { |
| 5029 | EVENT("(GLenum mode = 0x%X, GLuint start = %u, GLuint end = %u, GLsizei count = %d, GLenum type = 0x%X, " |
| 5030 | "const GLvoid* indices = 0x%0.8p)", mode, start, end, count, type, indices); |
| 5031 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5032 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5033 | if (context) |
| 5034 | { |
| 5035 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5036 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5037 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5038 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5039 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5040 | |
| 5041 | // glDrawRangeElements |
| 5042 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5043 | } |
| 5044 | } |
| 5045 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5046 | void GL_APIENTRY glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5047 | { |
| 5048 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, " |
| 5049 | "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLenum format = 0x%X, " |
| 5050 | "GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", |
| 5051 | target, level, internalformat, width, height, depth, border, format, type, pixels); |
| 5052 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5053 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5054 | if (context) |
| 5055 | { |
| 5056 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5057 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5058 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5059 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5060 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5061 | |
| 5062 | // validateES3TexImageFormat sets the error code if there is an error |
| 5063 | if (!ValidateES3TexImageParameters(context, target, level, internalformat, false, false, |
| 5064 | 0, 0, 0, width, height, depth, border, format, type, pixels)) |
| 5065 | { |
| 5066 | return; |
| 5067 | } |
| 5068 | |
| 5069 | switch(target) |
| 5070 | { |
| 5071 | case GL_TEXTURE_3D: |
| 5072 | { |
| 5073 | gl::Texture3D *texture = context->getTexture3D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5074 | gl::Error error = texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 5075 | if (error.isError()) |
| 5076 | { |
| 5077 | context->recordError(error); |
| 5078 | return; |
| 5079 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5080 | } |
| 5081 | break; |
| 5082 | |
| 5083 | case GL_TEXTURE_2D_ARRAY: |
| 5084 | { |
| 5085 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5086 | gl::Error error = texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 5087 | if (error.isError()) |
| 5088 | { |
| 5089 | context->recordError(error); |
| 5090 | return; |
| 5091 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5092 | } |
| 5093 | break; |
| 5094 | |
| 5095 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5096 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5097 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5098 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5099 | } |
| 5100 | } |
| 5101 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5102 | void GL_APIENTRY glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5103 | { |
| 5104 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5105 | "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, " |
| 5106 | "GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", |
| 5107 | target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); |
| 5108 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5109 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5110 | if (context) |
| 5111 | { |
| 5112 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5113 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5114 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5115 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5116 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5117 | |
| 5118 | // validateES3TexImageFormat sets the error code if there is an error |
| 5119 | if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true, |
| 5120 | xoffset, yoffset, zoffset, width, height, depth, 0, |
| 5121 | format, type, pixels)) |
| 5122 | { |
| 5123 | return; |
| 5124 | } |
| 5125 | |
| 5126 | // Zero sized uploads are valid but no-ops |
| 5127 | if (width == 0 || height == 0 || depth == 0) |
| 5128 | { |
| 5129 | return; |
| 5130 | } |
| 5131 | |
| 5132 | switch(target) |
| 5133 | { |
| 5134 | case GL_TEXTURE_3D: |
| 5135 | { |
| 5136 | gl::Texture3D *texture = context->getTexture3D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5137 | gl::Error error = texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels); |
| 5138 | if (error.isError()) |
| 5139 | { |
| 5140 | context->recordError(error); |
| 5141 | return; |
| 5142 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5143 | } |
| 5144 | break; |
| 5145 | |
| 5146 | case GL_TEXTURE_2D_ARRAY: |
| 5147 | { |
| 5148 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5149 | gl::Error error = texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels); |
| 5150 | if (error.isError()) |
| 5151 | { |
| 5152 | context->recordError(error); |
| 5153 | return; |
| 5154 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5155 | } |
| 5156 | break; |
| 5157 | |
| 5158 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5159 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5160 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5161 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5162 | } |
| 5163 | } |
| 5164 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5165 | void GL_APIENTRY glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5166 | { |
| 5167 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5168 | "GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", |
| 5169 | target, level, xoffset, yoffset, zoffset, x, y, width, height); |
| 5170 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5171 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5172 | if (context) |
| 5173 | { |
| 5174 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5175 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5176 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5177 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5178 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5179 | |
| 5180 | if (!ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true, xoffset, yoffset, zoffset, |
| 5181 | x, y, width, height, 0)) |
| 5182 | { |
| 5183 | return; |
| 5184 | } |
| 5185 | |
| 5186 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 5187 | gl::Texture *texture = NULL; |
| 5188 | switch (target) |
| 5189 | { |
| 5190 | case GL_TEXTURE_3D: |
| 5191 | texture = context->getTexture3D(); |
| 5192 | break; |
| 5193 | |
| 5194 | case GL_TEXTURE_2D_ARRAY: |
| 5195 | texture = context->getTexture2DArray(); |
| 5196 | break; |
| 5197 | |
| 5198 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5199 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5200 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5201 | } |
| 5202 | |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 5203 | gl::Error error = texture->copySubImage(target, level, xoffset, yoffset, zoffset, x, y, width, height, framebuffer); |
| 5204 | if (error.isError()) |
| 5205 | { |
| 5206 | context->recordError(error); |
| 5207 | return; |
| 5208 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5209 | } |
| 5210 | } |
| 5211 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5212 | void GL_APIENTRY glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5213 | { |
Geoff Lang | eef52cc | 2013-10-16 15:07:39 -0400 | [diff] [blame] | 5214 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5215 | "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLsizei imageSize = %d, " |
| 5216 | "const GLvoid* data = 0x%0.8p)", |
| 5217 | target, level, internalformat, width, height, depth, border, imageSize, data); |
| 5218 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5219 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5220 | if (context) |
| 5221 | { |
| 5222 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5223 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5224 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5225 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5226 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5227 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 5228 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat); |
| 5229 | if (imageSize < 0 || static_cast<GLuint>(imageSize) != formatInfo.computeBlockSize(GL_UNSIGNED_BYTE, width, height)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5230 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5231 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5232 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5233 | } |
| 5234 | |
| 5235 | // validateES3TexImageFormat sets the error code if there is an error |
| 5236 | if (!ValidateES3TexImageParameters(context, target, level, internalformat, true, false, |
| 5237 | 0, 0, 0, width, height, depth, border, GL_NONE, GL_NONE, data)) |
| 5238 | { |
| 5239 | return; |
| 5240 | } |
| 5241 | |
| 5242 | switch(target) |
| 5243 | { |
| 5244 | case GL_TEXTURE_3D: |
| 5245 | { |
| 5246 | gl::Texture3D *texture = context->getTexture3D(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 5247 | gl::Error error = texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, context->getState().getUnpackState(), data); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5248 | if (error.isError()) |
| 5249 | { |
| 5250 | context->recordError(error); |
| 5251 | return; |
| 5252 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5253 | } |
| 5254 | break; |
| 5255 | |
| 5256 | case GL_TEXTURE_2D_ARRAY: |
| 5257 | { |
| 5258 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 5259 | gl::Error error = texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, context->getState().getUnpackState(), data); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5260 | if (error.isError()) |
| 5261 | { |
| 5262 | context->recordError(error); |
| 5263 | return; |
| 5264 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5265 | } |
| 5266 | break; |
| 5267 | |
| 5268 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5269 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5270 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5271 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5272 | } |
| 5273 | } |
| 5274 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5275 | void GL_APIENTRY glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5276 | { |
| 5277 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5278 | "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, " |
| 5279 | "GLenum format = 0x%X, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
| 5280 | target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); |
| 5281 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5282 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5283 | if (context) |
| 5284 | { |
| 5285 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5286 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5287 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5288 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5289 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5290 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 5291 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format); |
| 5292 | if (imageSize < 0 || static_cast<GLuint>(imageSize) != formatInfo.computeBlockSize(GL_UNSIGNED_BYTE, width, height)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5293 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5294 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5295 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5296 | } |
| 5297 | |
| 5298 | if (!data) |
| 5299 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5300 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5301 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5302 | } |
| 5303 | |
| 5304 | // validateES3TexImageFormat sets the error code if there is an error |
| 5305 | if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true, |
| 5306 | 0, 0, 0, width, height, depth, 0, GL_NONE, GL_NONE, data)) |
| 5307 | { |
| 5308 | return; |
| 5309 | } |
| 5310 | |
| 5311 | // Zero sized uploads are valid but no-ops |
| 5312 | if (width == 0 || height == 0) |
| 5313 | { |
| 5314 | return; |
| 5315 | } |
| 5316 | |
| 5317 | switch(target) |
| 5318 | { |
| 5319 | case GL_TEXTURE_3D: |
| 5320 | { |
| 5321 | gl::Texture3D *texture = context->getTexture3D(); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5322 | gl::Error error = texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 5323 | format, imageSize, context->getState().getUnpackState(), data); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5324 | if (error.isError()) |
| 5325 | { |
| 5326 | context->recordError(error); |
| 5327 | return; |
| 5328 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5329 | } |
| 5330 | break; |
| 5331 | |
| 5332 | case GL_TEXTURE_2D_ARRAY: |
| 5333 | { |
| 5334 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5335 | gl::Error error = texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 5336 | format, imageSize, context->getState().getUnpackState(), data); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5337 | if (error.isError()) |
| 5338 | { |
| 5339 | context->recordError(error); |
| 5340 | return; |
| 5341 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5342 | } |
| 5343 | break; |
| 5344 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5345 | default: |
| 5346 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5347 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5348 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5349 | } |
| 5350 | } |
| 5351 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5352 | void GL_APIENTRY glGenQueries(GLsizei n, GLuint* ids) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5353 | { |
| 5354 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 5355 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5356 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5357 | if (context) |
| 5358 | { |
| 5359 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5360 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5361 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5362 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5363 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5364 | |
| 5365 | if (n < 0) |
| 5366 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5367 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5368 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5369 | } |
| 5370 | |
| 5371 | for (GLsizei i = 0; i < n; i++) |
| 5372 | { |
| 5373 | ids[i] = context->createQuery(); |
| 5374 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5375 | } |
| 5376 | } |
| 5377 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5378 | void GL_APIENTRY glDeleteQueries(GLsizei n, const GLuint* ids) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5379 | { |
| 5380 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 5381 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5382 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5383 | if (context) |
| 5384 | { |
| 5385 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5386 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5387 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5388 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5389 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5390 | |
| 5391 | if (n < 0) |
| 5392 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5393 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5394 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5395 | } |
| 5396 | |
| 5397 | for (GLsizei i = 0; i < n; i++) |
| 5398 | { |
| 5399 | context->deleteQuery(ids[i]); |
| 5400 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5401 | } |
| 5402 | } |
| 5403 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5404 | GLboolean GL_APIENTRY glIsQuery(GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5405 | { |
| 5406 | EVENT("(GLuint id = %u)", id); |
| 5407 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5408 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5409 | if (context) |
| 5410 | { |
| 5411 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5412 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5413 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5414 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5415 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5416 | |
| 5417 | return (context->getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5418 | } |
| 5419 | |
| 5420 | return GL_FALSE; |
| 5421 | } |
| 5422 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5423 | void GL_APIENTRY glBeginQuery(GLenum target, GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5424 | { |
| 5425 | EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id); |
| 5426 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5427 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5428 | if (context) |
| 5429 | { |
| 5430 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5431 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5432 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5433 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5434 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5435 | |
| 5436 | if (!ValidateBeginQuery(context, target, id)) |
| 5437 | { |
| 5438 | return; |
| 5439 | } |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5440 | |
| 5441 | gl::Error error = context->beginQuery(target, id); |
| 5442 | if (error.isError()) |
| 5443 | { |
| 5444 | context->recordError(error); |
| 5445 | return; |
| 5446 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5447 | } |
| 5448 | } |
| 5449 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5450 | void GL_APIENTRY glEndQuery(GLenum target) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5451 | { |
| 5452 | EVENT("(GLenum target = 0x%X)", target); |
| 5453 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5454 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5455 | if (context) |
| 5456 | { |
| 5457 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5458 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5459 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5460 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5461 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5462 | |
| 5463 | if (!ValidateEndQuery(context, target)) |
| 5464 | { |
| 5465 | return; |
| 5466 | } |
| 5467 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5468 | gl::Error error = context->endQuery(target); |
| 5469 | if (error.isError()) |
| 5470 | { |
| 5471 | context->recordError(error); |
| 5472 | return; |
| 5473 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5474 | } |
| 5475 | } |
| 5476 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5477 | void GL_APIENTRY glGetQueryiv(GLenum target, GLenum pname, GLint* params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5478 | { |
| 5479 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params); |
| 5480 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5481 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5482 | if (context) |
| 5483 | { |
| 5484 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5485 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5486 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5487 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5488 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5489 | |
| 5490 | if (!ValidQueryType(context, target)) |
| 5491 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5492 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5493 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5494 | } |
| 5495 | |
| 5496 | switch (pname) |
| 5497 | { |
| 5498 | case GL_CURRENT_QUERY: |
| 5499 | params[0] = static_cast<GLint>(context->getState().getActiveQueryId(target)); |
| 5500 | break; |
| 5501 | |
| 5502 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5503 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5504 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5505 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5506 | } |
| 5507 | } |
| 5508 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5509 | void GL_APIENTRY glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5510 | { |
| 5511 | EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", id, pname, params); |
| 5512 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5513 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5514 | if (context) |
| 5515 | { |
| 5516 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5517 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5518 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5519 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5520 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5521 | |
| 5522 | gl::Query *queryObject = context->getQuery(id, false, GL_NONE); |
| 5523 | |
| 5524 | if (!queryObject) |
| 5525 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5526 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5527 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5528 | } |
| 5529 | |
| 5530 | if (context->getState().getActiveQueryId(queryObject->getType()) == id) |
| 5531 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5532 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5533 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5534 | } |
| 5535 | |
| 5536 | switch(pname) |
| 5537 | { |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5538 | case GL_QUERY_RESULT_EXT: |
| 5539 | { |
| 5540 | gl::Error error = queryObject->getResult(params); |
| 5541 | if (error.isError()) |
| 5542 | { |
| 5543 | context->recordError(error); |
| 5544 | return; |
| 5545 | } |
| 5546 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5547 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5548 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5549 | case GL_QUERY_RESULT_AVAILABLE_EXT: |
| 5550 | { |
| 5551 | gl::Error error = queryObject->isResultAvailable(params); |
| 5552 | if (error.isError()) |
| 5553 | { |
| 5554 | context->recordError(error); |
| 5555 | return; |
| 5556 | } |
| 5557 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5558 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5559 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5560 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5561 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5562 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5563 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5564 | } |
| 5565 | } |
| 5566 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5567 | GLboolean GL_APIENTRY glUnmapBuffer(GLenum target) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5568 | { |
| 5569 | EVENT("(GLenum target = 0x%X)", target); |
| 5570 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5571 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5572 | if (context) |
| 5573 | { |
| 5574 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5575 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5576 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5577 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5578 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5579 | |
| 5580 | return glUnmapBufferOES(target); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5581 | } |
| 5582 | |
| 5583 | return GL_FALSE; |
| 5584 | } |
| 5585 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5586 | void GL_APIENTRY glGetBufferPointerv(GLenum target, GLenum pname, GLvoid** params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5587 | { |
| 5588 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params); |
| 5589 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5590 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5591 | if (context) |
| 5592 | { |
| 5593 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5594 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5595 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5596 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5597 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5598 | |
| 5599 | glGetBufferPointervOES(target, pname, params); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5600 | } |
| 5601 | } |
| 5602 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5603 | void GL_APIENTRY glDrawBuffers(GLsizei n, const GLenum* bufs) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5604 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5605 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5606 | if (context) |
| 5607 | { |
| 5608 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5609 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5610 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5611 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 7948c5f | 2013-04-13 03:38:58 +0000 | [diff] [blame] | 5612 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5613 | |
| 5614 | glDrawBuffersEXT(n, bufs); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5615 | } |
| 5616 | } |
| 5617 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5618 | void GL_APIENTRY glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5619 | { |
| 5620 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5621 | location, count, transpose, value); |
| 5622 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5623 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5624 | if (context) |
| 5625 | { |
| 5626 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2x3, location, count, transpose)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5627 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5628 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5629 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5630 | |
| 5631 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5632 | programBinary->setUniformMatrix2x3fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5633 | } |
| 5634 | } |
| 5635 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5636 | void GL_APIENTRY glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5637 | { |
| 5638 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5639 | location, count, transpose, value); |
| 5640 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5641 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5642 | if (context) |
| 5643 | { |
| 5644 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3x2, location, count, transpose)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5645 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5646 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5647 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5648 | |
| 5649 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5650 | programBinary->setUniformMatrix3x2fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5651 | } |
| 5652 | } |
| 5653 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5654 | void GL_APIENTRY glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5655 | { |
| 5656 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5657 | location, count, transpose, value); |
| 5658 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5659 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5660 | if (context) |
| 5661 | { |
| 5662 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2x4, location, count, transpose)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5663 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5664 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5665 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5666 | |
| 5667 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5668 | programBinary->setUniformMatrix2x4fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5669 | } |
| 5670 | } |
| 5671 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5672 | void GL_APIENTRY glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5673 | { |
| 5674 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5675 | location, count, transpose, value); |
| 5676 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5677 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5678 | if (context) |
| 5679 | { |
| 5680 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4x2, location, count, transpose)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5681 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5682 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5683 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5684 | |
| 5685 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5686 | programBinary->setUniformMatrix4x2fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5687 | } |
| 5688 | } |
| 5689 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5690 | void GL_APIENTRY glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5691 | { |
| 5692 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5693 | location, count, transpose, value); |
| 5694 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5695 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5696 | if (context) |
| 5697 | { |
| 5698 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3x4, location, count, transpose)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5699 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5700 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5701 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5702 | |
| 5703 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5704 | programBinary->setUniformMatrix3x4fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5705 | } |
| 5706 | } |
| 5707 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5708 | void GL_APIENTRY glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5709 | { |
| 5710 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5711 | location, count, transpose, value); |
| 5712 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5713 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5714 | if (context) |
| 5715 | { |
| 5716 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4x3, location, count, transpose)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5717 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5718 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5719 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5720 | |
| 5721 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5722 | programBinary->setUniformMatrix4x3fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5723 | } |
| 5724 | } |
| 5725 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5726 | void GL_APIENTRY glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5727 | { |
| 5728 | EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, GLint dstX0 = %d, " |
| 5729 | "GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, GLbitfield mask = 0x%X, GLenum filter = 0x%X)", |
| 5730 | srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 5731 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5732 | gl::Context *context = gl::getNonLostContext(); |
| 5733 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5734 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5735 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5736 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5737 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5738 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5739 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5740 | |
| 5741 | if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, |
| 5742 | dstX0, dstY0, dstX1, dstY1, mask, filter, |
| 5743 | false)) |
| 5744 | { |
| 5745 | return; |
| 5746 | } |
| 5747 | |
Geoff Lang | 6483915 | 2014-08-26 16:23:25 -0400 | [diff] [blame] | 5748 | gl::Error error = context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, |
| 5749 | mask, filter); |
| 5750 | if (error.isError()) |
| 5751 | { |
| 5752 | context->recordError(error); |
| 5753 | return; |
| 5754 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5755 | } |
| 5756 | } |
| 5757 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5758 | void GL_APIENTRY glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5759 | { |
| 5760 | EVENT("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 5761 | target, samples, internalformat, width, height); |
| 5762 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5763 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5764 | if (context) |
| 5765 | { |
| 5766 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5767 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5768 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5769 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5770 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5771 | |
Corentin Wallez | e090264 | 2014-11-04 12:32:15 -0800 | [diff] [blame] | 5772 | if (!ValidateES3RenderbufferStorageParameters(context, target, samples, internalformat, width, height)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5773 | { |
| 5774 | return; |
| 5775 | } |
| 5776 | |
Shannon Woods | e2632d2 | 2014-10-17 13:08:51 -0400 | [diff] [blame] | 5777 | gl::Renderbuffer *renderbuffer = context->getState().getCurrentRenderbuffer(); |
| 5778 | renderbuffer->setStorage(width, height, internalformat, samples); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5779 | } |
| 5780 | } |
| 5781 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5782 | void GL_APIENTRY glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5783 | { |
| 5784 | EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d, GLint layer = %d)", |
| 5785 | target, attachment, texture, level, layer); |
| 5786 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5787 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5788 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5789 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5790 | if (!ValidateFramebufferTextureLayer(context, target, attachment, texture, |
| 5791 | level, layer)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5792 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5793 | return; |
| 5794 | } |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5795 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5796 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 5797 | ASSERT(framebuffer); |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5798 | |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 5799 | if (texture != 0) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5800 | { |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 5801 | gl::Texture *textureObject = context->getTexture(texture); |
| 5802 | gl::ImageIndex index(textureObject->getTarget(), level, layer); |
| 5803 | framebuffer->setTextureAttachment(attachment, textureObject, index); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5804 | } |
| 5805 | else |
| 5806 | { |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 5807 | framebuffer->setNULLAttachment(attachment); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5808 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5809 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5810 | } |
| 5811 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5812 | GLvoid* GL_APIENTRY glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5813 | { |
| 5814 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)", |
| 5815 | target, offset, length, access); |
| 5816 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5817 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5818 | if (context) |
| 5819 | { |
| 5820 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5821 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5822 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5823 | return NULL; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5824 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5825 | |
| 5826 | return glMapBufferRangeEXT(target, offset, length, access); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5827 | } |
| 5828 | |
| 5829 | return NULL; |
| 5830 | } |
| 5831 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5832 | void GL_APIENTRY glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5833 | { |
| 5834 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length); |
| 5835 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5836 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5837 | if (context) |
| 5838 | { |
| 5839 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5840 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5841 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5842 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5843 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5844 | |
| 5845 | glFlushMappedBufferRangeEXT(target, offset, length); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5846 | } |
| 5847 | } |
| 5848 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5849 | void GL_APIENTRY glBindVertexArray(GLuint array) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5850 | { |
| 5851 | EVENT("(GLuint array = %u)", array); |
| 5852 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5853 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5854 | if (context) |
| 5855 | { |
| 5856 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5857 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5858 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5859 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5860 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5861 | |
| 5862 | gl::VertexArray *vao = context->getVertexArray(array); |
| 5863 | |
| 5864 | if (!vao) |
| 5865 | { |
| 5866 | // The default VAO should always exist |
| 5867 | ASSERT(array != 0); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5868 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5869 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5870 | } |
| 5871 | |
| 5872 | context->bindVertexArray(array); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5873 | } |
| 5874 | } |
| 5875 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5876 | void GL_APIENTRY glDeleteVertexArrays(GLsizei n, const GLuint* arrays) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5877 | { |
| 5878 | EVENT("(GLsizei n = %d, const GLuint* arrays = 0x%0.8p)", n, arrays); |
| 5879 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5880 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5881 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5882 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5883 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5884 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5885 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5886 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5887 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5888 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5889 | if (n < 0) |
| 5890 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5891 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5892 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5893 | } |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5894 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5895 | for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) |
| 5896 | { |
| 5897 | if (arrays[arrayIndex] != 0) |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5898 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5899 | context->deleteVertexArray(arrays[arrayIndex]); |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5900 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5901 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5902 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5903 | } |
| 5904 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5905 | void GL_APIENTRY glGenVertexArrays(GLsizei n, GLuint* arrays) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5906 | { |
| 5907 | EVENT("(GLsizei n = %d, GLuint* arrays = 0x%0.8p)", n, arrays); |
| 5908 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5909 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5910 | if (context) |
| 5911 | { |
| 5912 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5913 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5914 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5915 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5916 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5917 | |
| 5918 | if (n < 0) |
| 5919 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5920 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5921 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5922 | } |
| 5923 | |
| 5924 | for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) |
| 5925 | { |
| 5926 | arrays[arrayIndex] = context->createVertexArray(); |
| 5927 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5928 | } |
| 5929 | } |
| 5930 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5931 | GLboolean GL_APIENTRY glIsVertexArray(GLuint array) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5932 | { |
| 5933 | EVENT("(GLuint array = %u)", array); |
| 5934 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5935 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5936 | if (context) |
| 5937 | { |
| 5938 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5939 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5940 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5941 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5942 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5943 | |
| 5944 | if (array == 0) |
| 5945 | { |
| 5946 | return GL_FALSE; |
| 5947 | } |
| 5948 | |
| 5949 | gl::VertexArray *vao = context->getVertexArray(array); |
| 5950 | |
| 5951 | return (vao != NULL ? GL_TRUE : GL_FALSE); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5952 | } |
| 5953 | |
| 5954 | return GL_FALSE; |
| 5955 | } |
| 5956 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5957 | void GL_APIENTRY glGetIntegeri_v(GLenum target, GLuint index, GLint* data) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5958 | { |
| 5959 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint* data = 0x%0.8p)", |
| 5960 | target, index, data); |
| 5961 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5962 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5963 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5964 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5965 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5966 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5967 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5968 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5969 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5970 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 5971 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5972 | switch (target) |
| 5973 | { |
| 5974 | case GL_TRANSFORM_FEEDBACK_BUFFER_START: |
| 5975 | case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: |
| 5976 | case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 5977 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
| 5978 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5979 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5980 | return; |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 5981 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5982 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5983 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5984 | case GL_UNIFORM_BUFFER_START: |
| 5985 | case GL_UNIFORM_BUFFER_SIZE: |
| 5986 | case GL_UNIFORM_BUFFER_BINDING: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 5987 | if (index >= caps.maxCombinedUniformBlocks) |
| 5988 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5989 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5990 | return; |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 5991 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5992 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5993 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5994 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5995 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5996 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5997 | } |
| 5998 | |
| 5999 | if (!(context->getIndexedIntegerv(target, index, data))) |
| 6000 | { |
| 6001 | GLenum nativeType; |
| 6002 | unsigned int numParams = 0; |
| 6003 | if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams)) |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6004 | { |
| 6005 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6006 | return; |
| 6007 | } |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6008 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6009 | if (numParams == 0) |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6010 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6011 | return; // it is known that pname is valid, but there are no parameters to return |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6012 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6013 | |
| 6014 | if (nativeType == GL_INT_64_ANGLEX) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6015 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6016 | GLint64 minIntValue = static_cast<GLint64>(std::numeric_limits<int>::min()); |
| 6017 | GLint64 maxIntValue = static_cast<GLint64>(std::numeric_limits<int>::max()); |
| 6018 | GLint64 *int64Params = new GLint64[numParams]; |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6019 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6020 | context->getIndexedInteger64v(target, index, int64Params); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6021 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6022 | for (unsigned int i = 0; i < numParams; ++i) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6023 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6024 | GLint64 clampedValue = std::max(std::min(int64Params[i], maxIntValue), minIntValue); |
| 6025 | data[i] = static_cast<GLint>(clampedValue); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6026 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6027 | |
| 6028 | delete [] int64Params; |
| 6029 | } |
| 6030 | else |
| 6031 | { |
| 6032 | UNREACHABLE(); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6033 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6034 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6035 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6036 | } |
| 6037 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6038 | void GL_APIENTRY glBeginTransformFeedback(GLenum primitiveMode) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6039 | { |
| 6040 | EVENT("(GLenum primitiveMode = 0x%X)", primitiveMode); |
| 6041 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6042 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6043 | if (context) |
| 6044 | { |
| 6045 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6046 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6047 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6048 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6049 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6050 | |
| 6051 | switch (primitiveMode) |
| 6052 | { |
| 6053 | case GL_TRIANGLES: |
| 6054 | case GL_LINES: |
| 6055 | case GL_POINTS: |
| 6056 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6057 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6058 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6059 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6060 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6061 | } |
| 6062 | |
| 6063 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 6064 | ASSERT(transformFeedback != NULL); |
| 6065 | |
| 6066 | if (transformFeedback->isStarted()) |
| 6067 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6068 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6069 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6070 | } |
| 6071 | |
| 6072 | if (transformFeedback->isPaused()) |
| 6073 | { |
| 6074 | transformFeedback->resume(); |
| 6075 | } |
| 6076 | else |
| 6077 | { |
| 6078 | transformFeedback->start(primitiveMode); |
| 6079 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6080 | } |
| 6081 | } |
| 6082 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6083 | void GL_APIENTRY glEndTransformFeedback(void) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6084 | { |
| 6085 | EVENT("(void)"); |
| 6086 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6087 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6088 | if (context) |
| 6089 | { |
| 6090 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6091 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6092 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6093 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6094 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6095 | |
| 6096 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 6097 | ASSERT(transformFeedback != NULL); |
| 6098 | |
| 6099 | if (!transformFeedback->isStarted()) |
| 6100 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6101 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6102 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6103 | } |
| 6104 | |
| 6105 | transformFeedback->stop(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6106 | } |
| 6107 | } |
| 6108 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6109 | void GL_APIENTRY glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6110 | { |
| 6111 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u, GLintptr offset = %d, GLsizeiptr size = %d)", |
| 6112 | target, index, buffer, offset, size); |
| 6113 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6114 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6115 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6116 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6117 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6118 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6119 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6120 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6121 | } |
| 6122 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6123 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6124 | switch (target) |
| 6125 | { |
| 6126 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6127 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6128 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6129 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6130 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6131 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6132 | break; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6133 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6134 | case GL_UNIFORM_BUFFER: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6135 | if (index >= caps.maxUniformBufferBindings) |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6136 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6137 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6138 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6139 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6140 | break; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6141 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6142 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6143 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6144 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6145 | } |
| 6146 | |
| 6147 | if (buffer != 0 && size <= 0) |
| 6148 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6149 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6150 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6151 | } |
| 6152 | |
| 6153 | switch (target) |
| 6154 | { |
| 6155 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 6156 | |
| 6157 | // size and offset must be a multiple of 4 |
| 6158 | if (buffer != 0 && ((offset % 4) != 0 || (size % 4) != 0)) |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6159 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6160 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6161 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6162 | } |
| 6163 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6164 | context->bindIndexedTransformFeedbackBuffer(buffer, index, offset, size); |
| 6165 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 6166 | break; |
| 6167 | |
| 6168 | case GL_UNIFORM_BUFFER: |
| 6169 | |
| 6170 | // it is an error to bind an offset not a multiple of the alignment |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6171 | if (buffer != 0 && (offset % caps.uniformBufferOffsetAlignment) != 0) |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6172 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6173 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6174 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6175 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6176 | |
| 6177 | context->bindIndexedUniformBuffer(buffer, index, offset, size); |
| 6178 | context->bindGenericUniformBuffer(buffer); |
| 6179 | break; |
| 6180 | |
| 6181 | default: |
| 6182 | UNREACHABLE(); |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6183 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6184 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6185 | } |
| 6186 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6187 | void GL_APIENTRY glBindBufferBase(GLenum target, GLuint index, GLuint buffer) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6188 | { |
| 6189 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u)", |
| 6190 | target, index, buffer); |
| 6191 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6192 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6193 | if (context) |
| 6194 | { |
| 6195 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6196 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6197 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6198 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6199 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6200 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6201 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6202 | switch (target) |
| 6203 | { |
| 6204 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6205 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6206 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6207 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6208 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6209 | } |
| 6210 | break; |
| 6211 | |
| 6212 | case GL_UNIFORM_BUFFER: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6213 | if (index >= caps.maxUniformBufferBindings) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6214 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6215 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6216 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6217 | } |
| 6218 | break; |
| 6219 | |
| 6220 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6221 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6222 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6223 | } |
| 6224 | |
| 6225 | switch (target) |
| 6226 | { |
| 6227 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 6228 | context->bindIndexedTransformFeedbackBuffer(buffer, index, 0, 0); |
| 6229 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 6230 | break; |
| 6231 | |
| 6232 | case GL_UNIFORM_BUFFER: |
| 6233 | context->bindIndexedUniformBuffer(buffer, index, 0, 0); |
| 6234 | context->bindGenericUniformBuffer(buffer); |
| 6235 | break; |
| 6236 | |
| 6237 | default: |
| 6238 | UNREACHABLE(); |
| 6239 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6240 | } |
| 6241 | } |
| 6242 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6243 | void GL_APIENTRY glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6244 | { |
| 6245 | EVENT("(GLuint program = %u, GLsizei count = %d, const GLchar* const* varyings = 0x%0.8p, GLenum bufferMode = 0x%X)", |
| 6246 | program, count, varyings, bufferMode); |
| 6247 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6248 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6249 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6250 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6251 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6252 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6253 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6254 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6255 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6256 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6257 | if (count < 0) |
| 6258 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6259 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6260 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6261 | } |
| 6262 | |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6263 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6264 | switch (bufferMode) |
| 6265 | { |
| 6266 | case GL_INTERLEAVED_ATTRIBS: |
| 6267 | break; |
| 6268 | case GL_SEPARATE_ATTRIBS: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6269 | if (static_cast<GLuint>(count) > caps.maxTransformFeedbackSeparateAttributes) |
Geoff Lang | 48dcae7 | 2014-02-05 16:28:24 -0500 | [diff] [blame] | 6270 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6271 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6272 | return; |
Geoff Lang | 48dcae7 | 2014-02-05 16:28:24 -0500 | [diff] [blame] | 6273 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6274 | break; |
| 6275 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6276 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6277 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6278 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6279 | |
| 6280 | if (!gl::ValidProgram(context, program)) |
| 6281 | { |
| 6282 | return; |
| 6283 | } |
| 6284 | |
| 6285 | gl::Program *programObject = context->getProgram(program); |
| 6286 | ASSERT(programObject); |
| 6287 | |
| 6288 | programObject->setTransformFeedbackVaryings(count, varyings, bufferMode); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6289 | } |
| 6290 | } |
| 6291 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6292 | void GL_APIENTRY glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6293 | { |
| 6294 | EVENT("(GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, " |
| 6295 | "GLsizei* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)", |
| 6296 | program, index, bufSize, length, size, type, name); |
| 6297 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6298 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6299 | if (context) |
| 6300 | { |
| 6301 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6302 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6303 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6304 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6305 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6306 | |
| 6307 | if (bufSize < 0) |
| 6308 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6309 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6310 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6311 | } |
| 6312 | |
| 6313 | if (!gl::ValidProgram(context, program)) |
| 6314 | { |
| 6315 | return; |
| 6316 | } |
| 6317 | |
| 6318 | gl::Program *programObject = context->getProgram(program); |
| 6319 | ASSERT(programObject); |
| 6320 | |
| 6321 | if (index >= static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount())) |
| 6322 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6323 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6324 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6325 | } |
| 6326 | |
| 6327 | programObject->getTransformFeedbackVarying(index, bufSize, length, size, type, name); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6328 | } |
| 6329 | } |
| 6330 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6331 | void GL_APIENTRY glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6332 | { |
| 6333 | EVENT("(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid* pointer = 0x%0.8p)", |
| 6334 | index, size, type, stride, pointer); |
| 6335 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6336 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6337 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6338 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6339 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6340 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6341 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6342 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6343 | } |
| 6344 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6345 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6346 | { |
| 6347 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6348 | return; |
| 6349 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6350 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6351 | if (size < 1 || size > 4) |
| 6352 | { |
| 6353 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6354 | return; |
| 6355 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6356 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6357 | switch (type) |
| 6358 | { |
| 6359 | case GL_BYTE: |
| 6360 | case GL_UNSIGNED_BYTE: |
| 6361 | case GL_SHORT: |
| 6362 | case GL_UNSIGNED_SHORT: |
| 6363 | case GL_INT: |
| 6364 | case GL_UNSIGNED_INT: |
| 6365 | case GL_INT_2_10_10_10_REV: |
| 6366 | case GL_UNSIGNED_INT_2_10_10_10_REV: |
| 6367 | break; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6368 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6369 | default: |
| 6370 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6371 | return; |
| 6372 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6373 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6374 | if (stride < 0) |
| 6375 | { |
| 6376 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6377 | return; |
| 6378 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6379 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6380 | if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4) |
| 6381 | { |
| 6382 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6383 | return; |
| 6384 | } |
| 6385 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6386 | // [OpenGL ES 3.0.2] Section 2.8 page 24: |
| 6387 | // An INVALID_OPERATION error is generated when a non-zero vertex array object |
| 6388 | // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point, |
| 6389 | // and the pointer argument is not NULL. |
| 6390 | if (context->getState().getVertexArray()->id() != 0 && context->getState().getArrayBufferId() == 0 && pointer != NULL) |
shannon.woods%transgaming.com@gtempaccount.com | 1ab57be | 2013-04-13 03:38:39 +0000 | [diff] [blame] | 6391 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6392 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6393 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 1ab57be | 2013-04-13 03:38:39 +0000 | [diff] [blame] | 6394 | } |
| 6395 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6396 | context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type, false, true, |
| 6397 | stride, pointer); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6398 | } |
| 6399 | } |
| 6400 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6401 | void GL_APIENTRY glGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6402 | { |
| 6403 | EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 6404 | index, pname, params); |
| 6405 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6406 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6407 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6408 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6409 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6410 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6411 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6412 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6413 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6414 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6415 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6416 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6417 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6418 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6419 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6420 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6421 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6422 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6423 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6424 | { |
| 6425 | return; |
| 6426 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6427 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6428 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 6429 | { |
| 6430 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 6431 | for (int i = 0; i < 4; ++i) |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6432 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6433 | params[i] = currentValueData.IntValues[i]; |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6434 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6435 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6436 | else |
| 6437 | { |
| 6438 | *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname); |
| 6439 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6440 | } |
| 6441 | } |
| 6442 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6443 | void GL_APIENTRY glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6444 | { |
| 6445 | EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLuint* params = 0x%0.8p)", |
| 6446 | index, pname, params); |
| 6447 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6448 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6449 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6450 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6451 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6452 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6453 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6454 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6455 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6456 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6457 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6458 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6459 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6460 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6461 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6462 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6463 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6464 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6465 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6466 | { |
| 6467 | return; |
| 6468 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6469 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6470 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 6471 | { |
| 6472 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 6473 | for (int i = 0; i < 4; ++i) |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6474 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6475 | params[i] = currentValueData.UnsignedIntValues[i]; |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6476 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6477 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6478 | else |
| 6479 | { |
| 6480 | *params = gl::QuerySingleVertexAttributeParameter<GLuint>(attribState, pname); |
| 6481 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6482 | } |
| 6483 | } |
| 6484 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6485 | void GL_APIENTRY glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6486 | { |
| 6487 | EVENT("(GLuint index = %u, GLint x = %d, GLint y = %d, GLint z = %d, GLint w = %d)", |
| 6488 | index, x, y, z, w); |
| 6489 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6490 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6491 | if (context) |
| 6492 | { |
| 6493 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6494 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6495 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6496 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6497 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6498 | |
| 6499 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6500 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6501 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6502 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6503 | } |
| 6504 | |
| 6505 | GLint vals[4] = { x, y, z, w }; |
| 6506 | context->getState().setVertexAttribi(index, vals); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6507 | } |
| 6508 | } |
| 6509 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6510 | void GL_APIENTRY glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6511 | { |
| 6512 | EVENT("(GLuint index = %u, GLuint x = %u, GLuint y = %u, GLuint z = %u, GLuint w = %u)", |
| 6513 | index, x, y, z, w); |
| 6514 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6515 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6516 | if (context) |
| 6517 | { |
| 6518 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6519 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6520 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6521 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6522 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6523 | |
| 6524 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6525 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6526 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6527 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6528 | } |
| 6529 | |
| 6530 | GLuint vals[4] = { x, y, z, w }; |
| 6531 | context->getState().setVertexAttribu(index, vals); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6532 | } |
| 6533 | } |
| 6534 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6535 | void GL_APIENTRY glVertexAttribI4iv(GLuint index, const GLint* v) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6536 | { |
| 6537 | EVENT("(GLuint index = %u, const GLint* v = 0x%0.8p)", index, v); |
| 6538 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6539 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6540 | if (context) |
| 6541 | { |
| 6542 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6543 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6544 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6545 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6546 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6547 | |
| 6548 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6549 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6550 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6551 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6552 | } |
| 6553 | |
| 6554 | context->getState().setVertexAttribi(index, v); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6555 | } |
| 6556 | } |
| 6557 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6558 | void GL_APIENTRY glVertexAttribI4uiv(GLuint index, const GLuint* v) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6559 | { |
| 6560 | EVENT("(GLuint index = %u, const GLuint* v = 0x%0.8p)", index, v); |
| 6561 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6562 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6563 | if (context) |
| 6564 | { |
| 6565 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6566 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6567 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6568 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6569 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6570 | |
| 6571 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6572 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6573 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6574 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6575 | } |
| 6576 | |
| 6577 | context->getState().setVertexAttribu(index, v); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6578 | } |
| 6579 | } |
| 6580 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6581 | void GL_APIENTRY glGetUniformuiv(GLuint program, GLint location, GLuint* params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6582 | { |
| 6583 | EVENT("(GLuint program = %u, GLint location = %d, GLuint* params = 0x%0.8p)", |
| 6584 | program, location, params); |
| 6585 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6586 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6587 | if (context) |
| 6588 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 6589 | if (!ValidateGetUniformuiv(context, program, location, params)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6590 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 6591 | return; |
shannon.woods%transgaming.com@gtempaccount.com | e229012 | 2013-04-13 03:41:07 +0000 | [diff] [blame] | 6592 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6593 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 6594 | gl::Program *programObject = context->getProgram(program); |
| 6595 | ASSERT(programObject); |
| 6596 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 6597 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6598 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 6599 | programBinary->getUniformuiv(location, params); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6600 | } |
| 6601 | } |
| 6602 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6603 | GLint GL_APIENTRY glGetFragDataLocation(GLuint program, const GLchar *name) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6604 | { |
| 6605 | EVENT("(GLuint program = %u, const GLchar *name = 0x%0.8p)", |
| 6606 | program, name); |
| 6607 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6608 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6609 | if (context) |
| 6610 | { |
| 6611 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6612 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6613 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6614 | return -1; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6615 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6616 | |
| 6617 | if (program == 0) |
| 6618 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6619 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6620 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6621 | } |
| 6622 | |
| 6623 | gl::Program *programObject = context->getProgram(program); |
| 6624 | |
| 6625 | if (!programObject || !programObject->isLinked()) |
| 6626 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6627 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6628 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6629 | } |
| 6630 | |
| 6631 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 6632 | if (!programBinary) |
| 6633 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6634 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6635 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6636 | } |
| 6637 | |
| 6638 | return programBinary->getFragDataLocation(name); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6639 | } |
| 6640 | |
| 6641 | return 0; |
| 6642 | } |
| 6643 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6644 | void GL_APIENTRY glUniform1ui(GLint location, GLuint v0) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6645 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6646 | glUniform1uiv(location, 1, &v0); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6647 | } |
| 6648 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6649 | void GL_APIENTRY glUniform2ui(GLint location, GLuint v0, GLuint v1) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6650 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6651 | const GLuint xy[] = { v0, v1 }; |
| 6652 | glUniform2uiv(location, 1, xy); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6653 | } |
| 6654 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6655 | void GL_APIENTRY glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6656 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6657 | const GLuint xyz[] = { v0, v1, v2 }; |
| 6658 | glUniform3uiv(location, 1, xyz); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6659 | } |
| 6660 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6661 | void GL_APIENTRY glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6662 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6663 | const GLuint xyzw[] = { v0, v1, v2, v3 }; |
| 6664 | glUniform4uiv(location, 1, xyzw); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6665 | } |
| 6666 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6667 | void GL_APIENTRY glUniform1uiv(GLint location, GLsizei count, const GLuint* value) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6668 | { |
| 6669 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6670 | location, count, value); |
| 6671 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6672 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6673 | if (context) |
| 6674 | { |
| 6675 | if (!ValidateUniform(context, GL_UNSIGNED_INT, location, count)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6676 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6677 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6678 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6679 | |
| 6680 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6681 | programBinary->setUniform1uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6682 | } |
| 6683 | } |
| 6684 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6685 | void GL_APIENTRY glUniform2uiv(GLint location, GLsizei count, const GLuint* value) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6686 | { |
| 6687 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6688 | location, count, value); |
| 6689 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6690 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6691 | if (context) |
| 6692 | { |
| 6693 | if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC2, location, count)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6694 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6695 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6696 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6697 | |
| 6698 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6699 | programBinary->setUniform2uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6700 | } |
| 6701 | } |
| 6702 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6703 | void GL_APIENTRY glUniform3uiv(GLint location, GLsizei count, const GLuint* value) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6704 | { |
| 6705 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value)", |
| 6706 | location, count, value); |
| 6707 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6708 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6709 | if (context) |
| 6710 | { |
| 6711 | if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC3, location, count)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6712 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6713 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6714 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6715 | |
| 6716 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6717 | programBinary->setUniform3uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6718 | } |
| 6719 | } |
| 6720 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6721 | void GL_APIENTRY glUniform4uiv(GLint location, GLsizei count, const GLuint* value) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6722 | { |
| 6723 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6724 | location, count, value); |
| 6725 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6726 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6727 | if (context) |
| 6728 | { |
| 6729 | if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC4, location, count)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6730 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6731 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6732 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6733 | |
| 6734 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6735 | programBinary->setUniform4uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6736 | } |
| 6737 | } |
| 6738 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6739 | void GL_APIENTRY glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6740 | { |
| 6741 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint* value = 0x%0.8p)", |
| 6742 | buffer, drawbuffer, value); |
| 6743 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6744 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6745 | if (context) |
| 6746 | { |
| 6747 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6748 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6749 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6750 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6751 | |
| 6752 | switch (buffer) |
| 6753 | { |
| 6754 | case GL_COLOR: |
| 6755 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6756 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6757 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6758 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6759 | } |
| 6760 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6761 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6762 | case GL_STENCIL: |
| 6763 | if (drawbuffer != 0) |
| 6764 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6765 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6766 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6767 | } |
| 6768 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6769 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6770 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6771 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6772 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6773 | } |
| 6774 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6775 | gl::Error error = context->clearBufferiv(buffer, drawbuffer, value); |
| 6776 | if (error.isError()) |
| 6777 | { |
| 6778 | context->recordError(error); |
| 6779 | return; |
| 6780 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6781 | } |
| 6782 | } |
| 6783 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6784 | void GL_APIENTRY glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6785 | { |
| 6786 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint* value = 0x%0.8p)", |
| 6787 | buffer, drawbuffer, value); |
| 6788 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6789 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6790 | if (context) |
| 6791 | { |
| 6792 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6793 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6794 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6795 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6796 | |
| 6797 | switch (buffer) |
| 6798 | { |
| 6799 | case GL_COLOR: |
| 6800 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6801 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6802 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6803 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6804 | } |
| 6805 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6806 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6807 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6808 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6809 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6810 | } |
| 6811 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6812 | gl::Error error = context->clearBufferuiv(buffer, drawbuffer, value); |
| 6813 | if (error.isError()) |
| 6814 | { |
| 6815 | context->recordError(error); |
| 6816 | return; |
| 6817 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6818 | } |
| 6819 | } |
| 6820 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6821 | void GL_APIENTRY glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6822 | { |
| 6823 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat* value = 0x%0.8p)", |
| 6824 | buffer, drawbuffer, value); |
| 6825 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6826 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6827 | if (context) |
| 6828 | { |
| 6829 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6830 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6831 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6832 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6833 | |
| 6834 | switch (buffer) |
| 6835 | { |
| 6836 | case GL_COLOR: |
| 6837 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6838 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6839 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6840 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6841 | } |
| 6842 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6843 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6844 | case GL_DEPTH: |
| 6845 | if (drawbuffer != 0) |
| 6846 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6847 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6848 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6849 | } |
| 6850 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6851 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6852 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6853 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6854 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6855 | } |
| 6856 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6857 | gl::Error error = context->clearBufferfv(buffer, drawbuffer, value); |
| 6858 | if (error.isError()) |
| 6859 | { |
| 6860 | context->recordError(error); |
| 6861 | return; |
| 6862 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6863 | } |
| 6864 | } |
| 6865 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6866 | void GL_APIENTRY glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6867 | { |
| 6868 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth, GLint stencil = %d)", |
| 6869 | buffer, drawbuffer, depth, stencil); |
| 6870 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6871 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6872 | if (context) |
| 6873 | { |
| 6874 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6875 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6876 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6877 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6878 | |
| 6879 | switch (buffer) |
| 6880 | { |
| 6881 | case GL_DEPTH_STENCIL: |
| 6882 | if (drawbuffer != 0) |
| 6883 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6884 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6885 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6886 | } |
| 6887 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6888 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6889 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6890 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6891 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6892 | } |
| 6893 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6894 | gl::Error error = context->clearBufferfi(buffer, drawbuffer, depth, stencil); |
| 6895 | if (error.isError()) |
| 6896 | { |
| 6897 | context->recordError(error); |
| 6898 | return; |
| 6899 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6900 | } |
| 6901 | } |
| 6902 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6903 | const GLubyte* GL_APIENTRY glGetStringi(GLenum name, GLuint index) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6904 | { |
| 6905 | EVENT("(GLenum name = 0x%X, GLuint index = %u)", name, index); |
| 6906 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6907 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6908 | if (context) |
| 6909 | { |
| 6910 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6911 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6912 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6913 | return NULL; |
shannonwoods@chromium.org | 302df74 | 2013-05-30 00:05:54 +0000 | [diff] [blame] | 6914 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6915 | |
| 6916 | if (name != GL_EXTENSIONS) |
| 6917 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6918 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6919 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6920 | } |
| 6921 | |
| 6922 | if (index >= context->getExtensionStringCount()) |
| 6923 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6924 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6925 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6926 | } |
| 6927 | |
| 6928 | return reinterpret_cast<const GLubyte*>(context->getExtensionString(index).c_str()); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6929 | } |
| 6930 | |
| 6931 | return NULL; |
| 6932 | } |
| 6933 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6934 | void GL_APIENTRY glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6935 | { |
| 6936 | EVENT("(GLenum readTarget = 0x%X, GLenum writeTarget = 0x%X, GLintptr readOffset = %d, GLintptr writeOffset = %d, GLsizeiptr size = %d)", |
| 6937 | readTarget, writeTarget, readOffset, writeOffset, size); |
| 6938 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6939 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6940 | if (context) |
| 6941 | { |
| 6942 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6943 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6944 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6945 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 296c3f2 | 2013-04-13 03:39:39 +0000 | [diff] [blame] | 6946 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6947 | |
Jamie Madill | 24e8319 | 2014-10-20 11:00:53 -0400 | [diff] [blame] | 6948 | if (!gl::ValidBufferTarget(context, readTarget) || !gl::ValidBufferTarget(context, writeTarget)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6949 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6950 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6951 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6952 | } |
| 6953 | |
| 6954 | gl::Buffer *readBuffer = context->getState().getTargetBuffer(readTarget); |
| 6955 | gl::Buffer *writeBuffer = context->getState().getTargetBuffer(writeTarget); |
| 6956 | |
| 6957 | if (!readBuffer || !writeBuffer) |
| 6958 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6959 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6960 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6961 | } |
| 6962 | |
Jamie Madill | cfaaf72 | 2014-07-31 10:47:54 -0400 | [diff] [blame] | 6963 | // Verify that readBuffer and writeBuffer are not currently mapped |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6964 | if (readBuffer->isMapped() || writeBuffer->isMapped()) |
| 6965 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6966 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6967 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6968 | } |
| 6969 | |
| 6970 | if (readOffset < 0 || writeOffset < 0 || size < 0 || |
| 6971 | static_cast<unsigned int>(readOffset + size) > readBuffer->getSize() || |
| 6972 | static_cast<unsigned int>(writeOffset + size) > writeBuffer->getSize()) |
| 6973 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6974 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6975 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6976 | } |
| 6977 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6978 | if (readBuffer == writeBuffer && std::abs(readOffset - writeOffset) < size) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6979 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6980 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6981 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6982 | } |
| 6983 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6984 | // if size is zero, the copy is a successful no-op |
| 6985 | if (size > 0) |
| 6986 | { |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 6987 | gl::Error error = writeBuffer->copyBufferSubData(readBuffer, readOffset, writeOffset, size); |
| 6988 | if (error.isError()) |
| 6989 | { |
| 6990 | context->recordError(error); |
| 6991 | return; |
| 6992 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6993 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6994 | } |
| 6995 | } |
| 6996 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6997 | void GL_APIENTRY glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6998 | { |
| 6999 | EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLchar* const* uniformNames = 0x%0.8p, GLuint* uniformIndices = 0x%0.8p)", |
| 7000 | program, uniformCount, uniformNames, uniformIndices); |
| 7001 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7002 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7003 | if (context) |
| 7004 | { |
| 7005 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7006 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7007 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7008 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7009 | } |
| 7010 | |
| 7011 | if (uniformCount < 0) |
| 7012 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7013 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7014 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7015 | } |
| 7016 | |
| 7017 | gl::Program *programObject = context->getProgram(program); |
| 7018 | |
| 7019 | if (!programObject) |
| 7020 | { |
| 7021 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7022 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7023 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7024 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7025 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7026 | else |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7027 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7028 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7029 | return; |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7030 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7031 | } |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7032 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7033 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7034 | if (!programObject->isLinked() || !programBinary) |
| 7035 | { |
| 7036 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7037 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7038 | uniformIndices[uniformId] = GL_INVALID_INDEX; |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7039 | } |
| 7040 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7041 | else |
| 7042 | { |
| 7043 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 7044 | { |
| 7045 | uniformIndices[uniformId] = programBinary->getUniformIndex(uniformNames[uniformId]); |
| 7046 | } |
| 7047 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7048 | } |
| 7049 | } |
| 7050 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7051 | void GL_APIENTRY glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7052 | { |
| 7053 | EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLuint* uniformIndices = 0x%0.8p, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 7054 | program, uniformCount, uniformIndices, pname, params); |
| 7055 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7056 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7057 | if (context) |
| 7058 | { |
| 7059 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7060 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7061 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7062 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7063 | } |
| 7064 | |
| 7065 | if (uniformCount < 0) |
| 7066 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7067 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7068 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7069 | } |
| 7070 | |
| 7071 | gl::Program *programObject = context->getProgram(program); |
| 7072 | |
| 7073 | if (!programObject) |
| 7074 | { |
| 7075 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7076 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7077 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7078 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7079 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7080 | else |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 7081 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7082 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7083 | return; |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 7084 | } |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 7085 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7086 | |
| 7087 | switch (pname) |
| 7088 | { |
| 7089 | case GL_UNIFORM_TYPE: |
| 7090 | case GL_UNIFORM_SIZE: |
| 7091 | case GL_UNIFORM_NAME_LENGTH: |
| 7092 | case GL_UNIFORM_BLOCK_INDEX: |
| 7093 | case GL_UNIFORM_OFFSET: |
| 7094 | case GL_UNIFORM_ARRAY_STRIDE: |
| 7095 | case GL_UNIFORM_MATRIX_STRIDE: |
| 7096 | case GL_UNIFORM_IS_ROW_MAJOR: |
| 7097 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7098 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7099 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7100 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7101 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7102 | } |
| 7103 | |
| 7104 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7105 | |
| 7106 | if (!programBinary && uniformCount > 0) |
| 7107 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7108 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7109 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7110 | } |
| 7111 | |
| 7112 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 7113 | { |
| 7114 | const GLuint index = uniformIndices[uniformId]; |
| 7115 | |
| 7116 | if (index >= (GLuint)programBinary->getActiveUniformCount()) |
| 7117 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7118 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7119 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7120 | } |
| 7121 | } |
| 7122 | |
| 7123 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 7124 | { |
| 7125 | const GLuint index = uniformIndices[uniformId]; |
| 7126 | params[uniformId] = programBinary->getActiveUniformi(index, pname); |
| 7127 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7128 | } |
| 7129 | } |
| 7130 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7131 | GLuint GL_APIENTRY glGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7132 | { |
| 7133 | EVENT("(GLuint program = %u, const GLchar* uniformBlockName = 0x%0.8p)", program, uniformBlockName); |
| 7134 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7135 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7136 | if (context) |
| 7137 | { |
| 7138 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7139 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7140 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7141 | return GL_INVALID_INDEX; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7142 | } |
| 7143 | |
| 7144 | gl::Program *programObject = context->getProgram(program); |
| 7145 | |
| 7146 | if (!programObject) |
| 7147 | { |
| 7148 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7149 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7150 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7151 | return GL_INVALID_INDEX; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7152 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7153 | else |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 7154 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7155 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7156 | return GL_INVALID_INDEX; |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 7157 | } |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 7158 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7159 | |
| 7160 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7161 | if (!programBinary) |
| 7162 | { |
| 7163 | return GL_INVALID_INDEX; |
| 7164 | } |
| 7165 | |
| 7166 | return programBinary->getUniformBlockIndex(uniformBlockName); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7167 | } |
| 7168 | |
| 7169 | return 0; |
| 7170 | } |
| 7171 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7172 | void GL_APIENTRY glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7173 | { |
| 7174 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 7175 | program, uniformBlockIndex, pname, params); |
| 7176 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7177 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7178 | if (context) |
| 7179 | { |
| 7180 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7181 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7182 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7183 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7184 | } |
| 7185 | gl::Program *programObject = context->getProgram(program); |
| 7186 | |
| 7187 | if (!programObject) |
| 7188 | { |
| 7189 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7190 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7191 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7192 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7193 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7194 | else |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 7195 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7196 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7197 | return; |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 7198 | } |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 7199 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7200 | |
| 7201 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7202 | |
| 7203 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 7204 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7205 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7206 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7207 | } |
| 7208 | |
| 7209 | switch (pname) |
| 7210 | { |
| 7211 | case GL_UNIFORM_BLOCK_BINDING: |
| 7212 | *params = static_cast<GLint>(programObject->getUniformBlockBinding(uniformBlockIndex)); |
| 7213 | break; |
| 7214 | |
| 7215 | case GL_UNIFORM_BLOCK_DATA_SIZE: |
| 7216 | case GL_UNIFORM_BLOCK_NAME_LENGTH: |
| 7217 | case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS: |
| 7218 | case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: |
| 7219 | case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: |
| 7220 | case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: |
| 7221 | programBinary->getActiveUniformBlockiv(uniformBlockIndex, pname, params); |
| 7222 | break; |
| 7223 | |
| 7224 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7225 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7226 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7227 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7228 | } |
| 7229 | } |
| 7230 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7231 | void GL_APIENTRY glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7232 | { |
| 7233 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLchar* uniformBlockName = 0x%0.8p)", |
| 7234 | program, uniformBlockIndex, bufSize, length, uniformBlockName); |
| 7235 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7236 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7237 | if (context) |
| 7238 | { |
| 7239 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7240 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7241 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7242 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7243 | } |
| 7244 | |
| 7245 | gl::Program *programObject = context->getProgram(program); |
| 7246 | |
| 7247 | if (!programObject) |
| 7248 | { |
| 7249 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7250 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7251 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7252 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7253 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7254 | else |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 7255 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7256 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7257 | return; |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 7258 | } |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 7259 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7260 | |
| 7261 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7262 | |
| 7263 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 7264 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7265 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7266 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7267 | } |
| 7268 | |
| 7269 | programBinary->getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7270 | } |
| 7271 | } |
| 7272 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7273 | void GL_APIENTRY glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7274 | { |
| 7275 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLuint uniformBlockBinding = %u)", |
| 7276 | program, uniformBlockIndex, uniformBlockBinding); |
| 7277 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7278 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7279 | if (context) |
| 7280 | { |
| 7281 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7282 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7283 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7284 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7285 | } |
| 7286 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7287 | if (uniformBlockBinding >= context->getCaps().maxUniformBufferBindings) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7288 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7289 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7290 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7291 | } |
| 7292 | |
| 7293 | gl::Program *programObject = context->getProgram(program); |
| 7294 | |
| 7295 | if (!programObject) |
| 7296 | { |
| 7297 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7298 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7299 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7300 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7301 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7302 | else |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 7303 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7304 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7305 | return; |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 7306 | } |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 7307 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7308 | |
| 7309 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7310 | |
| 7311 | // if never linked, there won't be any uniform blocks |
| 7312 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 7313 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7314 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7315 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7316 | } |
| 7317 | |
| 7318 | programObject->bindUniformBlock(uniformBlockIndex, uniformBlockBinding); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7319 | } |
| 7320 | } |
| 7321 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7322 | void GL_APIENTRY glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7323 | { |
| 7324 | EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei instanceCount = %d)", |
| 7325 | mode, first, count, instanceCount); |
| 7326 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7327 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7328 | if (context) |
| 7329 | { |
| 7330 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7331 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7332 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7333 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7334 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7335 | |
| 7336 | // glDrawArraysInstanced |
| 7337 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7338 | } |
| 7339 | } |
| 7340 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7341 | void GL_APIENTRY glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7342 | { |
| 7343 | EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei instanceCount = %d)", |
| 7344 | mode, count, type, indices, instanceCount); |
| 7345 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7346 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7347 | if (context) |
| 7348 | { |
| 7349 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7350 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7351 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7352 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7353 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7354 | |
| 7355 | // glDrawElementsInstanced |
| 7356 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7357 | } |
| 7358 | } |
| 7359 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7360 | GLsync GL_APIENTRY glFenceSync(GLenum condition, GLbitfield flags) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7361 | { |
| 7362 | EVENT("(GLenum condition = 0x%X, GLbitfield flags = 0x%X)", condition, flags); |
| 7363 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7364 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7365 | if (context) |
| 7366 | { |
| 7367 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7368 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7369 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7370 | return 0; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7371 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7372 | |
| 7373 | if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) |
| 7374 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7375 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7376 | return 0; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7377 | } |
| 7378 | |
| 7379 | if (flags != 0) |
| 7380 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7381 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7382 | return 0; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7383 | } |
| 7384 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7385 | GLsync fenceSync = context->createFenceSync(); |
| 7386 | |
| 7387 | gl::FenceSync *fenceSyncObject = context->getFenceSync(fenceSync); |
| 7388 | gl::Error error = fenceSyncObject->set(condition); |
| 7389 | if (error.isError()) |
| 7390 | { |
| 7391 | context->deleteFenceSync(fenceSync); |
| 7392 | context->recordError(error); |
| 7393 | return NULL; |
| 7394 | } |
| 7395 | |
| 7396 | return fenceSync; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7397 | } |
| 7398 | |
| 7399 | return NULL; |
| 7400 | } |
| 7401 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7402 | GLboolean GL_APIENTRY glIsSync(GLsync sync) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7403 | { |
| 7404 | EVENT("(GLsync sync = 0x%0.8p)", sync); |
| 7405 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7406 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7407 | if (context) |
| 7408 | { |
| 7409 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7410 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7411 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7412 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7413 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7414 | |
| 7415 | return (context->getFenceSync(sync) != NULL); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7416 | } |
| 7417 | |
| 7418 | return GL_FALSE; |
| 7419 | } |
| 7420 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7421 | void GL_APIENTRY glDeleteSync(GLsync sync) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7422 | { |
| 7423 | EVENT("(GLsync sync = 0x%0.8p)", sync); |
| 7424 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7425 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7426 | if (context) |
| 7427 | { |
| 7428 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7429 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7430 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7431 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7432 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7433 | |
| 7434 | if (sync != static_cast<GLsync>(0) && !context->getFenceSync(sync)) |
| 7435 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7436 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7437 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7438 | } |
| 7439 | |
| 7440 | context->deleteFenceSync(sync); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7441 | } |
| 7442 | } |
| 7443 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7444 | GLenum GL_APIENTRY glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7445 | { |
| 7446 | EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", |
| 7447 | sync, flags, timeout); |
| 7448 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7449 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7450 | if (context) |
| 7451 | { |
| 7452 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7453 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7454 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7455 | return GL_WAIT_FAILED; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7456 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7457 | |
| 7458 | if ((flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0) |
| 7459 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7460 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7461 | return GL_WAIT_FAILED; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7462 | } |
| 7463 | |
| 7464 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7465 | |
| 7466 | if (!fenceSync) |
| 7467 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7468 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7469 | return GL_WAIT_FAILED; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7470 | } |
| 7471 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7472 | GLenum result = GL_WAIT_FAILED; |
| 7473 | gl::Error error = fenceSync->clientWait(flags, timeout, &result); |
| 7474 | if (error.isError()) |
| 7475 | { |
| 7476 | context->recordError(error); |
| 7477 | return GL_WAIT_FAILED; |
| 7478 | } |
| 7479 | |
| 7480 | return result; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7481 | } |
| 7482 | |
| 7483 | return GL_FALSE; |
| 7484 | } |
| 7485 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7486 | void GL_APIENTRY glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7487 | { |
| 7488 | EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", |
| 7489 | sync, flags, timeout); |
| 7490 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7491 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7492 | if (context) |
| 7493 | { |
| 7494 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7495 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7496 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7497 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7498 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7499 | |
| 7500 | if (flags != 0) |
| 7501 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7502 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7503 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7504 | } |
| 7505 | |
| 7506 | if (timeout != GL_TIMEOUT_IGNORED) |
| 7507 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7508 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7509 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7510 | } |
| 7511 | |
| 7512 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7513 | |
| 7514 | if (!fenceSync) |
| 7515 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7516 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7517 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7518 | } |
| 7519 | |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 7520 | gl::Error error = fenceSync->serverWait(flags, timeout); |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7521 | if (error.isError()) |
| 7522 | { |
| 7523 | context->recordError(error); |
| 7524 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7525 | } |
| 7526 | } |
| 7527 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7528 | void GL_APIENTRY glGetInteger64v(GLenum pname, GLint64* params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7529 | { |
| 7530 | EVENT("(GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", |
| 7531 | pname, params); |
| 7532 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7533 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7534 | if (context) |
| 7535 | { |
| 7536 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7537 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7538 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7539 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7540 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7541 | |
| 7542 | GLenum nativeType; |
| 7543 | unsigned int numParams = 0; |
| 7544 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
| 7545 | { |
| 7546 | return; |
| 7547 | } |
| 7548 | |
| 7549 | if (nativeType == GL_INT_64_ANGLEX) |
| 7550 | { |
| 7551 | context->getInteger64v(pname, params); |
| 7552 | } |
| 7553 | else |
| 7554 | { |
| 7555 | CastStateValues(context, nativeType, pname, numParams, params); |
| 7556 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7557 | } |
| 7558 | } |
| 7559 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7560 | void GL_APIENTRY glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7561 | { |
| 7562 | EVENT("(GLsync sync = 0x%0.8p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLint* values = 0x%0.8p)", |
| 7563 | sync, pname, bufSize, length, values); |
| 7564 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7565 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7566 | if (context) |
| 7567 | { |
| 7568 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7569 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7570 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7571 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7572 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7573 | |
| 7574 | if (bufSize < 0) |
| 7575 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7576 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7577 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7578 | } |
| 7579 | |
| 7580 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7581 | |
| 7582 | if (!fenceSync) |
| 7583 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7584 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7585 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7586 | } |
| 7587 | |
| 7588 | switch (pname) |
| 7589 | { |
| 7590 | case GL_OBJECT_TYPE: values[0] = static_cast<GLint>(GL_SYNC_FENCE); break; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7591 | case GL_SYNC_CONDITION: values[0] = static_cast<GLint>(fenceSync->getCondition()); break; |
| 7592 | case GL_SYNC_FLAGS: values[0] = 0; break; |
| 7593 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7594 | case GL_SYNC_STATUS: |
| 7595 | { |
| 7596 | gl::Error error = fenceSync->getStatus(values); |
| 7597 | if (error.isError()) |
| 7598 | { |
| 7599 | context->recordError(error); |
| 7600 | return; |
| 7601 | } |
| 7602 | break; |
| 7603 | } |
| 7604 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7605 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7606 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7607 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7608 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7609 | } |
| 7610 | } |
| 7611 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7612 | void GL_APIENTRY glGetInteger64i_v(GLenum target, GLuint index, GLint64* data) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7613 | { |
| 7614 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint64* data = 0x%0.8p)", |
| 7615 | target, index, data); |
| 7616 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7617 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7618 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7619 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7620 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7621 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7622 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7623 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7624 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7625 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7626 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7627 | switch (target) |
| 7628 | { |
| 7629 | case GL_TRANSFORM_FEEDBACK_BUFFER_START: |
| 7630 | case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: |
| 7631 | case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 7632 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
| 7633 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7634 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7635 | return; |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 7636 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7637 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7638 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7639 | case GL_UNIFORM_BUFFER_START: |
| 7640 | case GL_UNIFORM_BUFFER_SIZE: |
| 7641 | case GL_UNIFORM_BUFFER_BINDING: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7642 | if (index >= caps.maxUniformBufferBindings) |
| 7643 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7644 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7645 | return; |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7646 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7647 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7648 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7649 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7650 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7651 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7652 | } |
| 7653 | |
| 7654 | if (!(context->getIndexedInteger64v(target, index, data))) |
| 7655 | { |
| 7656 | GLenum nativeType; |
| 7657 | unsigned int numParams = 0; |
| 7658 | if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams)) |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7659 | { |
| 7660 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7661 | return; |
| 7662 | } |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7663 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7664 | if (numParams == 0) |
| 7665 | return; // it is known that pname is valid, but there are no parameters to return |
| 7666 | |
| 7667 | if (nativeType == GL_INT) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7668 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7669 | GLint *intParams = new GLint[numParams]; |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7670 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7671 | context->getIndexedIntegerv(target, index, intParams); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7672 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7673 | for (unsigned int i = 0; i < numParams; ++i) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7674 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7675 | data[i] = static_cast<GLint64>(intParams[i]); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7676 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7677 | |
| 7678 | delete [] intParams; |
| 7679 | } |
| 7680 | else |
| 7681 | { |
| 7682 | UNREACHABLE(); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7683 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7684 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7685 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7686 | } |
| 7687 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7688 | void GL_APIENTRY glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7689 | { |
| 7690 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", |
| 7691 | target, pname, params); |
| 7692 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7693 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7694 | if (context) |
| 7695 | { |
| 7696 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7697 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7698 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7699 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7700 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7701 | |
| 7702 | if (!gl::ValidBufferTarget(context, target)) |
| 7703 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7704 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7705 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7706 | } |
| 7707 | |
| 7708 | if (!gl::ValidBufferParameter(context, pname)) |
| 7709 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7710 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7711 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7712 | } |
| 7713 | |
| 7714 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 7715 | |
| 7716 | if (!buffer) |
| 7717 | { |
| 7718 | // A null buffer means that "0" is bound to the requested buffer target |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7719 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7720 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7721 | } |
| 7722 | |
| 7723 | switch (pname) |
| 7724 | { |
| 7725 | case GL_BUFFER_USAGE: |
| 7726 | *params = static_cast<GLint64>(buffer->getUsage()); |
| 7727 | break; |
| 7728 | case GL_BUFFER_SIZE: |
| 7729 | *params = buffer->getSize(); |
| 7730 | break; |
| 7731 | case GL_BUFFER_ACCESS_FLAGS: |
| 7732 | *params = static_cast<GLint64>(buffer->getAccessFlags()); |
| 7733 | break; |
| 7734 | case GL_BUFFER_MAPPED: |
| 7735 | *params = static_cast<GLint64>(buffer->isMapped()); |
| 7736 | break; |
| 7737 | case GL_BUFFER_MAP_OFFSET: |
| 7738 | *params = buffer->getMapOffset(); |
| 7739 | break; |
| 7740 | case GL_BUFFER_MAP_LENGTH: |
| 7741 | *params = buffer->getMapLength(); |
| 7742 | break; |
| 7743 | default: UNREACHABLE(); break; |
| 7744 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7745 | } |
| 7746 | } |
| 7747 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7748 | void GL_APIENTRY glGenSamplers(GLsizei count, GLuint* samplers) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7749 | { |
| 7750 | EVENT("(GLsizei count = %d, GLuint* samplers = 0x%0.8p)", count, samplers); |
| 7751 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7752 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7753 | if (context) |
| 7754 | { |
| 7755 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7756 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7757 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7758 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7759 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7760 | |
| 7761 | if (count < 0) |
| 7762 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7763 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7764 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7765 | } |
| 7766 | |
| 7767 | for (int i = 0; i < count; i++) |
| 7768 | { |
| 7769 | samplers[i] = context->createSampler(); |
| 7770 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7771 | } |
| 7772 | } |
| 7773 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7774 | void GL_APIENTRY glDeleteSamplers(GLsizei count, const GLuint* samplers) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7775 | { |
| 7776 | EVENT("(GLsizei count = %d, const GLuint* samplers = 0x%0.8p)", count, samplers); |
| 7777 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7778 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7779 | if (context) |
| 7780 | { |
| 7781 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7782 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7783 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7784 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7785 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7786 | |
| 7787 | if (count < 0) |
| 7788 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7789 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7790 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7791 | } |
| 7792 | |
| 7793 | for (int i = 0; i < count; i++) |
| 7794 | { |
| 7795 | context->deleteSampler(samplers[i]); |
| 7796 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7797 | } |
| 7798 | } |
| 7799 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7800 | GLboolean GL_APIENTRY glIsSampler(GLuint sampler) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7801 | { |
| 7802 | EVENT("(GLuint sampler = %u)", sampler); |
| 7803 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7804 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7805 | if (context) |
| 7806 | { |
| 7807 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7808 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7809 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7810 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7811 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7812 | |
| 7813 | return context->isSampler(sampler); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7814 | } |
| 7815 | |
| 7816 | return GL_FALSE; |
| 7817 | } |
| 7818 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7819 | void GL_APIENTRY glBindSampler(GLuint unit, GLuint sampler) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7820 | { |
| 7821 | EVENT("(GLuint unit = %u, GLuint sampler = %u)", unit, sampler); |
| 7822 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7823 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7824 | if (context) |
| 7825 | { |
| 7826 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7827 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7828 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7829 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7830 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7831 | |
| 7832 | if (sampler != 0 && !context->isSampler(sampler)) |
| 7833 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7834 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7835 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7836 | } |
| 7837 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7838 | if (unit >= context->getCaps().maxCombinedTextureImageUnits) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7839 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7840 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7841 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7842 | } |
| 7843 | |
| 7844 | context->bindSampler(unit, sampler); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7845 | } |
| 7846 | } |
| 7847 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7848 | void GL_APIENTRY glSamplerParameteri(GLuint sampler, GLenum pname, GLint param) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7849 | { |
| 7850 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint param = %d)", sampler, pname, param); |
| 7851 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7852 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7853 | if (context) |
| 7854 | { |
| 7855 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7856 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7857 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7858 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7859 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7860 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7861 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7862 | { |
| 7863 | return; |
| 7864 | } |
| 7865 | |
| 7866 | if (!gl::ValidateTexParamParameters(context, pname, param)) |
| 7867 | { |
| 7868 | return; |
| 7869 | } |
| 7870 | |
| 7871 | if (!context->isSampler(sampler)) |
| 7872 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7873 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7874 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7875 | } |
| 7876 | |
| 7877 | context->samplerParameteri(sampler, pname, param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7878 | } |
| 7879 | } |
| 7880 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7881 | void GL_APIENTRY glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7882 | { |
Jamie Madill | f6cc8cc | 2013-07-03 12:44:15 -0400 | [diff] [blame] | 7883 | glSamplerParameteri(sampler, pname, *param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7884 | } |
| 7885 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7886 | void GL_APIENTRY glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7887 | { |
| 7888 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat param = %g)", sampler, pname, param); |
| 7889 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7890 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7891 | if (context) |
| 7892 | { |
| 7893 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7894 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7895 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7896 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7897 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7898 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7899 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7900 | { |
| 7901 | return; |
| 7902 | } |
| 7903 | |
| 7904 | if (!gl::ValidateTexParamParameters(context, pname, static_cast<GLint>(param))) |
| 7905 | { |
| 7906 | return; |
| 7907 | } |
| 7908 | |
| 7909 | if (!context->isSampler(sampler)) |
| 7910 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7911 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7912 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7913 | } |
| 7914 | |
| 7915 | context->samplerParameterf(sampler, pname, param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7916 | } |
| 7917 | } |
| 7918 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7919 | void GL_APIENTRY glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7920 | { |
Jamie Madill | f6cc8cc | 2013-07-03 12:44:15 -0400 | [diff] [blame] | 7921 | glSamplerParameterf(sampler, pname, *param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7922 | } |
| 7923 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7924 | void GL_APIENTRY glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7925 | { |
| 7926 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", sampler, pname, params); |
| 7927 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7928 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7929 | if (context) |
| 7930 | { |
| 7931 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7932 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7933 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7934 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7935 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7936 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7937 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7938 | { |
| 7939 | return; |
| 7940 | } |
| 7941 | |
| 7942 | if (!context->isSampler(sampler)) |
| 7943 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7944 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7945 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7946 | } |
| 7947 | |
| 7948 | *params = context->getSamplerParameteri(sampler, pname); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7949 | } |
| 7950 | } |
| 7951 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7952 | void GL_APIENTRY glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7953 | { |
| 7954 | EVENT("(GLuint sample = %ur, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", sampler, pname, params); |
| 7955 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7956 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7957 | if (context) |
| 7958 | { |
| 7959 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7960 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7961 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7962 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7963 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7964 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7965 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7966 | { |
| 7967 | return; |
| 7968 | } |
| 7969 | |
| 7970 | if (!context->isSampler(sampler)) |
| 7971 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7972 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7973 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7974 | } |
| 7975 | |
| 7976 | *params = context->getSamplerParameterf(sampler, pname); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7977 | } |
| 7978 | } |
| 7979 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7980 | void GL_APIENTRY glVertexAttribDivisor(GLuint index, GLuint divisor) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7981 | { |
| 7982 | EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor); |
| 7983 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7984 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7985 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7986 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7987 | if (context->getClientVersion() < 3) |
| 7988 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7989 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7990 | return; |
| 7991 | } |
| 7992 | |
| 7993 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 7994 | { |
| 7995 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7996 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7997 | } |
| 7998 | |
| 7999 | context->setVertexAttribDivisor(index, divisor); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8000 | } |
| 8001 | } |
| 8002 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8003 | void GL_APIENTRY glBindTransformFeedback(GLenum target, GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8004 | { |
| 8005 | EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id); |
| 8006 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8007 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8008 | if (context) |
| 8009 | { |
| 8010 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8011 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8012 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8013 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8014 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8015 | |
| 8016 | switch (target) |
| 8017 | { |
| 8018 | case GL_TRANSFORM_FEEDBACK: |
| 8019 | { |
| 8020 | // Cannot bind a transform feedback object if the current one is started and not paused (3.0.2 pg 85 section 2.14.1) |
| 8021 | gl::TransformFeedback *curTransformFeedback = context->getState().getCurrentTransformFeedback(); |
| 8022 | if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused()) |
| 8023 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8024 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8025 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8026 | } |
| 8027 | |
| 8028 | // Cannot bind a transform feedback object that does not exist (3.0.2 pg 85 section 2.14.1) |
| 8029 | if (context->getTransformFeedback(id) == NULL) |
| 8030 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8031 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8032 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8033 | } |
| 8034 | |
| 8035 | context->bindTransformFeedback(id); |
| 8036 | } |
| 8037 | break; |
| 8038 | |
| 8039 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8040 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8041 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8042 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8043 | } |
| 8044 | } |
| 8045 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8046 | void GL_APIENTRY glDeleteTransformFeedbacks(GLsizei n, const GLuint* ids) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8047 | { |
| 8048 | EVENT("(GLsizei n = %d, const GLuint* ids = 0x%0.8p)", n, ids); |
| 8049 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8050 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8051 | if (context) |
| 8052 | { |
| 8053 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8054 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8055 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8056 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8057 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8058 | |
| 8059 | for (int i = 0; i < n; i++) |
| 8060 | { |
| 8061 | context->deleteTransformFeedback(ids[i]); |
| 8062 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8063 | } |
| 8064 | } |
| 8065 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8066 | void GL_APIENTRY glGenTransformFeedbacks(GLsizei n, GLuint* ids) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8067 | { |
| 8068 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 8069 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8070 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8071 | if (context) |
| 8072 | { |
| 8073 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8074 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8075 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8076 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8077 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8078 | |
| 8079 | for (int i = 0; i < n; i++) |
| 8080 | { |
| 8081 | ids[i] = context->createTransformFeedback(); |
| 8082 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8083 | } |
| 8084 | } |
| 8085 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8086 | GLboolean GL_APIENTRY glIsTransformFeedback(GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8087 | { |
| 8088 | EVENT("(GLuint id = %u)", id); |
| 8089 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8090 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8091 | if (context) |
| 8092 | { |
| 8093 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8094 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8095 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8096 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8097 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8098 | |
| 8099 | return ((context->getTransformFeedback(id) != NULL) ? GL_TRUE : GL_FALSE); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8100 | } |
| 8101 | |
| 8102 | return GL_FALSE; |
| 8103 | } |
| 8104 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8105 | void GL_APIENTRY glPauseTransformFeedback(void) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8106 | { |
| 8107 | EVENT("(void)"); |
| 8108 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8109 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8110 | if (context) |
| 8111 | { |
| 8112 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8113 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8114 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8115 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8116 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8117 | |
| 8118 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 8119 | ASSERT(transformFeedback != NULL); |
| 8120 | |
| 8121 | // Current transform feedback must be started and not paused in order to pause (3.0.2 pg 86) |
| 8122 | if (!transformFeedback->isStarted() || transformFeedback->isPaused()) |
| 8123 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8124 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8125 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8126 | } |
| 8127 | |
| 8128 | transformFeedback->pause(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8129 | } |
| 8130 | } |
| 8131 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8132 | void GL_APIENTRY glResumeTransformFeedback(void) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8133 | { |
| 8134 | EVENT("(void)"); |
| 8135 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8136 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8137 | if (context) |
| 8138 | { |
| 8139 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8140 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8141 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8142 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8143 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8144 | |
| 8145 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 8146 | ASSERT(transformFeedback != NULL); |
| 8147 | |
| 8148 | // Current transform feedback must be started and paused in order to resume (3.0.2 pg 86) |
| 8149 | if (!transformFeedback->isStarted() || !transformFeedback->isPaused()) |
| 8150 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8151 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8152 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8153 | } |
| 8154 | |
| 8155 | transformFeedback->resume(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8156 | } |
| 8157 | } |
| 8158 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8159 | void GL_APIENTRY glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8160 | { |
| 8161 | EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLenum* binaryFormat = 0x%0.8p, GLvoid* binary = 0x%0.8p)", |
| 8162 | program, bufSize, length, binaryFormat, binary); |
| 8163 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8164 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8165 | if (context) |
| 8166 | { |
| 8167 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8168 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8169 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8170 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8171 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8172 | |
| 8173 | // glGetProgramBinary |
| 8174 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8175 | } |
| 8176 | } |
| 8177 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8178 | void GL_APIENTRY glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8179 | { |
| 8180 | EVENT("(GLuint program = %u, GLenum binaryFormat = 0x%X, const GLvoid* binary = 0x%0.8p, GLsizei length = %d)", |
| 8181 | program, binaryFormat, binary, length); |
| 8182 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8183 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8184 | if (context) |
| 8185 | { |
| 8186 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8187 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8188 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8189 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8190 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8191 | |
| 8192 | // glProgramBinary |
| 8193 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8194 | } |
| 8195 | } |
| 8196 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8197 | void GL_APIENTRY glProgramParameteri(GLuint program, GLenum pname, GLint value) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8198 | { |
| 8199 | EVENT("(GLuint program = %u, GLenum pname = 0x%X, GLint value = %d)", |
| 8200 | program, pname, value); |
| 8201 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8202 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8203 | if (context) |
| 8204 | { |
| 8205 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8206 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8207 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8208 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8209 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8210 | |
| 8211 | // glProgramParameteri |
| 8212 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8213 | } |
| 8214 | } |
| 8215 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8216 | void GL_APIENTRY glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8217 | { |
| 8218 | EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p)", |
| 8219 | target, numAttachments, attachments); |
| 8220 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8221 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8222 | if (context) |
| 8223 | { |
| 8224 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8225 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8226 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8227 | return; |
shannonwoods@chromium.org | d63ef89 | 2013-05-30 00:10:56 +0000 | [diff] [blame] | 8228 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8229 | |
| 8230 | if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments)) |
| 8231 | { |
| 8232 | return; |
| 8233 | } |
| 8234 | |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8235 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 8236 | ASSERT(framebuffer); |
| 8237 | |
| 8238 | if (framebuffer->completeness(context->getData()) == GL_FRAMEBUFFER_COMPLETE) |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8239 | { |
Geoff Lang | 64f23f6 | 2014-09-10 14:40:12 -0400 | [diff] [blame] | 8240 | gl::Error error = framebuffer->invalidate(context->getCaps(), numAttachments, attachments); |
| 8241 | if (error.isError()) |
| 8242 | { |
| 8243 | context->recordError(error); |
| 8244 | return; |
| 8245 | } |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8246 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8247 | } |
| 8248 | } |
| 8249 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8250 | void GL_APIENTRY glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8251 | { |
| 8252 | EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p, GLint x = %d, " |
| 8253 | "GLint y = %d, GLsizei width = %d, GLsizei height = %d)", |
| 8254 | target, numAttachments, attachments, x, y, width, height); |
| 8255 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8256 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8257 | if (context) |
| 8258 | { |
| 8259 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8260 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8261 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8262 | return; |
shannonwoods@chromium.org | d63ef89 | 2013-05-30 00:10:56 +0000 | [diff] [blame] | 8263 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8264 | |
| 8265 | if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments)) |
| 8266 | { |
| 8267 | return; |
| 8268 | } |
| 8269 | |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8270 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 8271 | ASSERT(framebuffer); |
| 8272 | |
| 8273 | if (framebuffer->completeness(context->getData()) == GL_FRAMEBUFFER_COMPLETE) |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8274 | { |
Geoff Lang | 64f23f6 | 2014-09-10 14:40:12 -0400 | [diff] [blame] | 8275 | gl::Error error = framebuffer->invalidateSub(numAttachments, attachments, x, y, width, height); |
| 8276 | if (error.isError()) |
| 8277 | { |
| 8278 | context->recordError(error); |
| 8279 | return; |
| 8280 | } |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8281 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8282 | } |
| 8283 | } |
| 8284 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8285 | void GL_APIENTRY glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8286 | { |
| 8287 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 8288 | target, levels, internalformat, width, height); |
| 8289 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8290 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8291 | if (context) |
| 8292 | { |
| 8293 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8294 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8295 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8296 | return; |
shannonwoods@chromium.org | 8757c06 | 2013-05-30 00:14:24 +0000 | [diff] [blame] | 8297 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8298 | |
| 8299 | if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1)) |
| 8300 | { |
| 8301 | return; |
| 8302 | } |
| 8303 | |
| 8304 | switch (target) |
| 8305 | { |
| 8306 | case GL_TEXTURE_2D: |
| 8307 | { |
| 8308 | gl::Texture2D *texture2d = context->getTexture2D(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8309 | gl::Error error = texture2d->storage(levels, internalformat, width, height); |
| 8310 | if (error.isError()) |
| 8311 | { |
| 8312 | context->recordError(error); |
| 8313 | return; |
| 8314 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8315 | } |
| 8316 | break; |
| 8317 | |
| 8318 | case GL_TEXTURE_CUBE_MAP: |
| 8319 | { |
| 8320 | gl::TextureCubeMap *textureCube = context->getTextureCubeMap(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8321 | gl::Error error = textureCube->storage(levels, internalformat, width); |
| 8322 | if (error.isError()) |
| 8323 | { |
| 8324 | context->recordError(error); |
| 8325 | return; |
| 8326 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8327 | } |
| 8328 | break; |
| 8329 | |
| 8330 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8331 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8332 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8333 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8334 | } |
| 8335 | } |
| 8336 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8337 | void GL_APIENTRY glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8338 | { |
| 8339 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " |
| 8340 | "GLsizei height = %d, GLsizei depth = %d)", |
| 8341 | target, levels, internalformat, width, height, depth); |
| 8342 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8343 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8344 | if (context) |
| 8345 | { |
| 8346 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8347 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8348 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8349 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 14eb55e | 2013-04-13 03:35:06 +0000 | [diff] [blame] | 8350 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8351 | |
| 8352 | if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, depth)) |
| 8353 | { |
| 8354 | return; |
| 8355 | } |
| 8356 | |
| 8357 | switch (target) |
| 8358 | { |
| 8359 | case GL_TEXTURE_3D: |
| 8360 | { |
| 8361 | gl::Texture3D *texture3d = context->getTexture3D(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8362 | gl::Error error = texture3d->storage(levels, internalformat, width, height, depth); |
| 8363 | if (error.isError()) |
| 8364 | { |
| 8365 | context->recordError(error); |
| 8366 | return; |
| 8367 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8368 | } |
| 8369 | break; |
| 8370 | |
| 8371 | case GL_TEXTURE_2D_ARRAY: |
| 8372 | { |
| 8373 | gl::Texture2DArray *texture2darray = context->getTexture2DArray(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8374 | gl::Error error = texture2darray->storage(levels, internalformat, width, height, depth); |
| 8375 | if (error.isError()) |
| 8376 | { |
| 8377 | context->recordError(error); |
| 8378 | return; |
| 8379 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8380 | } |
| 8381 | break; |
| 8382 | |
| 8383 | default: |
| 8384 | UNREACHABLE(); |
| 8385 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8386 | } |
| 8387 | } |
| 8388 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8389 | void GL_APIENTRY glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8390 | { |
| 8391 | EVENT("(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, " |
| 8392 | "GLint* params = 0x%0.8p)", |
| 8393 | target, internalformat, pname, bufSize, params); |
| 8394 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8395 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8396 | if (context) |
| 8397 | { |
| 8398 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8399 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8400 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8401 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8402 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8403 | |
| 8404 | const gl::TextureCaps &formatCaps = context->getTextureCaps().get(internalformat); |
| 8405 | if (!formatCaps.renderable) |
| 8406 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8407 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8408 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8409 | } |
| 8410 | |
| 8411 | if (target != GL_RENDERBUFFER) |
| 8412 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8413 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8414 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8415 | } |
| 8416 | |
| 8417 | if (bufSize < 0) |
| 8418 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8419 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8420 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8421 | } |
| 8422 | |
| 8423 | switch (pname) |
| 8424 | { |
| 8425 | case GL_NUM_SAMPLE_COUNTS: |
| 8426 | if (bufSize != 0) |
Geoff Lang | 5f4c463 | 2014-07-03 13:46:52 -0400 | [diff] [blame] | 8427 | { |
| 8428 | *params = formatCaps.sampleCounts.size(); |
| 8429 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8430 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8431 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8432 | case GL_SAMPLES: |
Geoff Lang | 5f4c463 | 2014-07-03 13:46:52 -0400 | [diff] [blame] | 8433 | std::copy_n(formatCaps.sampleCounts.rbegin(), std::min<size_t>(bufSize, formatCaps.sampleCounts.size()), params); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8434 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8435 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8436 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8437 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8438 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8439 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8440 | } |
| 8441 | } |
| 8442 | |
| 8443 | // Extension functions |
| 8444 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8445 | void GL_APIENTRY glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8446 | GLbitfield mask, GLenum filter) |
| 8447 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 8448 | EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, " |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8449 | "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, " |
| 8450 | "GLbitfield mask = 0x%X, GLenum filter = 0x%X)", |
| 8451 | srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 8452 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8453 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8454 | if (context) |
| 8455 | { |
| 8456 | if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, |
| 8457 | dstX0, dstY0, dstX1, dstY1, mask, filter, |
| 8458 | true)) |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8459 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8460 | return; |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8461 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8462 | |
Geoff Lang | 6483915 | 2014-08-26 16:23:25 -0400 | [diff] [blame] | 8463 | gl::Error error = context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, |
| 8464 | mask, filter); |
| 8465 | if (error.isError()) |
| 8466 | { |
| 8467 | context->recordError(error); |
| 8468 | return; |
| 8469 | } |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8470 | } |
| 8471 | } |
| 8472 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8473 | void GL_APIENTRY glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 8474 | GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8475 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 8476 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, " |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 8477 | "GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, GLint border = %d, " |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 8478 | "GLenum format = 0x%X, GLenum type = 0x%x, const GLvoid* pixels = 0x%0.8p)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8479 | target, level, internalformat, width, height, depth, border, format, type, pixels); |
| 8480 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8481 | UNIMPLEMENTED(); // FIXME |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8482 | } |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8483 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8484 | void GL_APIENTRY glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8485 | GLenum *binaryFormat, void *binary) |
| 8486 | { |
apatrick@chromium.org | 90080e3 | 2012-07-09 22:15:33 +0000 | [diff] [blame] | 8487 | EVENT("(GLenum program = 0x%X, bufSize = %d, length = 0x%0.8p, binaryFormat = 0x%0.8p, binary = 0x%0.8p)", |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8488 | program, bufSize, length, binaryFormat, binary); |
| 8489 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8490 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8491 | if (context) |
| 8492 | { |
| 8493 | gl::Program *programObject = context->getProgram(program); |
| 8494 | |
| 8495 | if (!programObject || !programObject->isLinked()) |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8496 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8497 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8498 | return; |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8499 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8500 | |
| 8501 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 8502 | |
| 8503 | if (!programBinary) |
| 8504 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8505 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8506 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8507 | } |
| 8508 | |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 8509 | gl::Error error = programBinary->save(binaryFormat, binary, bufSize, length); |
| 8510 | if (error.isError()) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8511 | { |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 8512 | context->recordError(error); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8513 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8514 | } |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8515 | } |
| 8516 | } |
| 8517 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8518 | void GL_APIENTRY glProgramBinaryOES(GLuint program, GLenum binaryFormat, |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8519 | const void *binary, GLint length) |
| 8520 | { |
| 8521 | EVENT("(GLenum program = 0x%X, binaryFormat = 0x%x, binary = 0x%0.8p, length = %d)", |
| 8522 | program, binaryFormat, binary, length); |
| 8523 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8524 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8525 | if (context) |
| 8526 | { |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 8527 | const std::vector<GLenum> &programBinaryFormats = context->getCaps().programBinaryFormats; |
| 8528 | if (std::find(programBinaryFormats.begin(), programBinaryFormats.end(), binaryFormat) == programBinaryFormats.end()) |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8529 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8530 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8531 | return; |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8532 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8533 | |
| 8534 | gl::Program *programObject = context->getProgram(program); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8535 | if (!programObject) |
| 8536 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8537 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8538 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8539 | } |
| 8540 | |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 8541 | gl::Error error = context->setProgramBinary(program, binaryFormat, binary, length); |
| 8542 | if (error.isError()) |
| 8543 | { |
| 8544 | context->recordError(error); |
| 8545 | return; |
| 8546 | } |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8547 | } |
| 8548 | } |
| 8549 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8550 | void GL_APIENTRY glDrawBuffersEXT(GLsizei n, const GLenum *bufs) |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8551 | { |
| 8552 | EVENT("(GLenum n = %d, bufs = 0x%0.8p)", n, bufs); |
| 8553 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8554 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8555 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8556 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8557 | if (n < 0 || static_cast<GLuint>(n) > context->getCaps().maxDrawBuffers) |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8558 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8559 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8560 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8561 | } |
| 8562 | |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 8563 | ASSERT(context->getState().getDrawFramebuffer()); |
| 8564 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8565 | if (context->getState().getDrawFramebuffer()->id() == 0) |
| 8566 | { |
| 8567 | if (n != 1) |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8568 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8569 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8570 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8571 | } |
| 8572 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8573 | if (bufs[0] != GL_NONE && bufs[0] != GL_BACK) |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8574 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8575 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8576 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 2fa73c5 | 2013-04-13 03:37:20 +0000 | [diff] [blame] | 8577 | } |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8578 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8579 | else |
| 8580 | { |
| 8581 | for (int colorAttachment = 0; colorAttachment < n; colorAttachment++) |
| 8582 | { |
| 8583 | const GLenum attachment = GL_COLOR_ATTACHMENT0_EXT + colorAttachment; |
| 8584 | if (bufs[colorAttachment] != GL_NONE && bufs[colorAttachment] != attachment) |
| 8585 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8586 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8587 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8588 | } |
| 8589 | } |
| 8590 | } |
| 8591 | |
| 8592 | gl::Framebuffer *framebuffer = context->getState().getDrawFramebuffer(); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 8593 | ASSERT(framebuffer); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8594 | |
| 8595 | for (unsigned int colorAttachment = 0; colorAttachment < static_cast<unsigned int>(n); colorAttachment++) |
| 8596 | { |
| 8597 | framebuffer->setDrawBufferState(colorAttachment, bufs[colorAttachment]); |
| 8598 | } |
| 8599 | |
| 8600 | for (unsigned int colorAttachment = n; colorAttachment < context->getCaps().maxDrawBuffers; colorAttachment++) |
| 8601 | { |
| 8602 | framebuffer->setDrawBufferState(colorAttachment, GL_NONE); |
| 8603 | } |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8604 | } |
| 8605 | } |
| 8606 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8607 | void GL_APIENTRY glGetBufferPointervOES(GLenum target, GLenum pname, void** params) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8608 | { |
| 8609 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params); |
| 8610 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8611 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8612 | if (context) |
| 8613 | { |
| 8614 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8615 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8616 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8617 | return; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8618 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8619 | |
| 8620 | if (pname != GL_BUFFER_MAP_POINTER) |
| 8621 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8622 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8623 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8624 | } |
| 8625 | |
| 8626 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8627 | |
| 8628 | if (!buffer || !buffer->isMapped()) |
| 8629 | { |
| 8630 | *params = NULL; |
| 8631 | } |
| 8632 | else |
| 8633 | { |
| 8634 | *params = buffer->getMapPointer(); |
| 8635 | } |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8636 | } |
| 8637 | } |
| 8638 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8639 | void * GL_APIENTRY glMapBufferOES(GLenum target, GLenum access) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8640 | { |
| 8641 | EVENT("(GLenum target = 0x%X, GLbitfield access = 0x%X)", target, access); |
| 8642 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8643 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8644 | if (context) |
| 8645 | { |
| 8646 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8647 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8648 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8649 | return NULL; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8650 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8651 | |
| 8652 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8653 | |
| 8654 | if (buffer == NULL) |
| 8655 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8656 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8657 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8658 | } |
| 8659 | |
| 8660 | if (access != GL_WRITE_ONLY_OES) |
| 8661 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8662 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8663 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8664 | } |
| 8665 | |
| 8666 | if (buffer->isMapped()) |
| 8667 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8668 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8669 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8670 | } |
| 8671 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 8672 | gl::Error error = buffer->mapRange(0, buffer->getSize(), GL_MAP_WRITE_BIT); |
| 8673 | if (error.isError()) |
| 8674 | { |
| 8675 | context->recordError(error); |
| 8676 | return NULL; |
| 8677 | } |
| 8678 | |
| 8679 | return buffer->getMapPointer(); |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8680 | } |
| 8681 | |
| 8682 | return NULL; |
| 8683 | } |
| 8684 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8685 | GLboolean GL_APIENTRY glUnmapBufferOES(GLenum target) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8686 | { |
| 8687 | EVENT("(GLenum target = 0x%X)", target); |
| 8688 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8689 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8690 | if (context) |
| 8691 | { |
| 8692 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8693 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8694 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8695 | return GL_FALSE; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8696 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8697 | |
| 8698 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8699 | |
| 8700 | if (buffer == NULL || !buffer->isMapped()) |
| 8701 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8702 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8703 | return GL_FALSE; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8704 | } |
| 8705 | |
| 8706 | // TODO: detect if we had corruption. if so, throw an error and return false. |
| 8707 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 8708 | gl::Error error = buffer->unmap(); |
| 8709 | if (error.isError()) |
| 8710 | { |
| 8711 | context->recordError(error); |
| 8712 | return GL_FALSE; |
| 8713 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8714 | |
| 8715 | return GL_TRUE; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8716 | } |
| 8717 | |
| 8718 | return GL_FALSE; |
| 8719 | } |
| 8720 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8721 | void* GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8722 | { |
| 8723 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)", |
| 8724 | target, offset, length, access); |
| 8725 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8726 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8727 | if (context) |
| 8728 | { |
| 8729 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8730 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8731 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8732 | return NULL; |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8733 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8734 | |
| 8735 | if (offset < 0 || length < 0) |
| 8736 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8737 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8738 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8739 | } |
| 8740 | |
| 8741 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8742 | |
| 8743 | if (buffer == NULL) |
| 8744 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8745 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8746 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8747 | } |
| 8748 | |
| 8749 | // Check for buffer overflow |
| 8750 | size_t offsetSize = static_cast<size_t>(offset); |
| 8751 | size_t lengthSize = static_cast<size_t>(length); |
| 8752 | |
| 8753 | if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) || |
| 8754 | offsetSize + lengthSize > static_cast<size_t>(buffer->getSize())) |
| 8755 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8756 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8757 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8758 | } |
| 8759 | |
| 8760 | // Check for invalid bits in the mask |
| 8761 | GLbitfield allAccessBits = GL_MAP_READ_BIT | |
| 8762 | GL_MAP_WRITE_BIT | |
| 8763 | GL_MAP_INVALIDATE_RANGE_BIT | |
| 8764 | GL_MAP_INVALIDATE_BUFFER_BIT | |
| 8765 | GL_MAP_FLUSH_EXPLICIT_BIT | |
| 8766 | GL_MAP_UNSYNCHRONIZED_BIT; |
| 8767 | |
| 8768 | if (access & ~(allAccessBits)) |
| 8769 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8770 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8771 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8772 | } |
| 8773 | |
| 8774 | if (length == 0 || buffer->isMapped()) |
| 8775 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8776 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8777 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8778 | } |
| 8779 | |
| 8780 | // Check for invalid bit combinations |
| 8781 | if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0) |
| 8782 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8783 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8784 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8785 | } |
| 8786 | |
| 8787 | GLbitfield writeOnlyBits = GL_MAP_INVALIDATE_RANGE_BIT | |
| 8788 | GL_MAP_INVALIDATE_BUFFER_BIT | |
| 8789 | GL_MAP_UNSYNCHRONIZED_BIT; |
| 8790 | |
| 8791 | if ((access & GL_MAP_READ_BIT) != 0 && (access & writeOnlyBits) != 0) |
| 8792 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8793 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8794 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8795 | } |
| 8796 | |
| 8797 | if ((access & GL_MAP_WRITE_BIT) == 0 && (access & GL_MAP_FLUSH_EXPLICIT_BIT) != 0) |
| 8798 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8799 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8800 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8801 | } |
| 8802 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 8803 | gl::Error error = buffer->mapRange(offset, length, access); |
| 8804 | if (error.isError()) |
| 8805 | { |
| 8806 | context->recordError(error); |
| 8807 | return NULL; |
| 8808 | } |
| 8809 | |
| 8810 | return buffer->getMapPointer(); |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8811 | } |
| 8812 | |
| 8813 | return NULL; |
| 8814 | } |
| 8815 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8816 | void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8817 | { |
| 8818 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length); |
| 8819 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8820 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8821 | if (context) |
| 8822 | { |
| 8823 | if (offset < 0 || length < 0) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8824 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8825 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8826 | return; |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8827 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8828 | |
| 8829 | if (!gl::ValidBufferTarget(context, target)) |
| 8830 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8831 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8832 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8833 | } |
| 8834 | |
| 8835 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8836 | |
| 8837 | if (buffer == NULL) |
| 8838 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8839 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8840 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8841 | } |
| 8842 | |
| 8843 | if (!buffer->isMapped() || (buffer->getAccessFlags() & GL_MAP_FLUSH_EXPLICIT_BIT) == 0) |
| 8844 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8845 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8846 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8847 | } |
| 8848 | |
| 8849 | // Check for buffer overflow |
| 8850 | size_t offsetSize = static_cast<size_t>(offset); |
| 8851 | size_t lengthSize = static_cast<size_t>(length); |
| 8852 | |
| 8853 | if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) || |
| 8854 | offsetSize + lengthSize > static_cast<size_t>(buffer->getMapLength())) |
| 8855 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8856 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8857 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8858 | } |
| 8859 | |
| 8860 | // We do not currently support a non-trivial implementation of FlushMappedBufferRange |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8861 | } |
| 8862 | } |
| 8863 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8864 | } |