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 | |
daniel@transgaming.com | a0ce7e6 | 2011-01-25 14:47:16 +0000 | [diff] [blame] | 9 | #include "common/version.h" |
Geoff Lang | 0b7eef7 | 2014-06-12 14:10:47 -0400 | [diff] [blame] | 10 | #include "common/utilities.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 11 | |
| 12 | #include "libGLESv2/main.h" |
shannonwoods@chromium.org | 8dcfc6a | 2013-05-30 00:09:48 +0000 | [diff] [blame] | 13 | #include "libGLESv2/formatutils.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 14 | #include "libGLESv2/Buffer.h" |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 15 | #include "libGLESv2/Fence.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 16 | #include "libGLESv2/Framebuffer.h" |
shannon.woods@transgaming.com | 486d9e9 | 2013-02-28 23:15:41 +0000 | [diff] [blame] | 17 | #include "libGLESv2/Renderbuffer.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 18 | #include "libGLESv2/Program.h" |
apatrick@chromium.org | ea09f9b | 2012-06-08 00:45:32 +0000 | [diff] [blame] | 19 | #include "libGLESv2/ProgramBinary.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 20 | #include "libGLESv2/Texture.h" |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 21 | #include "libGLESv2/Query.h" |
shannon.woods@transgaming.com | 486d9e9 | 2013-02-28 23:15:41 +0000 | [diff] [blame] | 22 | #include "libGLESv2/Context.h" |
Jamie Madill | 57a8972 | 2013-07-02 11:57:03 -0400 | [diff] [blame] | 23 | #include "libGLESv2/VertexArray.h" |
Brandon Jones | 5bf9829 | 2014-06-06 17:19:38 -0700 | [diff] [blame] | 24 | #include "libGLESv2/VertexAttribute.h" |
Geoff Lang | c805845 | 2014-02-03 12:04:11 -0500 | [diff] [blame] | 25 | #include "libGLESv2/TransformFeedback.h" |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame] | 26 | #include "libGLESv2/FramebufferAttachment.h" |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 27 | |
Geoff Lang | e8ebe7f | 2013-08-05 15:03:13 -0400 | [diff] [blame] | 28 | #include "libGLESv2/validationES.h" |
| 29 | #include "libGLESv2/validationES2.h" |
| 30 | #include "libGLESv2/validationES3.h" |
Jamie Madill | 55856b1 | 2014-01-02 13:59:50 -0500 | [diff] [blame] | 31 | #include "libGLESv2/queryconversions.h" |
Jamie Madill | 478fdb2 | 2013-07-19 16:36:59 -0400 | [diff] [blame] | 32 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 33 | extern "C" |
| 34 | { |
| 35 | |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 36 | // OpenGL ES 2.0 functions |
| 37 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 38 | void GL_APIENTRY glActiveTexture(GLenum texture) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 39 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 40 | EVENT("(GLenum texture = 0x%X)", texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 41 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 42 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 43 | if (context) |
| 44 | { |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 45 | if (texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + context->getCaps().maxCombinedTextureImageUnits - 1) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 46 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 47 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 48 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 49 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 50 | |
| 51 | context->getState().setActiveSampler(texture - GL_TEXTURE0); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 52 | } |
| 53 | } |
| 54 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 55 | void GL_APIENTRY glAttachShader(GLuint program, GLuint shader) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 56 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 57 | EVENT("(GLuint program = %d, GLuint shader = %d)", program, shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 58 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 59 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 60 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 61 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 62 | gl::Program *programObject = context->getProgram(program); |
| 63 | gl::Shader *shaderObject = context->getShader(shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 64 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 65 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 66 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 67 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 68 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 69 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 70 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 71 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 72 | else |
| 73 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 74 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 75 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 76 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 77 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 78 | |
| 79 | if (!shaderObject) |
| 80 | { |
| 81 | if (context->getProgram(shader)) |
| 82 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 83 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 84 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 85 | } |
| 86 | else |
| 87 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 88 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 89 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 90 | } |
| 91 | } |
| 92 | |
| 93 | if (!programObject->attachShader(shaderObject)) |
| 94 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 95 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 96 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 97 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 98 | } |
| 99 | } |
| 100 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 101 | void GL_APIENTRY glBeginQueryEXT(GLenum target, GLuint id) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 102 | { |
| 103 | EVENT("(GLenum target = 0x%X, GLuint %d)", target, id); |
| 104 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 105 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 106 | if (context) |
| 107 | { |
| 108 | if (!ValidateBeginQuery(context, target, id)) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 109 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 110 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 111 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 112 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 113 | gl::Error error = context->beginQuery(target, id); |
| 114 | if (error.isError()) |
| 115 | { |
| 116 | context->recordError(error); |
| 117 | return; |
| 118 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 119 | } |
| 120 | } |
| 121 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 122 | void GL_APIENTRY glBindAttribLocation(GLuint program, GLuint index, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 123 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 124 | 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] | 125 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 126 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 127 | if (context) |
| 128 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 129 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 130 | { |
| 131 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 132 | return; |
| 133 | } |
| 134 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 135 | gl::Program *programObject = context->getProgram(program); |
| 136 | |
| 137 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 138 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 139 | if (context->getShader(program)) |
daniel@transgaming.com | 9807983 | 2010-04-13 03:26:29 +0000 | [diff] [blame] | 140 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 141 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 142 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 143 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 144 | else |
| 145 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 146 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 147 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 148 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 149 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 150 | |
| 151 | if (strncmp(name, "gl_", 3) == 0) |
| 152 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 153 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 154 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | programObject->bindAttributeLocation(index, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 158 | } |
| 159 | } |
| 160 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 161 | void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 162 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 163 | EVENT("(GLenum target = 0x%X, GLuint buffer = %d)", target, buffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 164 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 165 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 166 | if (context) |
| 167 | { |
| 168 | if (!gl::ValidBufferTarget(context, target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 169 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 170 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 171 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 172 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 173 | |
| 174 | switch (target) |
| 175 | { |
| 176 | case GL_ARRAY_BUFFER: |
| 177 | context->bindArrayBuffer(buffer); |
| 178 | return; |
| 179 | case GL_ELEMENT_ARRAY_BUFFER: |
| 180 | context->bindElementArrayBuffer(buffer); |
| 181 | return; |
| 182 | case GL_COPY_READ_BUFFER: |
| 183 | context->bindCopyReadBuffer(buffer); |
| 184 | return; |
| 185 | case GL_COPY_WRITE_BUFFER: |
| 186 | context->bindCopyWriteBuffer(buffer); |
| 187 | return; |
| 188 | case GL_PIXEL_PACK_BUFFER: |
| 189 | context->bindPixelPackBuffer(buffer); |
| 190 | return; |
| 191 | case GL_PIXEL_UNPACK_BUFFER: |
| 192 | context->bindPixelUnpackBuffer(buffer); |
| 193 | return; |
| 194 | case GL_UNIFORM_BUFFER: |
| 195 | context->bindGenericUniformBuffer(buffer); |
| 196 | return; |
| 197 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 198 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 199 | return; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 200 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 201 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 202 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 203 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 204 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 205 | } |
| 206 | } |
| 207 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 208 | void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 209 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 210 | EVENT("(GLenum target = 0x%X, GLuint framebuffer = %d)", target, framebuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 211 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 212 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 213 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 214 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 215 | if (!gl::ValidFramebufferTarget(target)) |
| 216 | { |
| 217 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 218 | return; |
| 219 | } |
| 220 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 221 | if (target == GL_READ_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER) |
| 222 | { |
| 223 | context->bindReadFramebuffer(framebuffer); |
| 224 | } |
| 225 | |
| 226 | if (target == GL_DRAW_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER) |
| 227 | { |
| 228 | context->bindDrawFramebuffer(framebuffer); |
| 229 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 230 | } |
| 231 | } |
| 232 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 233 | void GL_APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 234 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 235 | EVENT("(GLenum target = 0x%X, GLuint renderbuffer = %d)", target, renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 236 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 237 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 238 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 239 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 240 | if (target != GL_RENDERBUFFER) |
| 241 | { |
| 242 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 243 | return; |
| 244 | } |
| 245 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 246 | context->bindRenderbuffer(renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 247 | } |
| 248 | } |
| 249 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 250 | void GL_APIENTRY glBindTexture(GLenum target, GLuint texture) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 251 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 252 | EVENT("(GLenum target = 0x%X, GLuint texture = %d)", target, texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 253 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 254 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 255 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 256 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 257 | gl::Texture *textureObject = context->getTexture(texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 258 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 259 | if (textureObject && textureObject->getTarget() != target && texture != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 260 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 261 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 262 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 263 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 264 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 265 | switch (target) |
| 266 | { |
| 267 | case GL_TEXTURE_2D: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 268 | case GL_TEXTURE_CUBE_MAP: |
Geoff Lang | 76b10c9 | 2014-09-05 16:28:14 -0400 | [diff] [blame] | 269 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 270 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 271 | case GL_TEXTURE_3D: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 272 | case GL_TEXTURE_2D_ARRAY: |
| 273 | if (context->getClientVersion() < 3) |
| 274 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 275 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 276 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 277 | } |
Geoff Lang | 76b10c9 | 2014-09-05 16:28:14 -0400 | [diff] [blame] | 278 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 279 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 280 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 281 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 282 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 283 | } |
Geoff Lang | 76b10c9 | 2014-09-05 16:28:14 -0400 | [diff] [blame] | 284 | |
| 285 | context->bindTexture(target, texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 286 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 287 | } |
| 288 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 289 | 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] | 290 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 291 | 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] | 292 | red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 293 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 294 | gl::Context* context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 295 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 296 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 297 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 298 | 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] | 299 | } |
| 300 | } |
| 301 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 302 | void GL_APIENTRY glBlendEquation(GLenum mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 303 | { |
| 304 | glBlendEquationSeparate(mode, mode); |
| 305 | } |
| 306 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 307 | void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 308 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 309 | EVENT("(GLenum modeRGB = 0x%X, GLenum modeAlpha = 0x%X)", modeRGB, modeAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 310 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 311 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 312 | if (context) |
| 313 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 314 | switch (modeRGB) |
| 315 | { |
| 316 | case GL_FUNC_ADD: |
| 317 | case GL_FUNC_SUBTRACT: |
| 318 | case GL_FUNC_REVERSE_SUBTRACT: |
| 319 | case GL_MIN: |
| 320 | case GL_MAX: |
| 321 | break; |
| 322 | |
| 323 | default: |
| 324 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 325 | return; |
| 326 | } |
| 327 | |
| 328 | switch (modeAlpha) |
| 329 | { |
| 330 | case GL_FUNC_ADD: |
| 331 | case GL_FUNC_SUBTRACT: |
| 332 | case GL_FUNC_REVERSE_SUBTRACT: |
| 333 | case GL_MIN: |
| 334 | case GL_MAX: |
| 335 | break; |
| 336 | |
| 337 | default: |
| 338 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 339 | return; |
| 340 | } |
| 341 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 342 | context->getState().setBlendEquation(modeRGB, modeAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 343 | } |
| 344 | } |
| 345 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 346 | void GL_APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 347 | { |
| 348 | glBlendFuncSeparate(sfactor, dfactor, sfactor, dfactor); |
| 349 | } |
| 350 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 351 | 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] | 352 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 353 | 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] | 354 | srcRGB, dstRGB, srcAlpha, dstAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 355 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 356 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 357 | if (context) |
| 358 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 359 | switch (srcRGB) |
| 360 | { |
| 361 | case GL_ZERO: |
| 362 | case GL_ONE: |
| 363 | case GL_SRC_COLOR: |
| 364 | case GL_ONE_MINUS_SRC_COLOR: |
| 365 | case GL_DST_COLOR: |
| 366 | case GL_ONE_MINUS_DST_COLOR: |
| 367 | case GL_SRC_ALPHA: |
| 368 | case GL_ONE_MINUS_SRC_ALPHA: |
| 369 | case GL_DST_ALPHA: |
| 370 | case GL_ONE_MINUS_DST_ALPHA: |
| 371 | case GL_CONSTANT_COLOR: |
| 372 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 373 | case GL_CONSTANT_ALPHA: |
| 374 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 375 | case GL_SRC_ALPHA_SATURATE: |
| 376 | break; |
| 377 | |
| 378 | default: |
| 379 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 380 | return; |
| 381 | } |
| 382 | |
| 383 | switch (dstRGB) |
| 384 | { |
| 385 | case GL_ZERO: |
| 386 | case GL_ONE: |
| 387 | case GL_SRC_COLOR: |
| 388 | case GL_ONE_MINUS_SRC_COLOR: |
| 389 | case GL_DST_COLOR: |
| 390 | case GL_ONE_MINUS_DST_COLOR: |
| 391 | case GL_SRC_ALPHA: |
| 392 | case GL_ONE_MINUS_SRC_ALPHA: |
| 393 | case GL_DST_ALPHA: |
| 394 | case GL_ONE_MINUS_DST_ALPHA: |
| 395 | case GL_CONSTANT_COLOR: |
| 396 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 397 | case GL_CONSTANT_ALPHA: |
| 398 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 399 | break; |
| 400 | |
| 401 | case GL_SRC_ALPHA_SATURATE: |
| 402 | if (context->getClientVersion() < 3) |
| 403 | { |
| 404 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 405 | return; |
| 406 | } |
| 407 | break; |
| 408 | |
| 409 | default: |
| 410 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 411 | return; |
| 412 | } |
| 413 | |
| 414 | switch (srcAlpha) |
| 415 | { |
| 416 | case GL_ZERO: |
| 417 | case GL_ONE: |
| 418 | case GL_SRC_COLOR: |
| 419 | case GL_ONE_MINUS_SRC_COLOR: |
| 420 | case GL_DST_COLOR: |
| 421 | case GL_ONE_MINUS_DST_COLOR: |
| 422 | case GL_SRC_ALPHA: |
| 423 | case GL_ONE_MINUS_SRC_ALPHA: |
| 424 | case GL_DST_ALPHA: |
| 425 | case GL_ONE_MINUS_DST_ALPHA: |
| 426 | case GL_CONSTANT_COLOR: |
| 427 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 428 | case GL_CONSTANT_ALPHA: |
| 429 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 430 | case GL_SRC_ALPHA_SATURATE: |
| 431 | break; |
| 432 | |
| 433 | default: |
| 434 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 435 | return; |
| 436 | } |
| 437 | |
| 438 | switch (dstAlpha) |
| 439 | { |
| 440 | case GL_ZERO: |
| 441 | case GL_ONE: |
| 442 | case GL_SRC_COLOR: |
| 443 | case GL_ONE_MINUS_SRC_COLOR: |
| 444 | case GL_DST_COLOR: |
| 445 | case GL_ONE_MINUS_DST_COLOR: |
| 446 | case GL_SRC_ALPHA: |
| 447 | case GL_ONE_MINUS_SRC_ALPHA: |
| 448 | case GL_DST_ALPHA: |
| 449 | case GL_ONE_MINUS_DST_ALPHA: |
| 450 | case GL_CONSTANT_COLOR: |
| 451 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 452 | case GL_CONSTANT_ALPHA: |
| 453 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 454 | break; |
| 455 | |
| 456 | case GL_SRC_ALPHA_SATURATE: |
| 457 | if (context->getClientVersion() < 3) |
| 458 | { |
| 459 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 460 | return; |
| 461 | } |
| 462 | break; |
| 463 | |
| 464 | default: |
| 465 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 466 | return; |
| 467 | } |
| 468 | |
| 469 | bool constantColorUsed = (srcRGB == GL_CONSTANT_COLOR || srcRGB == GL_ONE_MINUS_CONSTANT_COLOR || |
| 470 | dstRGB == GL_CONSTANT_COLOR || dstRGB == GL_ONE_MINUS_CONSTANT_COLOR); |
| 471 | |
| 472 | bool constantAlphaUsed = (srcRGB == GL_CONSTANT_ALPHA || srcRGB == GL_ONE_MINUS_CONSTANT_ALPHA || |
| 473 | dstRGB == GL_CONSTANT_ALPHA || dstRGB == GL_ONE_MINUS_CONSTANT_ALPHA); |
| 474 | |
| 475 | if (constantColorUsed && constantAlphaUsed) |
| 476 | { |
| 477 | ERR("Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR invalid under WebGL"); |
| 478 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 479 | return; |
| 480 | } |
| 481 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 482 | context->getState().setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 483 | } |
| 484 | } |
| 485 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 486 | 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] | 487 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 488 | 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] | 489 | target, size, data, usage); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 490 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 491 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 492 | if (context) |
| 493 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 494 | if (size < 0) |
| 495 | { |
| 496 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 497 | return; |
| 498 | } |
| 499 | |
| 500 | switch (usage) |
| 501 | { |
| 502 | case GL_STREAM_DRAW: |
| 503 | case GL_STATIC_DRAW: |
| 504 | case GL_DYNAMIC_DRAW: |
| 505 | break; |
| 506 | |
| 507 | case GL_STREAM_READ: |
| 508 | case GL_STREAM_COPY: |
| 509 | case GL_STATIC_READ: |
| 510 | case GL_STATIC_COPY: |
| 511 | case GL_DYNAMIC_READ: |
| 512 | case GL_DYNAMIC_COPY: |
| 513 | if (context->getClientVersion() < 3) |
| 514 | { |
| 515 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 516 | return; |
| 517 | } |
| 518 | break; |
| 519 | |
| 520 | default: |
| 521 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 522 | return; |
| 523 | } |
| 524 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 525 | if (!gl::ValidBufferTarget(context, target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 526 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 527 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 528 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 529 | } |
| 530 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 531 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 532 | |
| 533 | if (!buffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 534 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 535 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 536 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 537 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 538 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 539 | gl::Error error = buffer->bufferData(data, size, usage); |
| 540 | if (error.isError()) |
| 541 | { |
| 542 | context->recordError(error); |
| 543 | return; |
| 544 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 545 | } |
| 546 | } |
| 547 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 548 | 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] | 549 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 550 | 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] | 551 | target, offset, size, data); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 552 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 553 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 554 | if (context) |
| 555 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 556 | if (size < 0 || offset < 0) |
| 557 | { |
| 558 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 559 | return; |
| 560 | } |
| 561 | |
| 562 | if (data == NULL) |
| 563 | { |
| 564 | return; |
| 565 | } |
| 566 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 567 | if (!gl::ValidBufferTarget(context, target)) |
| 568 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 569 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 570 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 574 | |
| 575 | if (!buffer) |
| 576 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 577 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 578 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 579 | } |
| 580 | |
| 581 | if (buffer->isMapped()) |
| 582 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 583 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 584 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 585 | } |
| 586 | |
| 587 | // Check for possible overflow of size + offset |
| 588 | if (!rx::IsUnsignedAdditionSafe<size_t>(size, offset)) |
| 589 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 590 | context->recordError(gl::Error(GL_OUT_OF_MEMORY)); |
| 591 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 592 | } |
| 593 | |
| 594 | if (size + offset > buffer->getSize()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 595 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 596 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 597 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 598 | } |
| 599 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 600 | gl::Error error = buffer->bufferSubData(data, size, offset); |
| 601 | if (error.isError()) |
| 602 | { |
| 603 | context->recordError(error); |
| 604 | return; |
| 605 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 606 | } |
| 607 | } |
| 608 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 609 | GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 610 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 611 | EVENT("(GLenum target = 0x%X)", target); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 612 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 613 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 614 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 615 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 616 | if (!gl::ValidFramebufferTarget(target)) |
| 617 | { |
| 618 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 619 | return 0; |
| 620 | } |
| 621 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 622 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 623 | ASSERT(framebuffer); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 624 | |
| 625 | return framebuffer->completeness(context->getData()); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 626 | } |
| 627 | |
| 628 | return 0; |
| 629 | } |
| 630 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 631 | void GL_APIENTRY glClear(GLbitfield mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 632 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 633 | EVENT("(GLbitfield mask = 0x%X)", mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 634 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 635 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 636 | if (context) |
| 637 | { |
| 638 | gl::Framebuffer *framebufferObject = context->getState().getDrawFramebuffer(); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 639 | ASSERT(framebufferObject); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 640 | |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 641 | if (framebufferObject->completeness(context->getData()) != GL_FRAMEBUFFER_COMPLETE) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 642 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 643 | context->recordError(gl::Error(GL_INVALID_FRAMEBUFFER_OPERATION)); |
| 644 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 645 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 646 | |
| 647 | if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0) |
| 648 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 649 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 650 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 651 | } |
| 652 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 653 | gl::Error error = context->clear(mask); |
| 654 | if (error.isError()) |
| 655 | { |
| 656 | context->recordError(error); |
| 657 | return; |
| 658 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 659 | } |
| 660 | } |
| 661 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 662 | 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] | 663 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 664 | 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] | 665 | red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 666 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 667 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 668 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 669 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 670 | context->getState().setClearColor(red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 671 | } |
| 672 | } |
| 673 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 674 | void GL_APIENTRY glClearDepthf(GLclampf depth) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 675 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 676 | EVENT("(GLclampf depth = %f)", depth); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 677 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 678 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 679 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 680 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 681 | context->getState().setClearDepth(depth); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 682 | } |
| 683 | } |
| 684 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 685 | void GL_APIENTRY glClearStencil(GLint s) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 686 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 687 | EVENT("(GLint s = %d)", s); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 688 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 689 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 690 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 691 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 692 | context->getState().setClearStencil(s); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 693 | } |
| 694 | } |
| 695 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 696 | 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] | 697 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 698 | 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] | 699 | red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 700 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 701 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 702 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 703 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 704 | 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] | 705 | } |
| 706 | } |
| 707 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 708 | void GL_APIENTRY glCompileShader(GLuint shader) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 709 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 710 | EVENT("(GLuint shader = %d)", shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 711 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 712 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 713 | if (context) |
| 714 | { |
| 715 | gl::Shader *shaderObject = context->getShader(shader); |
| 716 | |
| 717 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 718 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 719 | if (context->getProgram(shader)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 720 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 721 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 722 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 723 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 724 | else |
daniel@transgaming.com | 5d752f2 | 2010-10-07 13:37:20 +0000 | [diff] [blame] | 725 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 726 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 727 | return; |
daniel@transgaming.com | 5d752f2 | 2010-10-07 13:37:20 +0000 | [diff] [blame] | 728 | } |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 729 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 730 | |
Jamie Madill | 245d360 | 2014-11-13 10:03:30 -0500 | [diff] [blame^] | 731 | shaderObject->compile(context->getData()); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 732 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 733 | } |
| 734 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 735 | 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] | 736 | GLint border, GLsizei imageSize, const GLvoid* data) |
| 737 | { |
| 738 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " |
| 739 | "GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
| 740 | target, level, internalformat, width, height, border, imageSize, data); |
| 741 | |
| 742 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 743 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 744 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 745 | if (context->getClientVersion() < 3 && |
| 746 | !ValidateES2TexImageParameters(context, target, level, internalformat, true, false, |
| 747 | 0, 0, width, height, border, GL_NONE, GL_NONE, data)) |
| 748 | { |
| 749 | return; |
| 750 | } |
| 751 | |
| 752 | if (context->getClientVersion() >= 3 && |
| 753 | !ValidateES3TexImageParameters(context, target, level, internalformat, true, false, |
| 754 | 0, 0, 0, width, height, 1, border, GL_NONE, GL_NONE, data)) |
| 755 | { |
| 756 | return; |
| 757 | } |
| 758 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 759 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat); |
| 760 | 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] | 761 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 762 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 763 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 764 | } |
| 765 | |
| 766 | switch (target) |
| 767 | { |
| 768 | case GL_TEXTURE_2D: |
| 769 | { |
| 770 | gl::Texture2D *texture = context->getTexture2D(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 771 | 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] | 772 | if (error.isError()) |
| 773 | { |
| 774 | context->recordError(error); |
| 775 | return; |
| 776 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 777 | } |
| 778 | break; |
| 779 | |
| 780 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 781 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 782 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 783 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 784 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 785 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 786 | { |
| 787 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 788 | 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] | 789 | if (error.isError()) |
| 790 | { |
| 791 | context->recordError(error); |
| 792 | return; |
| 793 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 794 | } |
| 795 | break; |
| 796 | |
| 797 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 798 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 799 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 800 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 801 | } |
| 802 | } |
| 803 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 804 | 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] | 805 | GLenum format, GLsizei imageSize, const GLvoid* data) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 806 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 807 | 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] | 808 | "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, " |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 809 | "GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 810 | target, level, xoffset, yoffset, width, height, format, imageSize, data); |
| 811 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 812 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 813 | if (context) |
| 814 | { |
| 815 | if (context->getClientVersion() < 3 && |
| 816 | !ValidateES2TexImageParameters(context, target, level, GL_NONE, true, true, |
| 817 | xoffset, yoffset, width, height, 0, GL_NONE, GL_NONE, data)) |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 818 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 819 | return; |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 820 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 821 | |
| 822 | if (context->getClientVersion() >= 3 && |
| 823 | !ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true, |
| 824 | xoffset, yoffset, 0, width, height, 1, 0, GL_NONE, GL_NONE, data)) |
| 825 | { |
| 826 | return; |
| 827 | } |
| 828 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 829 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format); |
| 830 | 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] | 831 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 832 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 833 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 834 | } |
| 835 | |
| 836 | switch (target) |
| 837 | { |
| 838 | case GL_TEXTURE_2D: |
| 839 | { |
| 840 | gl::Texture2D *texture = context->getTexture2D(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 841 | 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] | 842 | if (error.isError()) |
| 843 | { |
| 844 | context->recordError(error); |
| 845 | return; |
| 846 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 847 | } |
| 848 | break; |
| 849 | |
| 850 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 851 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 852 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 853 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 854 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 855 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 856 | { |
| 857 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 858 | 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] | 859 | if (error.isError()) |
| 860 | { |
| 861 | context->recordError(error); |
| 862 | return; |
| 863 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 864 | } |
| 865 | break; |
| 866 | |
| 867 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 868 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 869 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 870 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 871 | } |
| 872 | } |
| 873 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 874 | 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] | 875 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 876 | 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] | 877 | "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] | 878 | target, level, internalformat, x, y, width, height, border); |
| 879 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 880 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 881 | if (context) |
| 882 | { |
| 883 | if (context->getClientVersion() < 3 && |
| 884 | !ValidateES2CopyTexImageParameters(context, target, level, internalformat, false, |
| 885 | 0, 0, x, y, width, height, border)) |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 886 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 887 | return; |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 888 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 889 | |
| 890 | if (context->getClientVersion() >= 3 && |
| 891 | !ValidateES3CopyTexImageParameters(context, target, level, internalformat, false, |
| 892 | 0, 0, 0, x, y, width, height, border)) |
| 893 | { |
| 894 | return; |
| 895 | } |
| 896 | |
| 897 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 898 | |
| 899 | switch (target) |
| 900 | { |
| 901 | case GL_TEXTURE_2D: |
| 902 | { |
| 903 | gl::Texture2D *texture = context->getTexture2D(); |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 904 | gl::Error error = texture->copyImage(level, internalformat, x, y, width, height, framebuffer); |
| 905 | if (error.isError()) |
| 906 | { |
| 907 | context->recordError(error); |
| 908 | return; |
| 909 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 910 | } |
| 911 | break; |
| 912 | |
| 913 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 914 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 915 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 916 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 917 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 918 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 919 | { |
| 920 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 921 | gl::Error error = texture->copyImage(target, level, internalformat, x, y, width, height, framebuffer); |
| 922 | if (error.isError()) |
| 923 | { |
| 924 | context->recordError(error); |
| 925 | return; |
| 926 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 927 | } |
| 928 | break; |
| 929 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 930 | default: |
| 931 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 932 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 933 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 934 | } |
| 935 | } |
| 936 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 937 | 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] | 938 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 939 | 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] | 940 | "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] | 941 | target, level, xoffset, yoffset, x, y, width, height); |
| 942 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 943 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 944 | if (context) |
| 945 | { |
| 946 | if (context->getClientVersion() < 3 && |
| 947 | !ValidateES2CopyTexImageParameters(context, target, level, GL_NONE, true, |
| 948 | xoffset, yoffset, x, y, width, height, 0)) |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 949 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 950 | return; |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 951 | } |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 952 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 953 | if (context->getClientVersion() >= 3 && |
| 954 | !ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true, |
| 955 | xoffset, yoffset, 0, x, y, width, height, 0)) |
| 956 | { |
| 957 | return; |
| 958 | } |
| 959 | |
| 960 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 961 | |
| 962 | switch (target) |
| 963 | { |
| 964 | case GL_TEXTURE_2D: |
| 965 | { |
| 966 | gl::Texture2D *texture = context->getTexture2D(); |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 967 | gl::Error error = texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer); |
| 968 | if (error.isError()) |
| 969 | { |
| 970 | context->recordError(error); |
| 971 | return; |
| 972 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 973 | } |
| 974 | break; |
| 975 | |
| 976 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 977 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 978 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 979 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 980 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 981 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 982 | { |
| 983 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 984 | gl::Error error = texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer); |
| 985 | if (error.isError()) |
| 986 | { |
| 987 | context->recordError(error); |
| 988 | return; |
| 989 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 990 | } |
| 991 | break; |
| 992 | |
| 993 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 994 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 995 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 996 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 997 | } |
| 998 | } |
| 999 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1000 | GLuint GL_APIENTRY glCreateProgram(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1001 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1002 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1003 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1004 | gl::Context *context = gl::getNonLostContext(); |
| 1005 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1006 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1007 | return context->createProgram(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1008 | } |
| 1009 | |
| 1010 | return 0; |
| 1011 | } |
| 1012 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1013 | GLuint GL_APIENTRY glCreateShader(GLenum type) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1014 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1015 | EVENT("(GLenum type = 0x%X)", type); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1016 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1017 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1018 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1019 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1020 | switch (type) |
| 1021 | { |
| 1022 | case GL_FRAGMENT_SHADER: |
| 1023 | case GL_VERTEX_SHADER: |
| 1024 | return context->createShader(type); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1025 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1026 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1027 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1028 | return 0; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1029 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1030 | } |
| 1031 | |
| 1032 | return 0; |
| 1033 | } |
| 1034 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1035 | void GL_APIENTRY glCullFace(GLenum mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1036 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1037 | EVENT("(GLenum mode = 0x%X)", mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1038 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1039 | gl::Context *context = gl::getNonLostContext(); |
| 1040 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1041 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1042 | switch (mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1043 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1044 | case GL_FRONT: |
| 1045 | case GL_BACK: |
| 1046 | case GL_FRONT_AND_BACK: |
| 1047 | break; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1048 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1049 | default: |
| 1050 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1051 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1052 | } |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1053 | |
| 1054 | context->getState().setCullMode(mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1055 | } |
| 1056 | } |
| 1057 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1058 | void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint* buffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1059 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1060 | 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] | 1061 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1062 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1063 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1064 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1065 | if (n < 0) |
| 1066 | { |
| 1067 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1068 | return; |
| 1069 | } |
| 1070 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1071 | for (int i = 0; i < n; i++) |
| 1072 | { |
| 1073 | context->deleteBuffer(buffers[i]); |
| 1074 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1075 | } |
| 1076 | } |
| 1077 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1078 | void GL_APIENTRY glDeleteFencesNV(GLsizei n, const GLuint* fences) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1079 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1080 | 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] | 1081 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1082 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1083 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1084 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1085 | if (n < 0) |
| 1086 | { |
| 1087 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1088 | return; |
| 1089 | } |
| 1090 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1091 | for (int i = 0; i < n; i++) |
| 1092 | { |
| 1093 | context->deleteFenceNV(fences[i]); |
| 1094 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1095 | } |
| 1096 | } |
| 1097 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1098 | void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1099 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1100 | 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] | 1101 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1102 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1103 | if (context) |
| 1104 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1105 | if (n < 0) |
| 1106 | { |
| 1107 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1108 | return; |
| 1109 | } |
| 1110 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1111 | for (int i = 0; i < n; i++) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1112 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1113 | if (framebuffers[i] != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1114 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1115 | context->deleteFramebuffer(framebuffers[i]); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1116 | } |
| 1117 | } |
| 1118 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1119 | } |
| 1120 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1121 | void GL_APIENTRY glDeleteProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1122 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1123 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1124 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1125 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1126 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1127 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1128 | if (program == 0) |
| 1129 | { |
| 1130 | return; |
| 1131 | } |
| 1132 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1133 | if (!context->getProgram(program)) |
| 1134 | { |
| 1135 | if(context->getShader(program)) |
| 1136 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1137 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1138 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1139 | } |
| 1140 | else |
| 1141 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1142 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1143 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1144 | } |
| 1145 | } |
| 1146 | |
| 1147 | context->deleteProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1148 | } |
| 1149 | } |
| 1150 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1151 | void GL_APIENTRY glDeleteQueriesEXT(GLsizei n, const GLuint *ids) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1152 | { |
| 1153 | EVENT("(GLsizei n = %d, const GLuint *ids = 0x%0.8p)", n, ids); |
| 1154 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1155 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1156 | if (context) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1157 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1158 | if (n < 0) |
| 1159 | { |
| 1160 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1161 | return; |
| 1162 | } |
| 1163 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1164 | for (int i = 0; i < n; i++) |
| 1165 | { |
| 1166 | context->deleteQuery(ids[i]); |
| 1167 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1168 | } |
| 1169 | } |
| 1170 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1171 | void GL_APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1172 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1173 | 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] | 1174 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1175 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1176 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1177 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1178 | if (n < 0) |
| 1179 | { |
| 1180 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1181 | return; |
| 1182 | } |
| 1183 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1184 | for (int i = 0; i < n; i++) |
| 1185 | { |
| 1186 | context->deleteRenderbuffer(renderbuffers[i]); |
| 1187 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1188 | } |
| 1189 | } |
| 1190 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1191 | void GL_APIENTRY glDeleteShader(GLuint shader) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1192 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1193 | EVENT("(GLuint shader = %d)", shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1194 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1195 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1196 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1197 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1198 | if (shader == 0) |
| 1199 | { |
| 1200 | return; |
| 1201 | } |
| 1202 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1203 | if (!context->getShader(shader)) |
| 1204 | { |
| 1205 | if(context->getProgram(shader)) |
| 1206 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1207 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1208 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1209 | } |
| 1210 | else |
| 1211 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1212 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1213 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1214 | } |
| 1215 | } |
| 1216 | |
| 1217 | context->deleteShader(shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1218 | } |
| 1219 | } |
| 1220 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1221 | void GL_APIENTRY glDeleteTextures(GLsizei n, const GLuint* textures) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1222 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1223 | 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] | 1224 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1225 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1226 | if (context) |
| 1227 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1228 | if (n < 0) |
| 1229 | { |
| 1230 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1231 | return; |
| 1232 | } |
| 1233 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1234 | for (int i = 0; i < n; i++) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1235 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1236 | if (textures[i] != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1237 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1238 | context->deleteTexture(textures[i]); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1239 | } |
| 1240 | } |
| 1241 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1242 | } |
| 1243 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1244 | void GL_APIENTRY glDepthFunc(GLenum func) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1245 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1246 | EVENT("(GLenum func = 0x%X)", func); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1247 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1248 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1249 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1250 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1251 | switch (func) |
| 1252 | { |
| 1253 | case GL_NEVER: |
| 1254 | case GL_ALWAYS: |
| 1255 | case GL_LESS: |
| 1256 | case GL_LEQUAL: |
| 1257 | case GL_EQUAL: |
| 1258 | case GL_GREATER: |
| 1259 | case GL_GEQUAL: |
| 1260 | case GL_NOTEQUAL: |
| 1261 | context->getState().setDepthFunc(func); |
| 1262 | break; |
| 1263 | |
| 1264 | default: |
| 1265 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1266 | return; |
| 1267 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1268 | } |
| 1269 | } |
| 1270 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1271 | void GL_APIENTRY glDepthMask(GLboolean flag) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1272 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 1273 | EVENT("(GLboolean flag = %u)", flag); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1274 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1275 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1276 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1277 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1278 | context->getState().setDepthMask(flag != GL_FALSE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1279 | } |
| 1280 | } |
| 1281 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1282 | void GL_APIENTRY glDepthRangef(GLclampf zNear, GLclampf zFar) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1283 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1284 | EVENT("(GLclampf zNear = %f, GLclampf zFar = %f)", zNear, zFar); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1285 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1286 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1287 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1288 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1289 | context->getState().setDepthRange(zNear, zFar); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1290 | } |
| 1291 | } |
| 1292 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1293 | void GL_APIENTRY glDetachShader(GLuint program, GLuint shader) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1294 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1295 | EVENT("(GLuint program = %d, GLuint shader = %d)", program, shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1296 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1297 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1298 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1299 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1300 | gl::Program *programObject = context->getProgram(program); |
| 1301 | gl::Shader *shaderObject = context->getShader(shader); |
| 1302 | |
| 1303 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1304 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1305 | gl::Shader *shaderByProgramHandle; |
| 1306 | shaderByProgramHandle = context->getShader(program); |
| 1307 | if (!shaderByProgramHandle) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1308 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1309 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1310 | return; |
daniel@transgaming.com | 73c2c2e | 2010-04-13 03:26:11 +0000 | [diff] [blame] | 1311 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1312 | else |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1313 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1314 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1315 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1316 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1317 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1318 | |
| 1319 | if (!shaderObject) |
| 1320 | { |
| 1321 | gl::Program *programByShaderHandle = context->getProgram(shader); |
| 1322 | if (!programByShaderHandle) |
| 1323 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1324 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1325 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1326 | } |
| 1327 | else |
| 1328 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1329 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1330 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1331 | } |
| 1332 | } |
| 1333 | |
| 1334 | if (!programObject->detachShader(shaderObject)) |
| 1335 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1336 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1337 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1338 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1339 | } |
| 1340 | } |
| 1341 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1342 | void GL_APIENTRY glDisable(GLenum cap) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1343 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1344 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1345 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1346 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1347 | if (context) |
| 1348 | { |
| 1349 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1350 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1351 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1352 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1353 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1354 | |
| 1355 | context->getState().setEnableFeature(cap, false); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1356 | } |
| 1357 | } |
| 1358 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1359 | void GL_APIENTRY glDisableVertexAttribArray(GLuint index) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1360 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1361 | EVENT("(GLuint index = %d)", index); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1362 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1363 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1364 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1365 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1366 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 1367 | { |
| 1368 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1369 | return; |
| 1370 | } |
| 1371 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1372 | context->getState().setEnableVertexAttribArray(index, false); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1373 | } |
| 1374 | } |
| 1375 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1376 | void GL_APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1377 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1378 | 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] | 1379 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1380 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1381 | if (context) |
| 1382 | { |
Jamie Madill | 2b97681 | 2014-08-25 15:47:49 -0400 | [diff] [blame] | 1383 | if (!ValidateDrawArrays(context, mode, first, count, 0)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1384 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1385 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1386 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1387 | |
Geoff Lang | c77e8c3 | 2014-09-08 16:28:24 -0400 | [diff] [blame] | 1388 | gl::Error error = context->drawArrays(mode, first, count, 0); |
| 1389 | if (error.isError()) |
| 1390 | { |
| 1391 | context->recordError(error); |
| 1392 | return; |
| 1393 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1394 | } |
| 1395 | } |
| 1396 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1397 | 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] | 1398 | { |
| 1399 | EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei primcount = %d)", mode, first, count, primcount); |
| 1400 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1401 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1402 | if (context) |
| 1403 | { |
Geoff Lang | 87a9330 | 2014-09-16 13:29:43 -0400 | [diff] [blame] | 1404 | if (!ValidateDrawArraysInstancedANGLE(context, mode, first, count, primcount)) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1405 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1406 | return; |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1407 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1408 | |
Geoff Lang | c77e8c3 | 2014-09-08 16:28:24 -0400 | [diff] [blame] | 1409 | gl::Error error = context->drawArrays(mode, first, count, primcount); |
| 1410 | if (error.isError()) |
| 1411 | { |
| 1412 | context->recordError(error); |
| 1413 | return; |
| 1414 | } |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1415 | } |
| 1416 | } |
| 1417 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1418 | 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] | 1419 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1420 | 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] | 1421 | mode, count, type, indices); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1422 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1423 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1424 | if (context) |
| 1425 | { |
Jamie Madill | 2b97681 | 2014-08-25 15:47:49 -0400 | [diff] [blame] | 1426 | rx::RangeUI indexRange; |
| 1427 | if (!ValidateDrawElements(context, mode, count, type, indices, 0, &indexRange)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1428 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1429 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1430 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1431 | |
Geoff Lang | c77e8c3 | 2014-09-08 16:28:24 -0400 | [diff] [blame] | 1432 | gl::Error error = context->drawElements(mode, count, type, indices, 0, indexRange); |
| 1433 | if (error.isError()) |
| 1434 | { |
| 1435 | context->recordError(error); |
| 1436 | return; |
| 1437 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1438 | } |
| 1439 | } |
| 1440 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1441 | 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] | 1442 | { |
| 1443 | EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei primcount = %d)", |
| 1444 | mode, count, type, indices, primcount); |
| 1445 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1446 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1447 | if (context) |
| 1448 | { |
Jamie Madill | 2b97681 | 2014-08-25 15:47:49 -0400 | [diff] [blame] | 1449 | rx::RangeUI indexRange; |
Geoff Lang | 87a9330 | 2014-09-16 13:29:43 -0400 | [diff] [blame] | 1450 | if (!ValidateDrawElementsInstancedANGLE(context, mode, count, type, indices, primcount, &indexRange)) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1451 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1452 | return; |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1453 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1454 | |
Geoff Lang | c77e8c3 | 2014-09-08 16:28:24 -0400 | [diff] [blame] | 1455 | gl::Error error = context->drawElements(mode, count, type, indices, primcount, indexRange); |
| 1456 | if (error.isError()) |
| 1457 | { |
| 1458 | context->recordError(error); |
| 1459 | return; |
| 1460 | } |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1461 | } |
| 1462 | } |
| 1463 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1464 | void GL_APIENTRY glEnable(GLenum cap) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1465 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1466 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1467 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1468 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1469 | if (context) |
| 1470 | { |
| 1471 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1472 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1473 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1474 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1475 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1476 | |
| 1477 | context->getState().setEnableFeature(cap, true); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1478 | } |
| 1479 | } |
| 1480 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1481 | void GL_APIENTRY glEnableVertexAttribArray(GLuint index) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1482 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1483 | EVENT("(GLuint index = %d)", index); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1484 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1485 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1486 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1487 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1488 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 1489 | { |
| 1490 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1491 | return; |
| 1492 | } |
| 1493 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1494 | context->getState().setEnableVertexAttribArray(index, true); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1495 | } |
| 1496 | } |
| 1497 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1498 | void GL_APIENTRY glEndQueryEXT(GLenum target) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1499 | { |
| 1500 | EVENT("GLenum target = 0x%X)", target); |
| 1501 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1502 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1503 | if (context) |
| 1504 | { |
| 1505 | if (!ValidateEndQuery(context, target)) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1506 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1507 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1508 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1509 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 1510 | gl::Error error = context->endQuery(target); |
| 1511 | if (error.isError()) |
| 1512 | { |
| 1513 | context->recordError(error); |
| 1514 | return; |
| 1515 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1516 | } |
| 1517 | } |
| 1518 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1519 | void GL_APIENTRY glFinishFenceNV(GLuint fence) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1520 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1521 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1522 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1523 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1524 | if (context) |
| 1525 | { |
| 1526 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 1527 | |
| 1528 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1529 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1530 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1531 | return; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1532 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1533 | |
| 1534 | if (fenceObject->isFence() != GL_TRUE) |
| 1535 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1536 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1537 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1538 | } |
| 1539 | |
| 1540 | fenceObject->finishFence(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1541 | } |
| 1542 | } |
| 1543 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1544 | void GL_APIENTRY glFinish(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1545 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1546 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1547 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1548 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1549 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1550 | { |
Geoff Lang | 2629856 | 2014-10-01 10:49:03 -0400 | [diff] [blame] | 1551 | gl::Error error = context->sync(true); |
| 1552 | if (error.isError()) |
| 1553 | { |
| 1554 | context->recordError(error); |
| 1555 | return; |
| 1556 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1557 | } |
| 1558 | } |
| 1559 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1560 | void GL_APIENTRY glFlush(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1561 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1562 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1563 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1564 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1565 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1566 | { |
Geoff Lang | 2629856 | 2014-10-01 10:49:03 -0400 | [diff] [blame] | 1567 | gl::Error error = context->sync(false); |
| 1568 | if (error.isError()) |
| 1569 | { |
| 1570 | context->recordError(error); |
| 1571 | return; |
| 1572 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1573 | } |
| 1574 | } |
| 1575 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1576 | 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] | 1577 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1578 | 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] | 1579 | "GLuint renderbuffer = %d)", target, attachment, renderbuffertarget, renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1580 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1581 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1582 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1583 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1584 | if (!gl::ValidFramebufferTarget(target) || (renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0)) |
| 1585 | { |
| 1586 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1587 | return; |
| 1588 | } |
| 1589 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1590 | if (!gl::ValidateFramebufferRenderbufferParameters(context, target, attachment, renderbuffertarget, renderbuffer)) |
| 1591 | { |
| 1592 | return; |
| 1593 | } |
| 1594 | |
| 1595 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 1596 | ASSERT(framebuffer); |
| 1597 | |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 1598 | if (renderbuffer != 0) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1599 | { |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 1600 | gl::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer); |
| 1601 | framebuffer->setRenderbufferAttachment(attachment, renderbufferObject); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1602 | } |
| 1603 | else |
| 1604 | { |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 1605 | framebuffer->setNULLAttachment(attachment); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1606 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1607 | } |
| 1608 | } |
| 1609 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1610 | 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] | 1611 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1612 | 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] | 1613 | "GLuint texture = %d, GLint level = %d)", target, attachment, textarget, texture, level); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1614 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1615 | gl::Context *context = gl::getNonLostContext(); |
| 1616 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1617 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1618 | if (!ValidateFramebufferTexture2D(context, target, attachment, textarget, texture, level)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1619 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1620 | return; |
| 1621 | } |
shannon.woods%transgaming.com@gtempaccount.com | 89ae113 | 2013-04-13 03:28:43 +0000 | [diff] [blame] | 1622 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1623 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 1624 | ASSERT(framebuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1625 | |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 1626 | if (texture != 0) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1627 | { |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 1628 | gl::Texture *textureObj = context->getTexture(texture); |
| 1629 | gl::ImageIndex index(textarget, level, gl::ImageIndex::ENTIRE_LEVEL); |
| 1630 | framebuffer->setTextureAttachment(attachment, textureObj, index); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1631 | } |
| 1632 | else |
| 1633 | { |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 1634 | framebuffer->setNULLAttachment(attachment); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1635 | } |
| 1636 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1637 | } |
| 1638 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1639 | void GL_APIENTRY glFrontFace(GLenum mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1640 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1641 | EVENT("(GLenum mode = 0x%X)", mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1642 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1643 | gl::Context *context = gl::getNonLostContext(); |
| 1644 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1645 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1646 | switch (mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1647 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1648 | case GL_CW: |
| 1649 | case GL_CCW: |
| 1650 | context->getState().setFrontFace(mode); |
| 1651 | break; |
| 1652 | default: |
| 1653 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1654 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1655 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1656 | } |
| 1657 | } |
| 1658 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1659 | void GL_APIENTRY glGenBuffers(GLsizei n, GLuint* buffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1660 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1661 | EVENT("(GLsizei n = %d, GLuint* buffers = 0x%0.8p)", n, buffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1662 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1663 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1664 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1665 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1666 | if (n < 0) |
| 1667 | { |
| 1668 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1669 | return; |
| 1670 | } |
| 1671 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1672 | for (int i = 0; i < n; i++) |
| 1673 | { |
| 1674 | buffers[i] = context->createBuffer(); |
| 1675 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1676 | } |
| 1677 | } |
| 1678 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1679 | void GL_APIENTRY glGenerateMipmap(GLenum target) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1680 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1681 | EVENT("(GLenum target = 0x%X)", target); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1682 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1683 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1684 | if (context) |
| 1685 | { |
| 1686 | if (!ValidTextureTarget(context, target)) |
daniel@transgaming.com | 8fd99e2 | 2010-04-20 18:52:00 +0000 | [diff] [blame] | 1687 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1688 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1689 | return; |
daniel@transgaming.com | 8fd99e2 | 2010-04-20 18:52:00 +0000 | [diff] [blame] | 1690 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1691 | |
| 1692 | gl::Texture *texture = context->getTargetTexture(target); |
| 1693 | |
| 1694 | if (texture == NULL) |
| 1695 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1696 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1697 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1698 | } |
| 1699 | |
| 1700 | GLenum internalFormat = texture->getBaseLevelInternalFormat(); |
| 1701 | const gl::TextureCaps &formatCaps = context->getTextureCaps().get(internalFormat); |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 1702 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1703 | |
| 1704 | // GenerateMipmap should not generate an INVALID_OPERATION for textures created with |
| 1705 | // unsized formats or that are color renderable and filterable. Since we do not track if |
| 1706 | // the texture was created with sized or unsized format (only sized formats are stored), |
| 1707 | // it is not possible to make sure the the LUMA formats can generate mipmaps (they should |
| 1708 | // be able to) because they aren't color renderable. Simply do a special case for LUMA |
| 1709 | // textures since they're the only texture format that can be created with unsized formats |
| 1710 | // that is not color renderable. New unsized formats are unlikely to be added, since ES2 |
| 1711 | // was the last version to use add them. |
| 1712 | bool isLUMA = internalFormat == GL_LUMINANCE8_EXT || |
| 1713 | internalFormat == GL_LUMINANCE8_ALPHA8_EXT || |
| 1714 | internalFormat == GL_ALPHA8_EXT; |
| 1715 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 1716 | if (formatInfo.depthBits > 0 || formatInfo.stencilBits > 0 || !formatCaps.filterable || |
| 1717 | (!formatCaps.renderable && !isLUMA) || formatInfo.compressed) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1718 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1719 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1720 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1721 | } |
| 1722 | |
| 1723 | // GL_EXT_sRGB does not support mipmap generation on sRGB textures |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 1724 | if (context->getClientVersion() == 2 && formatInfo.colorEncoding == GL_SRGB) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1725 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1726 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1727 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1728 | } |
| 1729 | |
| 1730 | // Non-power of 2 ES2 check |
| 1731 | if (!context->getExtensions().textureNPOT && (!gl::isPow2(texture->getBaseLevelWidth()) || !gl::isPow2(texture->getBaseLevelHeight()))) |
| 1732 | { |
| 1733 | 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] | 1734 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1735 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1736 | } |
| 1737 | |
| 1738 | // Cube completeness check |
| 1739 | if (target == GL_TEXTURE_CUBE_MAP) |
| 1740 | { |
| 1741 | gl::TextureCubeMap *textureCube = static_cast<gl::TextureCubeMap *>(texture); |
| 1742 | if (!textureCube->isCubeComplete()) |
| 1743 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1744 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1745 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1746 | } |
| 1747 | } |
| 1748 | |
Geoff Lang | 06ecf3d | 2014-09-23 16:39:50 -0400 | [diff] [blame] | 1749 | gl::Error error = texture->generateMipmaps(); |
| 1750 | if (error.isError()) |
| 1751 | { |
| 1752 | context->recordError(error); |
| 1753 | return; |
| 1754 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1755 | } |
| 1756 | } |
| 1757 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1758 | void GL_APIENTRY glGenFencesNV(GLsizei n, GLuint* fences) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1759 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1760 | EVENT("(GLsizei n = %d, GLuint* fences = 0x%0.8p)", n, fences); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1761 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1762 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1763 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1764 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1765 | if (n < 0) |
| 1766 | { |
| 1767 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1768 | return; |
| 1769 | } |
| 1770 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1771 | for (int i = 0; i < n; i++) |
| 1772 | { |
| 1773 | fences[i] = context->createFenceNV(); |
| 1774 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1775 | } |
| 1776 | } |
| 1777 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1778 | void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1779 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1780 | EVENT("(GLsizei n = %d, GLuint* framebuffers = 0x%0.8p)", n, framebuffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1781 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1782 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1783 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1784 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1785 | if (n < 0) |
| 1786 | { |
| 1787 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1788 | return; |
| 1789 | } |
| 1790 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1791 | for (int i = 0; i < n; i++) |
| 1792 | { |
| 1793 | framebuffers[i] = context->createFramebuffer(); |
| 1794 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1795 | } |
| 1796 | } |
| 1797 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1798 | void GL_APIENTRY glGenQueriesEXT(GLsizei n, GLuint* ids) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1799 | { |
| 1800 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 1801 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1802 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1803 | if (context) |
| 1804 | { |
| 1805 | if (n < 0) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1806 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1807 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1808 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1809 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1810 | |
| 1811 | for (GLsizei i = 0; i < n; i++) |
| 1812 | { |
| 1813 | ids[i] = context->createQuery(); |
| 1814 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1815 | } |
| 1816 | } |
| 1817 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1818 | void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1819 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1820 | EVENT("(GLsizei n = %d, GLuint* renderbuffers = 0x%0.8p)", n, renderbuffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1821 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1822 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1823 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1824 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1825 | if (n < 0) |
| 1826 | { |
| 1827 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1828 | return; |
| 1829 | } |
| 1830 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1831 | for (int i = 0; i < n; i++) |
| 1832 | { |
| 1833 | renderbuffers[i] = context->createRenderbuffer(); |
| 1834 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1835 | } |
| 1836 | } |
| 1837 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1838 | void GL_APIENTRY glGenTextures(GLsizei n, GLuint* textures) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1839 | { |
Jamie Madill | 1fc7e2c | 2014-01-21 16:47:10 -0500 | [diff] [blame] | 1840 | EVENT("(GLsizei n = %d, GLuint* textures = 0x%0.8p)", n, textures); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1841 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1842 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1843 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1844 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1845 | if (n < 0) |
| 1846 | { |
| 1847 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1848 | return; |
| 1849 | } |
| 1850 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1851 | for (int i = 0; i < n; i++) |
| 1852 | { |
| 1853 | textures[i] = context->createTexture(); |
| 1854 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1855 | } |
| 1856 | } |
| 1857 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1858 | 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] | 1859 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1860 | 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] | 1861 | "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] | 1862 | program, index, bufsize, length, size, type, name); |
| 1863 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1864 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1865 | if (context) |
| 1866 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1867 | if (bufsize < 0) |
| 1868 | { |
| 1869 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1870 | return; |
| 1871 | } |
| 1872 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1873 | gl::Program *programObject = context->getProgram(program); |
| 1874 | |
| 1875 | if (!programObject) |
| 1876 | { |
| 1877 | if (context->getShader(program)) |
| 1878 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1879 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1880 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1881 | } |
| 1882 | else |
| 1883 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1884 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1885 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1886 | } |
| 1887 | } |
| 1888 | |
| 1889 | if (index >= (GLuint)programObject->getActiveAttributeCount()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1890 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1891 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1892 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1893 | } |
| 1894 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1895 | programObject->getActiveAttribute(index, bufsize, length, size, type, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1896 | } |
| 1897 | } |
| 1898 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1899 | 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] | 1900 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1901 | EVENT("(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, " |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 1902 | "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] | 1903 | program, index, bufsize, length, size, type, name); |
| 1904 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1905 | |
| 1906 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1907 | if (context) |
| 1908 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1909 | if (bufsize < 0) |
| 1910 | { |
| 1911 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1912 | return; |
| 1913 | } |
| 1914 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1915 | gl::Program *programObject = context->getProgram(program); |
| 1916 | |
| 1917 | if (!programObject) |
| 1918 | { |
| 1919 | if (context->getShader(program)) |
| 1920 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1921 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1922 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1923 | } |
| 1924 | else |
| 1925 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1926 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1927 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1928 | } |
| 1929 | } |
| 1930 | |
| 1931 | if (index >= (GLuint)programObject->getActiveUniformCount()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1932 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1933 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1934 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1935 | } |
| 1936 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1937 | programObject->getActiveUniform(index, bufsize, length, size, type, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1938 | } |
| 1939 | } |
| 1940 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1941 | 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] | 1942 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1943 | 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] | 1944 | program, maxcount, count, shaders); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1945 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1946 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1947 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1948 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1949 | if (maxcount < 0) |
| 1950 | { |
| 1951 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1952 | return; |
| 1953 | } |
| 1954 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1955 | gl::Program *programObject = context->getProgram(program); |
| 1956 | |
| 1957 | if (!programObject) |
| 1958 | { |
| 1959 | if (context->getShader(program)) |
| 1960 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1961 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1962 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1963 | } |
| 1964 | else |
| 1965 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1966 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1967 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1968 | } |
| 1969 | } |
| 1970 | |
| 1971 | return programObject->getAttachedShaders(maxcount, count, shaders); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1972 | } |
| 1973 | } |
| 1974 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1975 | GLint GL_APIENTRY glGetAttribLocation(GLuint program, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1976 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1977 | EVENT("(GLuint program = %d, const GLchar* name = %s)", program, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1978 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1979 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1980 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1981 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1982 | gl::Program *programObject = context->getProgram(program); |
| 1983 | |
| 1984 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1985 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1986 | if (context->getShader(program)) |
daniel@transgaming.com | cf4aa87 | 2010-04-13 03:26:27 +0000 | [diff] [blame] | 1987 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1988 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1989 | return -1; |
daniel@transgaming.com | cf4aa87 | 2010-04-13 03:26:27 +0000 | [diff] [blame] | 1990 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1991 | else |
| 1992 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1993 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1994 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1995 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1996 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1997 | |
| 1998 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 1999 | if (!programObject->isLinked() || !programBinary) |
| 2000 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2001 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2002 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2003 | } |
| 2004 | |
| 2005 | return programBinary->getAttributeLocation(name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2006 | } |
| 2007 | |
| 2008 | return -1; |
| 2009 | } |
| 2010 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2011 | void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2012 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2013 | 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] | 2014 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2015 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2016 | if (context) |
| 2017 | { |
| 2018 | GLenum nativeType; |
| 2019 | unsigned int numParams = 0; |
| 2020 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2021 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2022 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2023 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2024 | |
| 2025 | if (nativeType == GL_BOOL) |
| 2026 | { |
| 2027 | context->getBooleanv(pname, params); |
| 2028 | } |
| 2029 | else |
| 2030 | { |
| 2031 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2032 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2033 | } |
| 2034 | } |
| 2035 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2036 | void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2037 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2038 | 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] | 2039 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2040 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2041 | if (context) |
| 2042 | { |
| 2043 | if (!gl::ValidBufferTarget(context, target)) |
daniel@transgaming.com | aa0ccbd | 2010-04-15 20:45:05 +0000 | [diff] [blame] | 2044 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2045 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2046 | return; |
daniel@transgaming.com | aa0ccbd | 2010-04-15 20:45:05 +0000 | [diff] [blame] | 2047 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2048 | |
| 2049 | if (!gl::ValidBufferParameter(context, pname)) |
| 2050 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2051 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2052 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2053 | } |
| 2054 | |
| 2055 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 2056 | |
| 2057 | if (!buffer) |
| 2058 | { |
| 2059 | // 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] | 2060 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2061 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2062 | } |
| 2063 | |
| 2064 | switch (pname) |
| 2065 | { |
| 2066 | case GL_BUFFER_USAGE: |
| 2067 | *params = static_cast<GLint>(buffer->getUsage()); |
| 2068 | break; |
| 2069 | case GL_BUFFER_SIZE: |
| 2070 | *params = gl::clampCast<GLint>(buffer->getSize()); |
| 2071 | break; |
| 2072 | case GL_BUFFER_ACCESS_FLAGS: |
| 2073 | *params = buffer->getAccessFlags(); |
| 2074 | break; |
| 2075 | case GL_BUFFER_MAPPED: |
| 2076 | *params = static_cast<GLint>(buffer->isMapped()); |
| 2077 | break; |
| 2078 | case GL_BUFFER_MAP_OFFSET: |
| 2079 | *params = gl::clampCast<GLint>(buffer->getMapOffset()); |
| 2080 | break; |
| 2081 | case GL_BUFFER_MAP_LENGTH: |
| 2082 | *params = gl::clampCast<GLint>(buffer->getMapLength()); |
| 2083 | break; |
| 2084 | default: UNREACHABLE(); break; |
| 2085 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2086 | } |
| 2087 | } |
| 2088 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2089 | GLenum GL_APIENTRY glGetError(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2090 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2091 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2092 | |
| 2093 | gl::Context *context = gl::getContext(); |
| 2094 | |
| 2095 | if (context) |
| 2096 | { |
daniel@transgaming.com | 82b2891 | 2011-12-12 21:01:35 +0000 | [diff] [blame] | 2097 | return context->getError(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2098 | } |
| 2099 | |
| 2100 | return GL_NO_ERROR; |
| 2101 | } |
| 2102 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2103 | void GL_APIENTRY glGetFenceivNV(GLuint fence, GLenum pname, GLint *params) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2104 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2105 | 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] | 2106 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2107 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2108 | if (context) |
| 2109 | { |
| 2110 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 2111 | |
| 2112 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2113 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2114 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2115 | return; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2116 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2117 | |
| 2118 | if (fenceObject->isFence() != GL_TRUE) |
| 2119 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2120 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2121 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2122 | } |
| 2123 | |
| 2124 | switch (pname) |
| 2125 | { |
| 2126 | case GL_FENCE_STATUS_NV: |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 2127 | { |
| 2128 | // GL_NV_fence spec: |
| 2129 | // Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV |
| 2130 | // or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence. |
| 2131 | GLboolean status = GL_TRUE; |
| 2132 | if (fenceObject->getStatus() != GL_TRUE) |
| 2133 | { |
| 2134 | gl::Error error = fenceObject->testFence(&status); |
| 2135 | if (error.isError()) |
| 2136 | { |
| 2137 | context->recordError(error); |
| 2138 | return; |
| 2139 | } |
| 2140 | } |
| 2141 | *params = status; |
| 2142 | break; |
| 2143 | } |
| 2144 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2145 | case GL_FENCE_CONDITION_NV: |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 2146 | { |
| 2147 | *params = fenceObject->getCondition(); |
| 2148 | break; |
| 2149 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2150 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2151 | default: |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 2152 | { |
| 2153 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2154 | return; |
| 2155 | } |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 2156 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2157 | } |
| 2158 | } |
| 2159 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2160 | void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2161 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2162 | 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] | 2163 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2164 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2165 | if (context) |
| 2166 | { |
| 2167 | GLenum nativeType; |
| 2168 | unsigned int numParams = 0; |
| 2169 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 32e58cd | 2010-03-24 09:44:10 +0000 | [diff] [blame] | 2170 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2171 | return; |
daniel@transgaming.com | 32e58cd | 2010-03-24 09:44:10 +0000 | [diff] [blame] | 2172 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2173 | |
| 2174 | if (nativeType == GL_FLOAT) |
| 2175 | { |
| 2176 | context->getFloatv(pname, params); |
| 2177 | } |
| 2178 | else |
| 2179 | { |
| 2180 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2181 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2182 | } |
| 2183 | } |
| 2184 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2185 | 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] | 2186 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2187 | 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] | 2188 | target, attachment, pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2189 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2190 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2191 | if (context) |
| 2192 | { |
| 2193 | if (!gl::ValidFramebufferTarget(target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2194 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2195 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2196 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2197 | } |
| 2198 | |
| 2199 | int clientVersion = context->getClientVersion(); |
| 2200 | |
| 2201 | switch (pname) |
| 2202 | { |
| 2203 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2204 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2205 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| 2206 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| 2207 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2208 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2209 | case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: |
| 2210 | if (clientVersion < 3 && !context->getExtensions().sRGB) |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2211 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2212 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2213 | return; |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2214 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2215 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2216 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2217 | case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: |
| 2218 | case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: |
| 2219 | case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: |
| 2220 | case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: |
| 2221 | case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: |
| 2222 | case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: |
| 2223 | case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: |
| 2224 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: |
| 2225 | if (clientVersion < 3) |
| 2226 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2227 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2228 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2229 | } |
| 2230 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2231 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2232 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2233 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2234 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2235 | } |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2236 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2237 | // Determine if the attachment is a valid enum |
| 2238 | switch (attachment) |
| 2239 | { |
| 2240 | case GL_BACK: |
| 2241 | case GL_FRONT: |
| 2242 | case GL_DEPTH: |
| 2243 | case GL_STENCIL: |
| 2244 | case GL_DEPTH_STENCIL_ATTACHMENT: |
| 2245 | if (clientVersion < 3) |
| 2246 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2247 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2248 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2249 | } |
| 2250 | break; |
| 2251 | |
| 2252 | case GL_DEPTH_ATTACHMENT: |
| 2253 | case GL_STENCIL_ATTACHMENT: |
| 2254 | break; |
| 2255 | |
| 2256 | default: |
| 2257 | if (attachment < GL_COLOR_ATTACHMENT0_EXT || |
| 2258 | (attachment - GL_COLOR_ATTACHMENT0_EXT) >= context->getCaps().maxColorAttachments) |
| 2259 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2260 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2261 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2262 | } |
| 2263 | break; |
| 2264 | } |
| 2265 | |
| 2266 | GLuint framebufferHandle = context->getState().getTargetFramebuffer(target)->id(); |
| 2267 | gl::Framebuffer *framebuffer = context->getFramebuffer(framebufferHandle); |
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 | |
| 2270 | if (framebufferHandle == 0) |
| 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 | |
| 2319 | GLenum attachmentType = GL_NONE; |
| 2320 | GLuint attachmentHandle = 0; |
| 2321 | GLuint attachmentLevel = 0; |
| 2322 | GLuint attachmentLayer = 0; |
| 2323 | |
| 2324 | const gl::FramebufferAttachment *attachmentObject = framebuffer->getAttachment(attachment); |
| 2325 | |
| 2326 | if (attachmentObject) |
| 2327 | { |
| 2328 | attachmentType = attachmentObject->type(); |
| 2329 | attachmentHandle = attachmentObject->id(); |
| 2330 | attachmentLevel = attachmentObject->mipLevel(); |
| 2331 | attachmentLayer = attachmentObject->layer(); |
| 2332 | } |
| 2333 | |
| 2334 | GLenum attachmentObjectType; // Type category |
| 2335 | if (framebufferHandle == 0) |
| 2336 | { |
| 2337 | attachmentObjectType = GL_FRAMEBUFFER_DEFAULT; |
| 2338 | } |
| 2339 | else if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER) |
| 2340 | { |
| 2341 | attachmentObjectType = attachmentType; |
| 2342 | } |
| 2343 | else if (gl::ValidTexture2DDestinationTarget(context, attachmentType)) |
| 2344 | { |
| 2345 | attachmentObjectType = GL_TEXTURE; |
| 2346 | } |
| 2347 | else |
| 2348 | { |
| 2349 | UNREACHABLE(); |
| 2350 | return; |
| 2351 | } |
| 2352 | |
| 2353 | if (attachmentObjectType == GL_NONE) |
| 2354 | { |
| 2355 | // ES 2.0.25 spec pg 127 states that if the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE |
| 2356 | // is NONE, then querying any other pname will generate INVALID_ENUM. |
| 2357 | |
| 2358 | // ES 3.0.2 spec pg 235 states that if the attachment type is none, |
| 2359 | // GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero and be an |
| 2360 | // INVALID_OPERATION for all other pnames |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 2361 | |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2362 | switch (pname) |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2363 | { |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2364 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2365 | *params = attachmentObjectType; |
| 2366 | break; |
| 2367 | |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2368 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
Geoff Lang | 05b0502 | 2014-06-11 15:31:45 -0400 | [diff] [blame] | 2369 | if (clientVersion < 3) |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2370 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2371 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2372 | return; |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2373 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2374 | *params = 0; |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2375 | break; |
| 2376 | |
| 2377 | default: |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 2378 | if (clientVersion < 3) |
shannon.woods%transgaming.com@gtempaccount.com | 89ae113 | 2013-04-13 03:28:43 +0000 | [diff] [blame] | 2379 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2380 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2381 | return; |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2382 | } |
| 2383 | else |
| 2384 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2385 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2386 | return; |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2387 | } |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2388 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2389 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2390 | else |
| 2391 | { |
| 2392 | ASSERT(attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE || |
| 2393 | attachmentObjectType == GL_FRAMEBUFFER_DEFAULT); |
| 2394 | ASSERT(attachmentObject != NULL); |
| 2395 | |
| 2396 | switch (pname) |
| 2397 | { |
| 2398 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2399 | *params = attachmentObjectType; |
| 2400 | break; |
| 2401 | |
| 2402 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2403 | if (attachmentObjectType != GL_RENDERBUFFER && attachmentObjectType != GL_TEXTURE) |
| 2404 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2405 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2406 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2407 | } |
| 2408 | *params = attachmentHandle; |
| 2409 | break; |
| 2410 | |
| 2411 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| 2412 | if (attachmentObjectType != GL_TEXTURE) |
| 2413 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2414 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2415 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2416 | } |
| 2417 | *params = attachmentLevel; |
| 2418 | break; |
| 2419 | |
| 2420 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| 2421 | if (attachmentObjectType != GL_TEXTURE) |
| 2422 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2423 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2424 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2425 | } |
| 2426 | *params = gl::IsCubemapTextureTarget(attachmentType) ? attachmentType : 0; |
| 2427 | break; |
| 2428 | |
| 2429 | case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: |
| 2430 | *params = attachmentObject->getRedSize(); |
| 2431 | break; |
| 2432 | |
| 2433 | case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: |
| 2434 | *params = attachmentObject->getGreenSize(); |
| 2435 | break; |
| 2436 | |
| 2437 | case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: |
| 2438 | *params = attachmentObject->getBlueSize(); |
| 2439 | break; |
| 2440 | |
| 2441 | case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: |
| 2442 | *params = attachmentObject->getAlphaSize(); |
| 2443 | break; |
| 2444 | |
| 2445 | case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: |
| 2446 | *params = attachmentObject->getDepthSize(); |
| 2447 | break; |
| 2448 | |
| 2449 | case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: |
| 2450 | *params = attachmentObject->getStencilSize(); |
| 2451 | break; |
| 2452 | |
| 2453 | case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: |
Jamie Madill | ee85d1b | 2014-09-17 10:35:23 -0400 | [diff] [blame] | 2454 | if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2455 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2456 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2457 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2458 | } |
| 2459 | *params = attachmentObject->getComponentType(); |
| 2460 | break; |
| 2461 | |
| 2462 | case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: |
| 2463 | *params = attachmentObject->getColorEncoding(); |
| 2464 | break; |
| 2465 | |
| 2466 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: |
| 2467 | if (attachmentObjectType != GL_TEXTURE) |
| 2468 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2469 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2470 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2471 | } |
| 2472 | *params = attachmentLayer; |
| 2473 | break; |
| 2474 | |
| 2475 | default: |
| 2476 | UNREACHABLE(); |
| 2477 | break; |
| 2478 | } |
| 2479 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2480 | } |
| 2481 | } |
| 2482 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2483 | GLenum GL_APIENTRY glGetGraphicsResetStatusEXT(void) |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2484 | { |
| 2485 | EVENT("()"); |
| 2486 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2487 | gl::Context *context = gl::getContext(); |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2488 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2489 | if (context) |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2490 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2491 | return context->getResetStatus(); |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2492 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2493 | |
| 2494 | return GL_NO_ERROR; |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2495 | } |
| 2496 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2497 | void GL_APIENTRY glGetIntegerv(GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2498 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2499 | 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] | 2500 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2501 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2502 | if (context) |
| 2503 | { |
| 2504 | GLenum nativeType; |
| 2505 | unsigned int numParams = 0; |
| 2506 | |
| 2507 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2508 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2509 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2510 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2511 | |
| 2512 | if (nativeType == GL_INT) |
| 2513 | { |
| 2514 | context->getIntegerv(pname, params); |
| 2515 | } |
| 2516 | else |
| 2517 | { |
| 2518 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2519 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2520 | } |
| 2521 | } |
| 2522 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2523 | void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2524 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2525 | 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] | 2526 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2527 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2528 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2529 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2530 | gl::Program *programObject = context->getProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2531 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2532 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2533 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2534 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2535 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2536 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2537 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2538 | if (context->getClientVersion() < 3) |
| 2539 | { |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2540 | switch (pname) |
| 2541 | { |
shannonwoods@chromium.org | e684b58 | 2013-05-30 00:07:42 +0000 | [diff] [blame] | 2542 | case GL_ACTIVE_UNIFORM_BLOCKS: |
shannonwoods@chromium.org | e684b58 | 2013-05-30 00:07:42 +0000 | [diff] [blame] | 2543 | case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2544 | case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2545 | case GL_TRANSFORM_FEEDBACK_VARYINGS: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2546 | case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2547 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2548 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2549 | } |
| 2550 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2551 | |
| 2552 | switch (pname) |
| 2553 | { |
| 2554 | case GL_DELETE_STATUS: |
| 2555 | *params = programObject->isFlaggedForDeletion(); |
| 2556 | return; |
| 2557 | case GL_LINK_STATUS: |
| 2558 | *params = programObject->isLinked(); |
| 2559 | return; |
| 2560 | case GL_VALIDATE_STATUS: |
| 2561 | *params = programObject->isValidated(); |
| 2562 | return; |
| 2563 | case GL_INFO_LOG_LENGTH: |
| 2564 | *params = programObject->getInfoLogLength(); |
| 2565 | return; |
| 2566 | case GL_ATTACHED_SHADERS: |
| 2567 | *params = programObject->getAttachedShadersCount(); |
| 2568 | return; |
| 2569 | case GL_ACTIVE_ATTRIBUTES: |
| 2570 | *params = programObject->getActiveAttributeCount(); |
| 2571 | return; |
| 2572 | case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH: |
| 2573 | *params = programObject->getActiveAttributeMaxLength(); |
| 2574 | return; |
| 2575 | case GL_ACTIVE_UNIFORMS: |
| 2576 | *params = programObject->getActiveUniformCount(); |
| 2577 | return; |
| 2578 | case GL_ACTIVE_UNIFORM_MAX_LENGTH: |
| 2579 | *params = programObject->getActiveUniformMaxLength(); |
| 2580 | return; |
| 2581 | case GL_PROGRAM_BINARY_LENGTH_OES: |
| 2582 | *params = programObject->getProgramBinaryLength(); |
| 2583 | return; |
| 2584 | case GL_ACTIVE_UNIFORM_BLOCKS: |
| 2585 | *params = programObject->getActiveUniformBlockCount(); |
| 2586 | return; |
| 2587 | case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: |
| 2588 | *params = programObject->getActiveUniformBlockMaxLength(); |
| 2589 | break; |
| 2590 | case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: |
| 2591 | *params = programObject->getTransformFeedbackBufferMode(); |
| 2592 | break; |
| 2593 | case GL_TRANSFORM_FEEDBACK_VARYINGS: |
| 2594 | *params = programObject->getTransformFeedbackVaryingCount(); |
| 2595 | break; |
| 2596 | case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: |
| 2597 | *params = programObject->getTransformFeedbackVaryingMaxLength(); |
| 2598 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2599 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2600 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2601 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2602 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2603 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2604 | } |
| 2605 | } |
| 2606 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2607 | 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] | 2608 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2609 | 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] | 2610 | program, bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2611 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2612 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2613 | if (context) |
| 2614 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2615 | if (bufsize < 0) |
| 2616 | { |
| 2617 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2618 | return; |
| 2619 | } |
| 2620 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2621 | gl::Program *programObject = context->getProgram(program); |
| 2622 | |
| 2623 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2624 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2625 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2626 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2627 | } |
| 2628 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2629 | programObject->getInfoLog(bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2630 | } |
| 2631 | } |
| 2632 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2633 | void GL_APIENTRY glGetQueryivEXT(GLenum target, GLenum pname, GLint *params) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2634 | { |
| 2635 | EVENT("GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname, params); |
| 2636 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2637 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2638 | if (context) |
| 2639 | { |
| 2640 | if (!ValidQueryType(context, target)) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2641 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2642 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2643 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2644 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2645 | |
| 2646 | switch (pname) |
| 2647 | { |
| 2648 | case GL_CURRENT_QUERY_EXT: |
| 2649 | params[0] = context->getState().getActiveQueryId(target); |
| 2650 | break; |
| 2651 | |
| 2652 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2653 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2654 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2655 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2656 | } |
| 2657 | } |
| 2658 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2659 | void GL_APIENTRY glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2660 | { |
| 2661 | EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)", id, pname, params); |
| 2662 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2663 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2664 | if (context) |
| 2665 | { |
| 2666 | gl::Query *queryObject = context->getQuery(id, false, GL_NONE); |
| 2667 | |
| 2668 | if (!queryObject) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2669 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2670 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2671 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2672 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2673 | |
| 2674 | if (context->getState().getActiveQueryId(queryObject->getType()) == id) |
| 2675 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2676 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2677 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2678 | } |
| 2679 | |
| 2680 | switch(pname) |
| 2681 | { |
| 2682 | case GL_QUERY_RESULT_EXT: |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2683 | { |
| 2684 | gl::Error error = queryObject->getResult(params); |
| 2685 | if (error.isError()) |
| 2686 | { |
| 2687 | context->recordError(error); |
| 2688 | return; |
| 2689 | } |
| 2690 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2691 | break; |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2692 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2693 | case GL_QUERY_RESULT_AVAILABLE_EXT: |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2694 | { |
| 2695 | gl::Error error = queryObject->isResultAvailable(params); |
| 2696 | if (error.isError()) |
| 2697 | { |
| 2698 | context->recordError(error); |
| 2699 | return; |
| 2700 | } |
| 2701 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2702 | break; |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2703 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2704 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2705 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2706 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2707 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2708 | } |
| 2709 | } |
| 2710 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2711 | void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2712 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2713 | 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] | 2714 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2715 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2716 | if (context) |
| 2717 | { |
| 2718 | if (target != GL_RENDERBUFFER) |
daniel@transgaming.com | 4901fca | 2010-04-20 18:52:41 +0000 | [diff] [blame] | 2719 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2720 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2721 | return; |
daniel@transgaming.com | 4901fca | 2010-04-20 18:52:41 +0000 | [diff] [blame] | 2722 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2723 | |
| 2724 | if (context->getState().getRenderbufferId() == 0) |
| 2725 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2726 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2727 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2728 | } |
| 2729 | |
| 2730 | gl::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getState().getRenderbufferId()); |
| 2731 | |
| 2732 | switch (pname) |
| 2733 | { |
| 2734 | case GL_RENDERBUFFER_WIDTH: *params = renderbuffer->getWidth(); break; |
| 2735 | case GL_RENDERBUFFER_HEIGHT: *params = renderbuffer->getHeight(); break; |
| 2736 | case GL_RENDERBUFFER_INTERNAL_FORMAT: *params = renderbuffer->getInternalFormat(); break; |
| 2737 | case GL_RENDERBUFFER_RED_SIZE: *params = renderbuffer->getRedSize(); break; |
| 2738 | case GL_RENDERBUFFER_GREEN_SIZE: *params = renderbuffer->getGreenSize(); break; |
| 2739 | case GL_RENDERBUFFER_BLUE_SIZE: *params = renderbuffer->getBlueSize(); break; |
| 2740 | case GL_RENDERBUFFER_ALPHA_SIZE: *params = renderbuffer->getAlphaSize(); break; |
| 2741 | case GL_RENDERBUFFER_DEPTH_SIZE: *params = renderbuffer->getDepthSize(); break; |
| 2742 | case GL_RENDERBUFFER_STENCIL_SIZE: *params = renderbuffer->getStencilSize(); break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2743 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2744 | case GL_RENDERBUFFER_SAMPLES_ANGLE: |
| 2745 | if (!context->getExtensions().framebufferMultisample) |
| 2746 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2747 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2748 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2749 | } |
| 2750 | *params = renderbuffer->getSamples(); |
| 2751 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2752 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2753 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2754 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2755 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2756 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2757 | } |
| 2758 | } |
| 2759 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2760 | void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2761 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2762 | 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] | 2763 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2764 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2765 | if (context) |
| 2766 | { |
| 2767 | gl::Shader *shaderObject = context->getShader(shader); |
| 2768 | |
| 2769 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2770 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2771 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2772 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2773 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2774 | |
| 2775 | switch (pname) |
| 2776 | { |
| 2777 | case GL_SHADER_TYPE: |
| 2778 | *params = shaderObject->getType(); |
| 2779 | return; |
| 2780 | case GL_DELETE_STATUS: |
| 2781 | *params = shaderObject->isFlaggedForDeletion(); |
| 2782 | return; |
| 2783 | case GL_COMPILE_STATUS: |
| 2784 | *params = shaderObject->isCompiled() ? GL_TRUE : GL_FALSE; |
| 2785 | return; |
| 2786 | case GL_INFO_LOG_LENGTH: |
| 2787 | *params = shaderObject->getInfoLogLength(); |
| 2788 | return; |
| 2789 | case GL_SHADER_SOURCE_LENGTH: |
| 2790 | *params = shaderObject->getSourceLength(); |
| 2791 | return; |
| 2792 | case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: |
| 2793 | *params = shaderObject->getTranslatedSourceLength(); |
| 2794 | return; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2795 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2796 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2797 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2798 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2799 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2800 | } |
| 2801 | } |
| 2802 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2803 | 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] | 2804 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2805 | 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] | 2806 | shader, bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2807 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2808 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2809 | if (context) |
| 2810 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2811 | if (bufsize < 0) |
| 2812 | { |
| 2813 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2814 | return; |
| 2815 | } |
| 2816 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2817 | gl::Shader *shaderObject = context->getShader(shader); |
| 2818 | |
| 2819 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2820 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2821 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2822 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2823 | } |
| 2824 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2825 | shaderObject->getInfoLog(bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2826 | } |
| 2827 | } |
| 2828 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2829 | 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] | 2830 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2831 | 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] | 2832 | shadertype, precisiontype, range, precision); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2833 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2834 | gl::Context *context = gl::getNonLostContext(); |
| 2835 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2836 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2837 | switch (shadertype) |
| 2838 | { |
| 2839 | case GL_VERTEX_SHADER: |
| 2840 | case GL_FRAGMENT_SHADER: |
| 2841 | break; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2842 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2843 | default: |
| 2844 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2845 | return; |
| 2846 | } |
| 2847 | |
| 2848 | switch (precisiontype) |
| 2849 | { |
| 2850 | case GL_LOW_FLOAT: |
| 2851 | case GL_MEDIUM_FLOAT: |
| 2852 | case GL_HIGH_FLOAT: |
| 2853 | // Assume IEEE 754 precision |
| 2854 | range[0] = 127; |
| 2855 | range[1] = 127; |
| 2856 | *precision = 23; |
| 2857 | break; |
| 2858 | |
| 2859 | case GL_LOW_INT: |
| 2860 | case GL_MEDIUM_INT: |
| 2861 | case GL_HIGH_INT: |
| 2862 | // Some (most) hardware only supports single-precision floating-point numbers, |
| 2863 | // which can accurately represent integers up to +/-16777216 |
| 2864 | range[0] = 24; |
| 2865 | range[1] = 24; |
| 2866 | *precision = 0; |
| 2867 | break; |
| 2868 | |
| 2869 | default: |
| 2870 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2871 | return; |
| 2872 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2873 | } |
| 2874 | } |
| 2875 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2876 | 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] | 2877 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2878 | 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] | 2879 | shader, bufsize, length, source); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2880 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2881 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2882 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2883 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2884 | if (bufsize < 0) |
| 2885 | { |
| 2886 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2887 | return; |
| 2888 | } |
| 2889 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2890 | gl::Shader *shaderObject = context->getShader(shader); |
| 2891 | |
| 2892 | if (!shaderObject) |
| 2893 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2894 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2895 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2896 | } |
| 2897 | |
| 2898 | shaderObject->getSource(bufsize, length, source); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2899 | } |
| 2900 | } |
| 2901 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2902 | 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] | 2903 | { |
| 2904 | EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)", |
| 2905 | shader, bufsize, length, source); |
| 2906 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2907 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2908 | if (context) |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2909 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2910 | if (bufsize < 0) |
| 2911 | { |
| 2912 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2913 | return; |
| 2914 | } |
| 2915 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2916 | gl::Shader *shaderObject = context->getShader(shader); |
| 2917 | |
| 2918 | if (!shaderObject) |
| 2919 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2920 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2921 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2922 | } |
| 2923 | |
Tibor den Ouden | 97049c6 | 2014-10-06 21:39:16 +0200 | [diff] [blame] | 2924 | // Only returns extra info if ANGLE_GENERATE_SHADER_DEBUG_INFO is defined |
| 2925 | shaderObject->getTranslatedSourceWithDebugInfo(bufsize, length, source); |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2926 | } |
| 2927 | } |
| 2928 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2929 | const GLubyte* GL_APIENTRY glGetString(GLenum name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2930 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2931 | EVENT("(GLenum name = 0x%X)", name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2932 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2933 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 3e4c600 | 2010-05-05 18:50:13 +0000 | [diff] [blame] | 2934 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2935 | switch (name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2936 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2937 | case GL_VENDOR: |
| 2938 | return (GLubyte*)"Google Inc."; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2939 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2940 | case GL_RENDERER: |
| 2941 | return (GLubyte*)((context != NULL) ? context->getRendererString().c_str() : "ANGLE"); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2942 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2943 | case GL_VERSION: |
| 2944 | if (context->getClientVersion() == 2) |
| 2945 | { |
| 2946 | return (GLubyte*)"OpenGL ES 2.0 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2947 | } |
| 2948 | else |
| 2949 | { |
| 2950 | return (GLubyte*)"OpenGL ES 3.0 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2951 | } |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2952 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2953 | case GL_SHADING_LANGUAGE_VERSION: |
| 2954 | if (context->getClientVersion() == 2) |
| 2955 | { |
| 2956 | return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2957 | } |
| 2958 | else |
| 2959 | { |
| 2960 | return (GLubyte*)"OpenGL ES GLSL ES 3.00 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2961 | } |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2962 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2963 | case GL_EXTENSIONS: |
| 2964 | return (GLubyte*)((context != NULL) ? context->getExtensionString().c_str() : ""); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2965 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2966 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2967 | if (context) |
| 2968 | { |
| 2969 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2970 | } |
| 2971 | return NULL; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2972 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2973 | } |
| 2974 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2975 | void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2976 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2977 | 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] | 2978 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2979 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2980 | if (context) |
| 2981 | { |
| 2982 | gl::Texture *texture = context->getTargetTexture(target); |
| 2983 | |
| 2984 | if (!texture) |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 2985 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2986 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2987 | return; |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 2988 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2989 | |
| 2990 | switch (pname) |
| 2991 | { |
| 2992 | case GL_TEXTURE_MAG_FILTER: |
| 2993 | *params = (GLfloat)texture->getSamplerState().magFilter; |
| 2994 | break; |
| 2995 | case GL_TEXTURE_MIN_FILTER: |
| 2996 | *params = (GLfloat)texture->getSamplerState().minFilter; |
| 2997 | break; |
| 2998 | case GL_TEXTURE_WRAP_S: |
| 2999 | *params = (GLfloat)texture->getSamplerState().wrapS; |
| 3000 | break; |
| 3001 | case GL_TEXTURE_WRAP_T: |
| 3002 | *params = (GLfloat)texture->getSamplerState().wrapT; |
| 3003 | break; |
| 3004 | case GL_TEXTURE_WRAP_R: |
| 3005 | if (context->getClientVersion() < 3) |
| 3006 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3007 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3008 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3009 | } |
| 3010 | *params = (GLfloat)texture->getSamplerState().wrapR; |
| 3011 | break; |
| 3012 | case GL_TEXTURE_IMMUTABLE_FORMAT: |
| 3013 | // Exposed to ES2.0 through EXT_texture_storage, no client version validation. |
| 3014 | *params = (GLfloat)(texture->isImmutable() ? GL_TRUE : GL_FALSE); |
| 3015 | break; |
| 3016 | case GL_TEXTURE_IMMUTABLE_LEVELS: |
| 3017 | if (context->getClientVersion() < 3) |
| 3018 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3019 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3020 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3021 | } |
| 3022 | *params = (GLfloat)texture->immutableLevelCount(); |
| 3023 | break; |
| 3024 | case GL_TEXTURE_USAGE_ANGLE: |
| 3025 | *params = (GLfloat)texture->getUsage(); |
| 3026 | break; |
| 3027 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
| 3028 | if (!context->getExtensions().textureFilterAnisotropic) |
| 3029 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3030 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3031 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3032 | } |
| 3033 | *params = (GLfloat)texture->getSamplerState().maxAnisotropy; |
| 3034 | break; |
| 3035 | case GL_TEXTURE_SWIZZLE_R: |
| 3036 | if (context->getClientVersion() < 3) |
| 3037 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3038 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3039 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3040 | } |
| 3041 | *params = (GLfloat)texture->getSamplerState().swizzleRed; |
| 3042 | break; |
| 3043 | case GL_TEXTURE_SWIZZLE_G: |
| 3044 | if (context->getClientVersion() < 3) |
| 3045 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3046 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3047 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3048 | } |
| 3049 | *params = (GLfloat)texture->getSamplerState().swizzleGreen; |
| 3050 | break; |
| 3051 | case GL_TEXTURE_SWIZZLE_B: |
| 3052 | if (context->getClientVersion() < 3) |
| 3053 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3054 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3055 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3056 | } |
| 3057 | *params = (GLfloat)texture->getSamplerState().swizzleBlue; |
| 3058 | break; |
| 3059 | case GL_TEXTURE_SWIZZLE_A: |
| 3060 | if (context->getClientVersion() < 3) |
| 3061 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3062 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3063 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3064 | } |
| 3065 | *params = (GLfloat)texture->getSamplerState().swizzleAlpha; |
| 3066 | break; |
| 3067 | case GL_TEXTURE_BASE_LEVEL: |
| 3068 | if (context->getClientVersion() < 3) |
| 3069 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3070 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3071 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3072 | } |
| 3073 | *params = (GLfloat)texture->getSamplerState().baseLevel; |
| 3074 | break; |
| 3075 | case GL_TEXTURE_MAX_LEVEL: |
| 3076 | if (context->getClientVersion() < 3) |
| 3077 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3078 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3079 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3080 | } |
| 3081 | *params = (GLfloat)texture->getSamplerState().maxLevel; |
| 3082 | break; |
| 3083 | case GL_TEXTURE_MIN_LOD: |
| 3084 | if (context->getClientVersion() < 3) |
| 3085 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3086 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3087 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3088 | } |
| 3089 | *params = texture->getSamplerState().minLod; |
| 3090 | break; |
| 3091 | case GL_TEXTURE_MAX_LOD: |
| 3092 | if (context->getClientVersion() < 3) |
| 3093 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3094 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3095 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3096 | } |
| 3097 | *params = texture->getSamplerState().maxLod; |
| 3098 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3099 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3100 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3101 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3102 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3103 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3104 | } |
| 3105 | } |
| 3106 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3107 | void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3108 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3109 | 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] | 3110 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3111 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3112 | if (context) |
| 3113 | { |
| 3114 | gl::Texture *texture = context->getTargetTexture(target); |
| 3115 | |
| 3116 | if (!texture) |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 3117 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3118 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3119 | return; |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 3120 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3121 | |
| 3122 | switch (pname) |
| 3123 | { |
| 3124 | case GL_TEXTURE_MAG_FILTER: |
| 3125 | *params = texture->getSamplerState().magFilter; |
| 3126 | break; |
| 3127 | case GL_TEXTURE_MIN_FILTER: |
| 3128 | *params = texture->getSamplerState().minFilter; |
| 3129 | break; |
| 3130 | case GL_TEXTURE_WRAP_S: |
| 3131 | *params = texture->getSamplerState().wrapS; |
| 3132 | break; |
| 3133 | case GL_TEXTURE_WRAP_T: |
| 3134 | *params = texture->getSamplerState().wrapT; |
| 3135 | break; |
| 3136 | case GL_TEXTURE_WRAP_R: |
| 3137 | if (context->getClientVersion() < 3) |
| 3138 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3139 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3140 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3141 | } |
| 3142 | *params = texture->getSamplerState().wrapR; |
| 3143 | break; |
| 3144 | case GL_TEXTURE_IMMUTABLE_FORMAT: |
| 3145 | // Exposed to ES2.0 through EXT_texture_storage, no client version validation. |
| 3146 | *params = texture->isImmutable() ? GL_TRUE : GL_FALSE; |
| 3147 | break; |
| 3148 | case GL_TEXTURE_IMMUTABLE_LEVELS: |
| 3149 | if (context->getClientVersion() < 3) |
| 3150 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3151 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3152 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3153 | } |
Jamie Madill | 6948e30 | 2014-10-20 17:04:33 -0400 | [diff] [blame] | 3154 | *params = static_cast<GLint>(texture->immutableLevelCount()); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3155 | break; |
| 3156 | case GL_TEXTURE_USAGE_ANGLE: |
| 3157 | *params = texture->getUsage(); |
| 3158 | break; |
| 3159 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
| 3160 | if (!context->getExtensions().textureFilterAnisotropic) |
| 3161 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3162 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3163 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3164 | } |
| 3165 | *params = (GLint)texture->getSamplerState().maxAnisotropy; |
| 3166 | break; |
| 3167 | case GL_TEXTURE_SWIZZLE_R: |
| 3168 | if (context->getClientVersion() < 3) |
| 3169 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3170 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3171 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3172 | } |
| 3173 | *params = texture->getSamplerState().swizzleRed; |
| 3174 | break; |
| 3175 | case GL_TEXTURE_SWIZZLE_G: |
| 3176 | if (context->getClientVersion() < 3) |
| 3177 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3178 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3179 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3180 | } |
| 3181 | *params = texture->getSamplerState().swizzleGreen; |
| 3182 | break; |
| 3183 | case GL_TEXTURE_SWIZZLE_B: |
| 3184 | if (context->getClientVersion() < 3) |
| 3185 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3186 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3187 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3188 | } |
| 3189 | *params = texture->getSamplerState().swizzleBlue; |
| 3190 | break; |
| 3191 | case GL_TEXTURE_SWIZZLE_A: |
| 3192 | if (context->getClientVersion() < 3) |
| 3193 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3194 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3195 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3196 | } |
| 3197 | *params = texture->getSamplerState().swizzleAlpha; |
| 3198 | break; |
| 3199 | case GL_TEXTURE_BASE_LEVEL: |
| 3200 | if (context->getClientVersion() < 3) |
| 3201 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3202 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3203 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3204 | } |
| 3205 | *params = texture->getSamplerState().baseLevel; |
| 3206 | break; |
| 3207 | case GL_TEXTURE_MAX_LEVEL: |
| 3208 | if (context->getClientVersion() < 3) |
| 3209 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3210 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3211 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3212 | } |
| 3213 | *params = texture->getSamplerState().maxLevel; |
| 3214 | break; |
| 3215 | case GL_TEXTURE_MIN_LOD: |
| 3216 | if (context->getClientVersion() < 3) |
| 3217 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3218 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3219 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3220 | } |
| 3221 | *params = (GLint)texture->getSamplerState().minLod; |
| 3222 | break; |
| 3223 | case GL_TEXTURE_MAX_LOD: |
| 3224 | if (context->getClientVersion() < 3) |
| 3225 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3226 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3227 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3228 | } |
| 3229 | *params = (GLint)texture->getSamplerState().maxLod; |
| 3230 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3231 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3232 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3233 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3234 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3235 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3236 | } |
| 3237 | } |
| 3238 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3239 | 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] | 3240 | { |
| 3241 | EVENT("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLfloat* params = 0x%0.8p)", |
| 3242 | program, location, bufSize, params); |
| 3243 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3244 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3245 | if (context) |
| 3246 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3247 | if (!ValidateGetnUniformfvEXT(context, program, location, bufSize, params)) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3248 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3249 | return; |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3250 | } |
| 3251 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3252 | gl::Program *programObject = context->getProgram(program); |
| 3253 | ASSERT(programObject); |
| 3254 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3255 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3256 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3257 | programBinary->getUniformfv(location, params); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3258 | } |
| 3259 | } |
| 3260 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3261 | void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3262 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3263 | 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] | 3264 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3265 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3266 | if (context) |
| 3267 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3268 | if (!ValidateGetUniformfv(context, program, location, params)) |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3269 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3270 | return; |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3271 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3272 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3273 | gl::Program *programObject = context->getProgram(program); |
| 3274 | ASSERT(programObject); |
| 3275 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3276 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3277 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3278 | programBinary->getUniformfv(location, params); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3279 | } |
| 3280 | } |
| 3281 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3282 | 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] | 3283 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3284 | 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] | 3285 | program, location, bufSize, params); |
| 3286 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3287 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3288 | if (context) |
| 3289 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3290 | if (!ValidateGetnUniformivEXT(context, program, location, bufSize, params)) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3291 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3292 | return; |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3293 | } |
| 3294 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3295 | gl::Program *programObject = context->getProgram(program); |
| 3296 | ASSERT(programObject); |
| 3297 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3298 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3299 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3300 | programBinary->getUniformiv(location, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3301 | } |
| 3302 | } |
| 3303 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3304 | void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3305 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3306 | 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] | 3307 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3308 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3309 | if (context) |
| 3310 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3311 | if (!ValidateGetUniformiv(context, program, location, params)) |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3312 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3313 | return; |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3314 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3315 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3316 | gl::Program *programObject = context->getProgram(program); |
| 3317 | ASSERT(programObject); |
| 3318 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3319 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3320 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3321 | programBinary->getUniformiv(location, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3322 | } |
| 3323 | } |
| 3324 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3325 | GLint GL_APIENTRY glGetUniformLocation(GLuint program, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3326 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3327 | 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] | 3328 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3329 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3330 | if (context) |
| 3331 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3332 | if (strstr(name, "gl_") == name) |
| 3333 | { |
| 3334 | return -1; |
| 3335 | } |
| 3336 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3337 | gl::Program *programObject = context->getProgram(program); |
| 3338 | |
| 3339 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3340 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3341 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3342 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3343 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3344 | return -1; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3345 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3346 | else |
| 3347 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3348 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3349 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3350 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3351 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3352 | |
| 3353 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 3354 | if (!programObject->isLinked() || !programBinary) |
| 3355 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3356 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3357 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3358 | } |
| 3359 | |
| 3360 | return programBinary->getUniformLocation(name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3361 | } |
| 3362 | |
| 3363 | return -1; |
| 3364 | } |
| 3365 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3366 | void GL_APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3367 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3368 | 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] | 3369 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3370 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3371 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3372 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3373 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3374 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3375 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3376 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3377 | } |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3378 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3379 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3380 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3381 | { |
| 3382 | return; |
| 3383 | } |
daniel@transgaming.com | 428d158 | 2010-05-04 03:35:25 +0000 | [diff] [blame] | 3384 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3385 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 3386 | { |
| 3387 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 3388 | for (int i = 0; i < 4; ++i) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3389 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3390 | params[i] = currentValueData.FloatValues[i]; |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3391 | } |
| 3392 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3393 | else |
| 3394 | { |
| 3395 | *params = gl::QuerySingleVertexAttributeParameter<GLfloat>(attribState, pname); |
| 3396 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3397 | } |
| 3398 | } |
| 3399 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3400 | void GL_APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3401 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3402 | 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] | 3403 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3404 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3405 | if (context) |
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 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3408 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3409 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3410 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3411 | } |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3412 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3413 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
daniel@transgaming.com | 428d158 | 2010-05-04 03:35:25 +0000 | [diff] [blame] | 3414 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3415 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3416 | { |
| 3417 | return; |
| 3418 | } |
Jamie Madill | aff7150 | 2013-07-02 11:57:05 -0400 | [diff] [blame] | 3419 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3420 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 3421 | { |
| 3422 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 3423 | for (int i = 0; i < 4; ++i) |
Jamie Madill | aff7150 | 2013-07-02 11:57:05 -0400 | [diff] [blame] | 3424 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3425 | float currentValue = currentValueData.FloatValues[i]; |
| 3426 | params[i] = gl::iround<GLint>(currentValue); |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3427 | } |
| 3428 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3429 | else |
| 3430 | { |
| 3431 | *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname); |
| 3432 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3433 | } |
| 3434 | } |
| 3435 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3436 | void GL_APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3437 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3438 | 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] | 3439 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3440 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3441 | if (context) |
| 3442 | { |
| 3443 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3444 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3445 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3446 | return; |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3447 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3448 | |
| 3449 | if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER) |
| 3450 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3451 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3452 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3453 | } |
| 3454 | |
| 3455 | *pointer = const_cast<GLvoid*>(context->getState().getVertexAttribPointer(index)); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3456 | } |
| 3457 | } |
| 3458 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3459 | void GL_APIENTRY glHint(GLenum target, GLenum mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3460 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3461 | EVENT("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3462 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3463 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3464 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3465 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3466 | switch (mode) |
| 3467 | { |
| 3468 | case GL_FASTEST: |
| 3469 | case GL_NICEST: |
| 3470 | case GL_DONT_CARE: |
| 3471 | break; |
| 3472 | |
| 3473 | default: |
| 3474 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3475 | return; |
| 3476 | } |
| 3477 | |
| 3478 | switch (target) |
| 3479 | { |
| 3480 | case GL_GENERATE_MIPMAP_HINT: |
| 3481 | context->getState().setGenerateMipmapHint(mode); |
| 3482 | break; |
| 3483 | |
| 3484 | case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: |
| 3485 | context->getState().setFragmentShaderDerivativeHint(mode); |
| 3486 | break; |
| 3487 | |
| 3488 | default: |
| 3489 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3490 | return; |
| 3491 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3492 | } |
| 3493 | } |
| 3494 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3495 | GLboolean GL_APIENTRY glIsBuffer(GLuint buffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3496 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3497 | EVENT("(GLuint buffer = %d)", buffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3498 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3499 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3500 | if (context && buffer) |
| 3501 | { |
| 3502 | gl::Buffer *bufferObject = context->getBuffer(buffer); |
| 3503 | |
| 3504 | if (bufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3505 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3506 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3507 | } |
| 3508 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3509 | |
| 3510 | return GL_FALSE; |
| 3511 | } |
| 3512 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3513 | GLboolean GL_APIENTRY glIsEnabled(GLenum cap) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3514 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3515 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3516 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3517 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3518 | if (context) |
| 3519 | { |
| 3520 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3521 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3522 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3523 | return GL_FALSE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3524 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3525 | |
| 3526 | return context->getState().getEnableFeature(cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3527 | } |
| 3528 | |
| 3529 | return false; |
| 3530 | } |
| 3531 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3532 | GLboolean GL_APIENTRY glIsFenceNV(GLuint fence) |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3533 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3534 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3535 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3536 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3537 | if (context) |
| 3538 | { |
| 3539 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 3540 | |
| 3541 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3542 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3543 | return GL_FALSE; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3544 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3545 | |
| 3546 | return fenceObject->isFence(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3547 | } |
| 3548 | |
| 3549 | return GL_FALSE; |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3550 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3551 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3552 | GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3553 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3554 | EVENT("(GLuint framebuffer = %d)", framebuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3555 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3556 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3557 | if (context && framebuffer) |
| 3558 | { |
| 3559 | gl::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer); |
| 3560 | |
| 3561 | if (framebufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3562 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3563 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3564 | } |
| 3565 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3566 | |
| 3567 | return GL_FALSE; |
| 3568 | } |
| 3569 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3570 | GLboolean GL_APIENTRY glIsProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3571 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3572 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3573 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3574 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3575 | if (context && program) |
| 3576 | { |
| 3577 | gl::Program *programObject = context->getProgram(program); |
| 3578 | |
| 3579 | if (programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3580 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3581 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3582 | } |
| 3583 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3584 | |
| 3585 | return GL_FALSE; |
| 3586 | } |
| 3587 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3588 | GLboolean GL_APIENTRY glIsQueryEXT(GLuint id) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 3589 | { |
| 3590 | EVENT("(GLuint id = %d)", id); |
| 3591 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3592 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3593 | if (context) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 3594 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3595 | 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] | 3596 | } |
| 3597 | |
| 3598 | return GL_FALSE; |
| 3599 | } |
| 3600 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3601 | GLboolean GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3602 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3603 | EVENT("(GLuint renderbuffer = %d)", renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3604 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3605 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3606 | if (context && renderbuffer) |
| 3607 | { |
| 3608 | gl::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer); |
| 3609 | |
| 3610 | if (renderbufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3611 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3612 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3613 | } |
| 3614 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3615 | |
| 3616 | return GL_FALSE; |
| 3617 | } |
| 3618 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3619 | GLboolean GL_APIENTRY glIsShader(GLuint shader) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3620 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3621 | EVENT("(GLuint shader = %d)", shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3622 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3623 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3624 | if (context && shader) |
| 3625 | { |
| 3626 | gl::Shader *shaderObject = context->getShader(shader); |
| 3627 | |
| 3628 | if (shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3629 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3630 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3631 | } |
| 3632 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3633 | |
| 3634 | return GL_FALSE; |
| 3635 | } |
| 3636 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3637 | GLboolean GL_APIENTRY glIsTexture(GLuint texture) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3638 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3639 | EVENT("(GLuint texture = %d)", texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3640 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3641 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3642 | if (context && texture) |
| 3643 | { |
| 3644 | gl::Texture *textureObject = context->getTexture(texture); |
| 3645 | |
| 3646 | if (textureObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3647 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3648 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3649 | } |
| 3650 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3651 | |
| 3652 | return GL_FALSE; |
| 3653 | } |
| 3654 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3655 | void GL_APIENTRY glLineWidth(GLfloat width) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3656 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3657 | EVENT("(GLfloat width = %f)", width); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3658 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3659 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3660 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3661 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3662 | if (width <= 0.0f) |
| 3663 | { |
| 3664 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3665 | return; |
| 3666 | } |
| 3667 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3668 | context->getState().setLineWidth(width); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3669 | } |
| 3670 | } |
| 3671 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3672 | void GL_APIENTRY glLinkProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3673 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3674 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3675 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3676 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3677 | if (context) |
| 3678 | { |
| 3679 | gl::Program *programObject = context->getProgram(program); |
| 3680 | |
| 3681 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3682 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3683 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3684 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3685 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3686 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3687 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3688 | else |
| 3689 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3690 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3691 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3692 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3693 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3694 | |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 3695 | gl::Error error = context->linkProgram(program); |
| 3696 | if (error.isError()) |
| 3697 | { |
| 3698 | context->recordError(error); |
| 3699 | return; |
| 3700 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3701 | } |
| 3702 | } |
| 3703 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3704 | void GL_APIENTRY glPixelStorei(GLenum pname, GLint param) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3705 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3706 | EVENT("(GLenum pname = 0x%X, GLint param = %d)", pname, param); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3707 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3708 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3709 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3710 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3711 | switch (pname) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3712 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3713 | case GL_UNPACK_ALIGNMENT: |
| 3714 | if (param != 1 && param != 2 && param != 4 && param != 8) |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3715 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3716 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3717 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3718 | } |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3719 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3720 | context->getState().setUnpackAlignment(param); |
| 3721 | break; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3722 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3723 | case GL_PACK_ALIGNMENT: |
| 3724 | if (param != 1 && param != 2 && param != 4 && param != 8) |
| 3725 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3726 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3727 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3728 | } |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3729 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3730 | context->getState().setPackAlignment(param); |
| 3731 | break; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3732 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3733 | case GL_PACK_REVERSE_ROW_ORDER_ANGLE: |
| 3734 | context->getState().setPackReverseRowOrder(param != 0); |
| 3735 | break; |
bsalomon@google.com | 56d46ab | 2011-11-23 14:53:10 +0000 | [diff] [blame] | 3736 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3737 | case GL_UNPACK_IMAGE_HEIGHT: |
| 3738 | case GL_UNPACK_SKIP_IMAGES: |
| 3739 | case GL_UNPACK_ROW_LENGTH: |
| 3740 | case GL_UNPACK_SKIP_ROWS: |
| 3741 | case GL_UNPACK_SKIP_PIXELS: |
| 3742 | case GL_PACK_ROW_LENGTH: |
| 3743 | case GL_PACK_SKIP_ROWS: |
| 3744 | case GL_PACK_SKIP_PIXELS: |
| 3745 | if (context->getClientVersion() < 3) |
| 3746 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3747 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3748 | return; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3749 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3750 | UNIMPLEMENTED(); |
| 3751 | break; |
| 3752 | |
| 3753 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3754 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3755 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3756 | } |
| 3757 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3758 | } |
| 3759 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3760 | void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3761 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3762 | EVENT("(GLfloat factor = %f, GLfloat units = %f)", factor, units); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3763 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3764 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3765 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3766 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3767 | context->getState().setPolygonOffsetParams(factor, units); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3768 | } |
| 3769 | } |
| 3770 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3771 | 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] | 3772 | GLenum format, GLenum type, GLsizei bufSize, |
| 3773 | GLvoid *data) |
| 3774 | { |
| 3775 | EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, " |
| 3776 | "GLenum format = 0x%X, GLenum type = 0x%X, GLsizei bufSize = 0x%d, GLvoid *data = 0x%0.8p)", |
| 3777 | x, y, width, height, format, type, bufSize, data); |
| 3778 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3779 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3780 | if (context) |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3781 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3782 | if (width < 0 || height < 0 || bufSize < 0) |
| 3783 | { |
| 3784 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3785 | return; |
| 3786 | } |
| 3787 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3788 | if (!gl::ValidateReadPixelsParameters(context, x, y, width, height, |
| 3789 | format, type, &bufSize, data)) |
| 3790 | { |
| 3791 | return; |
| 3792 | } |
| 3793 | |
Geoff Lang | 63d2fc7 | 2014-07-25 14:51:41 -0400 | [diff] [blame] | 3794 | gl::Error error = context->readPixels(x, y, width, height, format, type, &bufSize, data); |
| 3795 | if (error.isError()) |
| 3796 | { |
| 3797 | context->recordError(error); |
| 3798 | return; |
| 3799 | } |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3800 | } |
| 3801 | } |
| 3802 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3803 | 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] | 3804 | GLenum format, GLenum type, GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3805 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3806 | 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] | 3807 | "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] | 3808 | x, y, width, height, format, type, pixels); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3809 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3810 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3811 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3812 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3813 | if (width < 0 || height < 0) |
| 3814 | { |
| 3815 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3816 | return; |
| 3817 | } |
| 3818 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3819 | if (!gl::ValidateReadPixelsParameters(context, x, y, width, height, |
| 3820 | format, type, NULL, pixels)) |
| 3821 | { |
| 3822 | return; |
| 3823 | } |
| 3824 | |
Geoff Lang | 63d2fc7 | 2014-07-25 14:51:41 -0400 | [diff] [blame] | 3825 | gl::Error error = context->readPixels(x, y, width, height, format, type, NULL, pixels); |
| 3826 | if (error.isError()) |
| 3827 | { |
| 3828 | context->recordError(error); |
| 3829 | return; |
| 3830 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3831 | } |
| 3832 | } |
| 3833 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3834 | void GL_APIENTRY glReleaseShaderCompiler(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3835 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3836 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3837 | |
Brandon Jones | f05cdee | 2014-08-27 15:24:07 -0700 | [diff] [blame] | 3838 | gl::Context *context = gl::getNonLostContext(); |
| 3839 | |
| 3840 | if (context) |
| 3841 | { |
| 3842 | context->releaseShaderCompiler(); |
| 3843 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3844 | } |
| 3845 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3846 | 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] | 3847 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3848 | 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] | 3849 | target, samples, internalformat, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3850 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3851 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3852 | if (context) |
| 3853 | { |
| 3854 | if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat, |
| 3855 | width, height, true)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3856 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3857 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3858 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3859 | |
Shannon Woods | e2632d2 | 2014-10-17 13:08:51 -0400 | [diff] [blame] | 3860 | gl::Renderbuffer *renderbuffer = context->getState().getCurrentRenderbuffer(); |
Geoff Lang | bafefdf | 2014-10-10 14:26:35 -0400 | [diff] [blame] | 3861 | gl::Error error = renderbuffer->setStorage(width, height, internalformat, samples); |
| 3862 | if (error.isError()) |
| 3863 | { |
| 3864 | context->recordError(error); |
| 3865 | return; |
| 3866 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3867 | } |
| 3868 | } |
| 3869 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3870 | 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] | 3871 | { |
| 3872 | glRenderbufferStorageMultisampleANGLE(target, 0, internalformat, width, height); |
| 3873 | } |
| 3874 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3875 | void GL_APIENTRY glSampleCoverage(GLclampf value, GLboolean invert) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3876 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 3877 | EVENT("(GLclampf value = %f, GLboolean invert = %u)", value, invert); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3878 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3879 | gl::Context* context = gl::getNonLostContext(); |
daniel@transgaming.com | fab5a1a | 2010-03-11 19:22:30 +0000 | [diff] [blame] | 3880 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3881 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3882 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3883 | context->getState().setSampleCoverageParams(gl::clamp01(value), invert == GL_TRUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3884 | } |
| 3885 | } |
| 3886 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3887 | void GL_APIENTRY glSetFenceNV(GLuint fence, GLenum condition) |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3888 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3889 | EVENT("(GLuint fence = %d, GLenum condition = 0x%X)", fence, condition); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3890 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3891 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3892 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3893 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3894 | if (condition != GL_ALL_COMPLETED_NV) |
| 3895 | { |
| 3896 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3897 | return; |
| 3898 | } |
| 3899 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3900 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 3901 | |
| 3902 | if (fenceObject == NULL) |
| 3903 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3904 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3905 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3906 | } |
| 3907 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 3908 | gl::Error error = fenceObject->setFence(condition); |
| 3909 | if (error.isError()) |
| 3910 | { |
| 3911 | context->recordError(error); |
| 3912 | return; |
| 3913 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3914 | } |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3915 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3916 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3917 | 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] | 3918 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3919 | 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] | 3920 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3921 | gl::Context* context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3922 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3923 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3924 | if (width < 0 || height < 0) |
| 3925 | { |
| 3926 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3927 | return; |
| 3928 | } |
| 3929 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3930 | context->getState().setScissorParams(x, y, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3931 | } |
| 3932 | } |
| 3933 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3934 | 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] | 3935 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3936 | 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] | 3937 | "const GLvoid* binary = 0x%0.8p, GLsizei length = %d)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 3938 | n, shaders, binaryformat, binary, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3939 | |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 3940 | gl::Context* context = gl::getNonLostContext(); |
| 3941 | if (context) |
| 3942 | { |
| 3943 | const std::vector<GLenum> &shaderBinaryFormats = context->getCaps().shaderBinaryFormats; |
| 3944 | if (std::find(shaderBinaryFormats.begin(), shaderBinaryFormats.end(), binaryformat) == shaderBinaryFormats.end()) |
| 3945 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3946 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3947 | return; |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 3948 | } |
| 3949 | |
| 3950 | // No binary shader formats are supported. |
| 3951 | UNIMPLEMENTED(); |
| 3952 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3953 | } |
| 3954 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3955 | 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] | 3956 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3957 | 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] | 3958 | shader, count, string, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3959 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3960 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3961 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3962 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3963 | if (count < 0) |
| 3964 | { |
| 3965 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3966 | return; |
| 3967 | } |
| 3968 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3969 | gl::Shader *shaderObject = context->getShader(shader); |
| 3970 | |
| 3971 | if (!shaderObject) |
| 3972 | { |
| 3973 | if (context->getProgram(shader)) |
| 3974 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3975 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3976 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3977 | } |
| 3978 | else |
| 3979 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3980 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3981 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3982 | } |
| 3983 | } |
| 3984 | |
| 3985 | shaderObject->setSource(count, string, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3986 | } |
| 3987 | } |
| 3988 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3989 | void GL_APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3990 | { |
daniel@transgaming.com | fab5a1a | 2010-03-11 19:22:30 +0000 | [diff] [blame] | 3991 | glStencilFuncSeparate(GL_FRONT_AND_BACK, func, ref, mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3992 | } |
| 3993 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3994 | 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] | 3995 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3996 | 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] | 3997 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3998 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3999 | if (context) |
| 4000 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4001 | switch (face) |
| 4002 | { |
| 4003 | case GL_FRONT: |
| 4004 | case GL_BACK: |
| 4005 | case GL_FRONT_AND_BACK: |
| 4006 | break; |
| 4007 | |
| 4008 | default: |
| 4009 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4010 | return; |
| 4011 | } |
| 4012 | |
| 4013 | switch (func) |
| 4014 | { |
| 4015 | case GL_NEVER: |
| 4016 | case GL_ALWAYS: |
| 4017 | case GL_LESS: |
| 4018 | case GL_LEQUAL: |
| 4019 | case GL_EQUAL: |
| 4020 | case GL_GEQUAL: |
| 4021 | case GL_GREATER: |
| 4022 | case GL_NOTEQUAL: |
| 4023 | break; |
| 4024 | |
| 4025 | default: |
| 4026 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4027 | return; |
| 4028 | } |
| 4029 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4030 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 4031 | { |
| 4032 | context->getState().setStencilParams(func, ref, mask); |
| 4033 | } |
| 4034 | |
| 4035 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 4036 | { |
| 4037 | context->getState().setStencilBackParams(func, ref, mask); |
| 4038 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4039 | } |
| 4040 | } |
| 4041 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4042 | void GL_APIENTRY glStencilMask(GLuint mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4043 | { |
| 4044 | glStencilMaskSeparate(GL_FRONT_AND_BACK, mask); |
| 4045 | } |
| 4046 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4047 | void GL_APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4048 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4049 | EVENT("(GLenum face = 0x%X, GLuint mask = %d)", face, mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4050 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4051 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4052 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4053 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4054 | switch (face) |
| 4055 | { |
| 4056 | case GL_FRONT: |
| 4057 | case GL_BACK: |
| 4058 | case GL_FRONT_AND_BACK: |
| 4059 | break; |
| 4060 | |
| 4061 | default: |
| 4062 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4063 | return; |
| 4064 | } |
| 4065 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4066 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 4067 | { |
| 4068 | context->getState().setStencilWritemask(mask); |
| 4069 | } |
| 4070 | |
| 4071 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 4072 | { |
| 4073 | context->getState().setStencilBackWritemask(mask); |
| 4074 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4075 | } |
| 4076 | } |
| 4077 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4078 | void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4079 | { |
| 4080 | glStencilOpSeparate(GL_FRONT_AND_BACK, fail, zfail, zpass); |
| 4081 | } |
| 4082 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4083 | 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] | 4084 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4085 | 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] | 4086 | face, fail, zfail, zpass); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4087 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4088 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4089 | if (context) |
| 4090 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4091 | switch (face) |
| 4092 | { |
| 4093 | case GL_FRONT: |
| 4094 | case GL_BACK: |
| 4095 | case GL_FRONT_AND_BACK: |
| 4096 | break; |
| 4097 | |
| 4098 | default: |
| 4099 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4100 | return; |
| 4101 | } |
| 4102 | |
| 4103 | switch (fail) |
| 4104 | { |
| 4105 | case GL_ZERO: |
| 4106 | case GL_KEEP: |
| 4107 | case GL_REPLACE: |
| 4108 | case GL_INCR: |
| 4109 | case GL_DECR: |
| 4110 | case GL_INVERT: |
| 4111 | case GL_INCR_WRAP: |
| 4112 | case GL_DECR_WRAP: |
| 4113 | break; |
| 4114 | |
| 4115 | default: |
| 4116 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4117 | return; |
| 4118 | } |
| 4119 | |
| 4120 | switch (zfail) |
| 4121 | { |
| 4122 | case GL_ZERO: |
| 4123 | case GL_KEEP: |
| 4124 | case GL_REPLACE: |
| 4125 | case GL_INCR: |
| 4126 | case GL_DECR: |
| 4127 | case GL_INVERT: |
| 4128 | case GL_INCR_WRAP: |
| 4129 | case GL_DECR_WRAP: |
| 4130 | break; |
| 4131 | |
| 4132 | default: |
| 4133 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4134 | return; |
| 4135 | } |
| 4136 | |
| 4137 | switch (zpass) |
| 4138 | { |
| 4139 | case GL_ZERO: |
| 4140 | case GL_KEEP: |
| 4141 | case GL_REPLACE: |
| 4142 | case GL_INCR: |
| 4143 | case GL_DECR: |
| 4144 | case GL_INVERT: |
| 4145 | case GL_INCR_WRAP: |
| 4146 | case GL_DECR_WRAP: |
| 4147 | break; |
| 4148 | |
| 4149 | default: |
| 4150 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4151 | return; |
| 4152 | } |
| 4153 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4154 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 4155 | { |
| 4156 | context->getState().setStencilOperations(fail, zfail, zpass); |
| 4157 | } |
| 4158 | |
| 4159 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 4160 | { |
| 4161 | context->getState().setStencilBackOperations(fail, zfail, zpass); |
| 4162 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4163 | } |
| 4164 | } |
| 4165 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4166 | GLboolean GL_APIENTRY glTestFenceNV(GLuint fence) |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 4167 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4168 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4169 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4170 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4171 | if (context) |
| 4172 | { |
| 4173 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 4174 | |
| 4175 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4176 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4177 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4178 | return GL_TRUE; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4179 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4180 | |
| 4181 | if (fenceObject->isFence() != GL_TRUE) |
| 4182 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4183 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4184 | return GL_TRUE; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4185 | } |
| 4186 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 4187 | GLboolean result; |
| 4188 | gl::Error error = fenceObject->testFence(&result); |
| 4189 | if (error.isError()) |
| 4190 | { |
| 4191 | context->recordError(error); |
| 4192 | return GL_TRUE; |
| 4193 | } |
| 4194 | |
| 4195 | return result; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4196 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4197 | |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4198 | return GL_TRUE; |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 4199 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4200 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4201 | 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] | 4202 | GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4203 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4204 | 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] | 4205 | "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] | 4206 | target, level, internalformat, width, height, border, format, type, pixels); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4207 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4208 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4209 | if (context) |
| 4210 | { |
| 4211 | if (context->getClientVersion() < 3 && |
| 4212 | !ValidateES2TexImageParameters(context, target, level, internalformat, false, false, |
| 4213 | 0, 0, width, height, border, format, type, pixels)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4214 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4215 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4216 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4217 | |
| 4218 | if (context->getClientVersion() >= 3 && |
| 4219 | !ValidateES3TexImageParameters(context, target, level, internalformat, false, false, |
| 4220 | 0, 0, 0, width, height, 1, border, format, type, pixels)) |
| 4221 | { |
| 4222 | return; |
| 4223 | } |
| 4224 | |
| 4225 | switch (target) |
| 4226 | { |
| 4227 | case GL_TEXTURE_2D: |
| 4228 | { |
| 4229 | gl::Texture2D *texture = context->getTexture2D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 4230 | gl::Error error = texture->setImage(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4231 | if (error.isError()) |
| 4232 | { |
| 4233 | context->recordError(error); |
| 4234 | return; |
| 4235 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4236 | } |
| 4237 | break; |
Geoff Lang | 8376cea | 2014-09-02 11:47:07 -0400 | [diff] [blame] | 4238 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4239 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4240 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4241 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4242 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4243 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4244 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 4245 | { |
| 4246 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Geoff Lang | 8376cea | 2014-09-02 11:47:07 -0400 | [diff] [blame] | 4247 | 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] | 4248 | if (error.isError()) |
| 4249 | { |
| 4250 | context->recordError(error); |
| 4251 | return; |
| 4252 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4253 | } |
| 4254 | break; |
Geoff Lang | 8376cea | 2014-09-02 11:47:07 -0400 | [diff] [blame] | 4255 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4256 | default: UNREACHABLE(); |
| 4257 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4258 | } |
| 4259 | } |
| 4260 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4261 | void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4262 | { |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4263 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %f)", target, pname, param); |
| 4264 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4265 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4266 | if (context) |
| 4267 | { |
| 4268 | if (!ValidateTexParamParameters(context, pname, static_cast<GLint>(param))) |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4269 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4270 | return; |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4271 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4272 | |
| 4273 | gl::Texture *texture = context->getTargetTexture(target); |
| 4274 | |
| 4275 | if (!texture) |
| 4276 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4277 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4278 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4279 | } |
| 4280 | |
| 4281 | switch (pname) |
| 4282 | { |
| 4283 | case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = gl::uiround<GLenum>(param); break; |
| 4284 | case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = gl::uiround<GLenum>(param); break; |
| 4285 | case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = gl::uiround<GLenum>(param); break; |
| 4286 | case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = gl::uiround<GLenum>(param); break; |
| 4287 | case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = gl::uiround<GLenum>(param); break; |
| 4288 | case GL_TEXTURE_USAGE_ANGLE: texture->setUsage(gl::uiround<GLenum>(param)); break; |
| 4289 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min(param, context->getExtensions().maxTextureAnisotropy); break; |
| 4290 | case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = gl::uiround<GLenum>(param); break; |
| 4291 | case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = gl::uiround<GLenum>(param); break; |
| 4292 | case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = gl::uiround<GLenum>(param); break; |
| 4293 | case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = gl::uiround<GLenum>(param); break; |
| 4294 | case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = gl::uiround<GLenum>(param); break; |
| 4295 | case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = gl::uiround<GLenum>(param); break; |
| 4296 | case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = gl::iround<GLint>(param); break; |
| 4297 | case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = gl::iround<GLint>(param); break; |
| 4298 | case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = param; break; |
| 4299 | case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = param; break; |
| 4300 | default: UNREACHABLE(); break; |
| 4301 | } |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4302 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4303 | } |
| 4304 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4305 | void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4306 | { |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4307 | glTexParameterf(target, pname, (GLfloat)*params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4308 | } |
| 4309 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4310 | void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4311 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4312 | 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] | 4313 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4314 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4315 | if (context) |
| 4316 | { |
| 4317 | if (!ValidateTexParamParameters(context, pname, param)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4318 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4319 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4320 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4321 | |
| 4322 | gl::Texture *texture = context->getTargetTexture(target); |
| 4323 | |
| 4324 | if (!texture) |
| 4325 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4326 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4327 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4328 | } |
| 4329 | |
| 4330 | switch (pname) |
| 4331 | { |
| 4332 | case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = (GLenum)param; break; |
| 4333 | case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = (GLenum)param; break; |
| 4334 | case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = (GLenum)param; break; |
| 4335 | case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = (GLenum)param; break; |
| 4336 | case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = (GLenum)param; break; |
| 4337 | case GL_TEXTURE_USAGE_ANGLE: texture->setUsage((GLenum)param); break; |
| 4338 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min((float)param, context->getExtensions().maxTextureAnisotropy); break; |
| 4339 | case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = (GLenum)param; break; |
| 4340 | case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = (GLenum)param; break; |
| 4341 | case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = (GLenum)param; break; |
| 4342 | case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = (GLenum)param; break; |
| 4343 | case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = (GLenum)param; break; |
| 4344 | case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = (GLenum)param; break; |
| 4345 | case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = param; break; |
| 4346 | case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = param; break; |
| 4347 | case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = (GLfloat)param; break; |
| 4348 | case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = (GLfloat)param; break; |
| 4349 | default: UNREACHABLE(); break; |
| 4350 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4351 | } |
| 4352 | } |
| 4353 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4354 | void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4355 | { |
| 4356 | glTexParameteri(target, pname, *params); |
| 4357 | } |
| 4358 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4359 | 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] | 4360 | { |
| 4361 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 4362 | target, levels, internalformat, width, height); |
| 4363 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4364 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4365 | if (context) |
| 4366 | { |
| 4367 | if (!context->getExtensions().textureStorage) |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4368 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4369 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4370 | return; |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4371 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4372 | |
| 4373 | if (context->getClientVersion() < 3 && |
| 4374 | !ValidateES2TexStorageParameters(context, target, levels, internalformat, width, height)) |
| 4375 | { |
| 4376 | return; |
| 4377 | } |
| 4378 | |
| 4379 | if (context->getClientVersion() >= 3 && |
| 4380 | !ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1)) |
| 4381 | { |
| 4382 | return; |
| 4383 | } |
| 4384 | |
| 4385 | switch (target) |
| 4386 | { |
| 4387 | case GL_TEXTURE_2D: |
| 4388 | { |
| 4389 | gl::Texture2D *texture2d = context->getTexture2D(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 4390 | gl::Error error = texture2d->storage(levels, internalformat, width, height); |
| 4391 | if (error.isError()) |
| 4392 | { |
| 4393 | context->recordError(error); |
| 4394 | return; |
| 4395 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4396 | } |
| 4397 | break; |
| 4398 | |
| 4399 | case GL_TEXTURE_CUBE_MAP: |
| 4400 | { |
| 4401 | gl::TextureCubeMap *textureCube = context->getTextureCubeMap(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 4402 | gl::Error error = textureCube->storage(levels, internalformat, width); |
| 4403 | if (error.isError()) |
| 4404 | { |
| 4405 | context->recordError(error); |
| 4406 | return; |
| 4407 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4408 | } |
| 4409 | break; |
| 4410 | |
| 4411 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4412 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4413 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4414 | } |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4415 | } |
| 4416 | } |
| 4417 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4418 | 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] | 4419 | GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4420 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4421 | 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] | 4422 | "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] | 4423 | "const GLvoid* pixels = 0x%0.8p)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4424 | target, level, xoffset, yoffset, width, height, format, type, pixels); |
| 4425 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4426 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4427 | if (context) |
| 4428 | { |
| 4429 | if (context->getClientVersion() < 3 && |
| 4430 | !ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true, |
| 4431 | xoffset, yoffset, width, height, 0, format, type, pixels)) |
daniel@transgaming.com | 00c7596 | 2010-03-11 20:36:15 +0000 | [diff] [blame] | 4432 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4433 | return; |
daniel@transgaming.com | 00c7596 | 2010-03-11 20:36:15 +0000 | [diff] [blame] | 4434 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4435 | |
| 4436 | if (context->getClientVersion() >= 3 && |
| 4437 | !ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true, |
| 4438 | xoffset, yoffset, 0, width, height, 1, 0, format, type, pixels)) |
| 4439 | { |
| 4440 | return; |
| 4441 | } |
| 4442 | |
| 4443 | // Zero sized uploads are valid but no-ops |
| 4444 | if (width == 0 || height == 0) |
| 4445 | { |
| 4446 | return; |
| 4447 | } |
| 4448 | |
| 4449 | switch (target) |
| 4450 | { |
| 4451 | case GL_TEXTURE_2D: |
| 4452 | { |
| 4453 | gl::Texture2D *texture = context->getTexture2D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 4454 | gl::Error error = texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels); |
| 4455 | if (error.isError()) |
| 4456 | { |
| 4457 | context->recordError(error); |
| 4458 | return; |
| 4459 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4460 | } |
| 4461 | break; |
| 4462 | |
| 4463 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 4464 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 4465 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 4466 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 4467 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 4468 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 4469 | { |
| 4470 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 4471 | gl::Error error = texture->subImage(target, level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels); |
| 4472 | if (error.isError()) |
| 4473 | { |
| 4474 | context->recordError(error); |
| 4475 | return; |
| 4476 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4477 | } |
| 4478 | break; |
| 4479 | |
| 4480 | default: |
| 4481 | UNREACHABLE(); |
| 4482 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4483 | } |
| 4484 | } |
| 4485 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4486 | void GL_APIENTRY glUniform1f(GLint location, GLfloat x) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4487 | { |
| 4488 | glUniform1fv(location, 1, &x); |
| 4489 | } |
| 4490 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4491 | void GL_APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4492 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4493 | 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] | 4494 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4495 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4496 | if (context) |
| 4497 | { |
| 4498 | if (!ValidateUniform(context, GL_FLOAT, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4499 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4500 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4501 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4502 | |
| 4503 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4504 | programBinary->setUniform1fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4505 | } |
| 4506 | } |
| 4507 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4508 | void GL_APIENTRY glUniform1i(GLint location, GLint x) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4509 | { |
| 4510 | glUniform1iv(location, 1, &x); |
| 4511 | } |
| 4512 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4513 | void GL_APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4514 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4515 | 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] | 4516 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4517 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4518 | if (context) |
| 4519 | { |
| 4520 | if (!ValidateUniform(context, GL_INT, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4521 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4522 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4523 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4524 | |
| 4525 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4526 | programBinary->setUniform1iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4527 | } |
| 4528 | } |
| 4529 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4530 | void GL_APIENTRY glUniform2f(GLint location, GLfloat x, GLfloat y) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4531 | { |
| 4532 | GLfloat xy[2] = {x, y}; |
| 4533 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4534 | glUniform2fv(location, 1, xy); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4535 | } |
| 4536 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4537 | void GL_APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4538 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4539 | 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] | 4540 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4541 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4542 | if (context) |
| 4543 | { |
| 4544 | if (!ValidateUniform(context, GL_FLOAT_VEC2, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4545 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4546 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4547 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4548 | |
| 4549 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4550 | programBinary->setUniform2fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4551 | } |
| 4552 | } |
| 4553 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4554 | void GL_APIENTRY glUniform2i(GLint location, GLint x, GLint y) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4555 | { |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4556 | GLint xy[2] = {x, y}; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4557 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4558 | glUniform2iv(location, 1, xy); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4559 | } |
| 4560 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4561 | void GL_APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4562 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4563 | 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] | 4564 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4565 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4566 | if (context) |
| 4567 | { |
| 4568 | if (!ValidateUniform(context, GL_INT_VEC2, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4569 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4570 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4571 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4572 | |
| 4573 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4574 | programBinary->setUniform2iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4575 | } |
| 4576 | } |
| 4577 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4578 | 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] | 4579 | { |
| 4580 | GLfloat xyz[3] = {x, y, z}; |
| 4581 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4582 | glUniform3fv(location, 1, xyz); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4583 | } |
| 4584 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4585 | void GL_APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4586 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4587 | 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] | 4588 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4589 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4590 | if (context) |
| 4591 | { |
| 4592 | if (!ValidateUniform(context, GL_FLOAT_VEC3, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4593 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4594 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4595 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4596 | |
| 4597 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4598 | programBinary->setUniform3fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4599 | } |
| 4600 | } |
| 4601 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4602 | 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] | 4603 | { |
| 4604 | GLint xyz[3] = {x, y, z}; |
| 4605 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4606 | glUniform3iv(location, 1, xyz); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4607 | } |
| 4608 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4609 | void GL_APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4610 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4611 | 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] | 4612 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4613 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4614 | if (context) |
| 4615 | { |
| 4616 | if (!ValidateUniform(context, GL_INT_VEC3, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4617 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4618 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4619 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4620 | |
| 4621 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4622 | programBinary->setUniform3iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4623 | } |
| 4624 | } |
| 4625 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4626 | 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] | 4627 | { |
| 4628 | GLfloat xyzw[4] = {x, y, z, w}; |
| 4629 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4630 | glUniform4fv(location, 1, xyzw); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4631 | } |
| 4632 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4633 | void GL_APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4634 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4635 | 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] | 4636 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4637 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4638 | if (context) |
| 4639 | { |
| 4640 | if (!ValidateUniform(context, GL_FLOAT_VEC4, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4641 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4642 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4643 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4644 | |
| 4645 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4646 | programBinary->setUniform4fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4647 | } |
| 4648 | } |
| 4649 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4650 | 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] | 4651 | { |
| 4652 | GLint xyzw[4] = {x, y, z, w}; |
| 4653 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4654 | glUniform4iv(location, 1, xyzw); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4655 | } |
| 4656 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4657 | void GL_APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4658 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4659 | 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] | 4660 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4661 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4662 | if (context) |
| 4663 | { |
| 4664 | if (!ValidateUniform(context, GL_INT_VEC4, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4665 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4666 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4667 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4668 | |
| 4669 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4670 | programBinary->setUniform4iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4671 | } |
| 4672 | } |
| 4673 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4674 | 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] | 4675 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4676 | 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] | 4677 | location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4678 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4679 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4680 | if (context) |
| 4681 | { |
| 4682 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4683 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4684 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4685 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4686 | |
| 4687 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4688 | programBinary->setUniformMatrix2fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4689 | } |
| 4690 | } |
| 4691 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4692 | 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] | 4693 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4694 | 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] | 4695 | location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4696 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4697 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4698 | if (context) |
| 4699 | { |
| 4700 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3, location, count, transpose)) |
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 | return; |
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 | |
| 4705 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4706 | programBinary->setUniformMatrix3fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4707 | } |
| 4708 | } |
| 4709 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4710 | 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] | 4711 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4712 | 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] | 4713 | location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4714 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4715 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4716 | if (context) |
| 4717 | { |
| 4718 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4719 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4720 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4721 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4722 | |
| 4723 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4724 | programBinary->setUniformMatrix4fv(location, count, transpose, value); |
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 glUseProgram(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) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4734 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4735 | gl::Program *programObject = context->getProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4736 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4737 | if (!programObject && program != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4738 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4739 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +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 | 4f39fd9 | 2010-03-08 20:26:45 +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 | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4749 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4750 | |
| 4751 | if (program != 0 && !programObject->isLinked()) |
| 4752 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4753 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4754 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4755 | } |
| 4756 | |
| 4757 | context->useProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4758 | } |
| 4759 | } |
| 4760 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4761 | void GL_APIENTRY glValidateProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4762 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4763 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4764 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4765 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4766 | if (context) |
| 4767 | { |
| 4768 | gl::Program *programObject = context->getProgram(program); |
| 4769 | |
| 4770 | if (!programObject) |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4771 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4772 | if (context->getShader(program)) |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4773 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4774 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4775 | return; |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4776 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4777 | else |
| 4778 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4779 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4780 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4781 | } |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4782 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4783 | |
Brandon Jones | 43a53e2 | 2014-08-28 16:23:22 -0700 | [diff] [blame] | 4784 | programObject->validate(context->getCaps()); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4785 | } |
| 4786 | } |
| 4787 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4788 | void GL_APIENTRY glVertexAttrib1f(GLuint index, GLfloat x) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4789 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4790 | EVENT("(GLuint index = %d, GLfloat x = %f)", index, x); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4791 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4792 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4793 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4794 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4795 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4796 | { |
| 4797 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4798 | return; |
| 4799 | } |
| 4800 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4801 | GLfloat vals[4] = { x, 0, 0, 1 }; |
| 4802 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4803 | } |
| 4804 | } |
| 4805 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4806 | void GL_APIENTRY glVertexAttrib1fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4807 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4808 | 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] | 4809 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4810 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4811 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4812 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4813 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4814 | { |
| 4815 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4816 | return; |
| 4817 | } |
| 4818 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4819 | GLfloat vals[4] = { values[0], 0, 0, 1 }; |
| 4820 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4821 | } |
| 4822 | } |
| 4823 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4824 | void GL_APIENTRY glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4825 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4826 | 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] | 4827 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4828 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4829 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4830 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4831 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4832 | { |
| 4833 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4834 | return; |
| 4835 | } |
| 4836 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4837 | GLfloat vals[4] = { x, y, 0, 1 }; |
| 4838 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4839 | } |
| 4840 | } |
| 4841 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4842 | void GL_APIENTRY glVertexAttrib2fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4843 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4844 | 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] | 4845 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4846 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4847 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4848 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4849 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4850 | { |
| 4851 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4852 | return; |
| 4853 | } |
| 4854 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4855 | GLfloat vals[4] = { values[0], values[1], 0, 1 }; |
| 4856 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4857 | } |
| 4858 | } |
| 4859 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4860 | 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] | 4861 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4862 | 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] | 4863 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4864 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4865 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4866 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4867 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4868 | { |
| 4869 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4870 | return; |
| 4871 | } |
| 4872 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4873 | GLfloat vals[4] = { x, y, z, 1 }; |
| 4874 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4875 | } |
| 4876 | } |
| 4877 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4878 | void GL_APIENTRY glVertexAttrib3fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4879 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4880 | 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] | 4881 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4882 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4883 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4884 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4885 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4886 | { |
| 4887 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4888 | return; |
| 4889 | } |
| 4890 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4891 | GLfloat vals[4] = { values[0], values[1], values[2], 1 }; |
| 4892 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4893 | } |
| 4894 | } |
| 4895 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4896 | 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] | 4897 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4898 | 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] | 4899 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4900 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4901 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4902 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4903 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4904 | { |
| 4905 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4906 | return; |
| 4907 | } |
| 4908 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4909 | GLfloat vals[4] = { x, y, z, w }; |
| 4910 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4911 | } |
| 4912 | } |
| 4913 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4914 | void GL_APIENTRY glVertexAttrib4fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4915 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4916 | 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] | 4917 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4918 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4919 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4920 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4921 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4922 | { |
| 4923 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4924 | return; |
| 4925 | } |
| 4926 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4927 | context->getState().setVertexAttribf(index, values); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4928 | } |
| 4929 | } |
| 4930 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4931 | void GL_APIENTRY glVertexAttribDivisorANGLE(GLuint index, GLuint divisor) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4932 | { |
| 4933 | EVENT("(GLuint index = %d, GLuint divisor = %d)", index, divisor); |
| 4934 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4935 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4936 | if (context) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4937 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4938 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4939 | { |
| 4940 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4941 | return; |
| 4942 | } |
| 4943 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4944 | context->setVertexAttribDivisor(index, divisor); |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4945 | } |
| 4946 | } |
| 4947 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4948 | 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] | 4949 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4950 | 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] | 4951 | "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] | 4952 | index, size, type, normalized, stride, ptr); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4953 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4954 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4955 | if (context) |
| 4956 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4957 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4958 | { |
| 4959 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4960 | return; |
| 4961 | } |
| 4962 | |
| 4963 | if (size < 1 || size > 4) |
| 4964 | { |
| 4965 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4966 | return; |
| 4967 | } |
| 4968 | |
| 4969 | switch (type) |
| 4970 | { |
| 4971 | case GL_BYTE: |
| 4972 | case GL_UNSIGNED_BYTE: |
| 4973 | case GL_SHORT: |
| 4974 | case GL_UNSIGNED_SHORT: |
| 4975 | case GL_FIXED: |
| 4976 | case GL_FLOAT: |
| 4977 | break; |
| 4978 | |
| 4979 | case GL_HALF_FLOAT: |
| 4980 | case GL_INT: |
| 4981 | case GL_UNSIGNED_INT: |
| 4982 | case GL_INT_2_10_10_10_REV: |
| 4983 | case GL_UNSIGNED_INT_2_10_10_10_REV: |
| 4984 | if (context->getClientVersion() < 3) |
| 4985 | { |
| 4986 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4987 | return; |
| 4988 | } |
| 4989 | break; |
| 4990 | |
| 4991 | default: |
| 4992 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4993 | return; |
| 4994 | } |
| 4995 | |
| 4996 | if (stride < 0) |
| 4997 | { |
| 4998 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4999 | return; |
| 5000 | } |
| 5001 | |
| 5002 | if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4) |
| 5003 | { |
| 5004 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5005 | return; |
| 5006 | } |
| 5007 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5008 | // [OpenGL ES 3.0.2] Section 2.8 page 24: |
| 5009 | // An INVALID_OPERATION error is generated when a non-zero vertex array object |
| 5010 | // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point, |
| 5011 | // and the pointer argument is not NULL. |
| 5012 | 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] | 5013 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5014 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5015 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 1ab57be | 2013-04-13 03:38:39 +0000 | [diff] [blame] | 5016 | } |
| 5017 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5018 | context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type, |
| 5019 | normalized == GL_TRUE, false, stride, ptr); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 5020 | } |
| 5021 | } |
| 5022 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5023 | 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] | 5024 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 5025 | 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] | 5026 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5027 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5028 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 5029 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5030 | if (width < 0 || height < 0) |
| 5031 | { |
| 5032 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5033 | return; |
| 5034 | } |
| 5035 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5036 | context->getState().setViewportParams(x, y, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 5037 | } |
| 5038 | } |
| 5039 | |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5040 | // OpenGL ES 3.0 functions |
| 5041 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5042 | void GL_APIENTRY glReadBuffer(GLenum mode) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5043 | { |
| 5044 | EVENT("(GLenum mode = 0x%X)", mode); |
| 5045 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5046 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5047 | if (context) |
| 5048 | { |
| 5049 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5050 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5051 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5052 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5053 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5054 | |
| 5055 | // glReadBuffer |
| 5056 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5057 | } |
| 5058 | } |
| 5059 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5060 | 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] | 5061 | { |
| 5062 | EVENT("(GLenum mode = 0x%X, GLuint start = %u, GLuint end = %u, GLsizei count = %d, GLenum type = 0x%X, " |
| 5063 | "const GLvoid* indices = 0x%0.8p)", mode, start, end, count, type, indices); |
| 5064 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5065 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5066 | if (context) |
| 5067 | { |
| 5068 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5069 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5070 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5071 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5072 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5073 | |
| 5074 | // glDrawRangeElements |
| 5075 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5076 | } |
| 5077 | } |
| 5078 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5079 | 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] | 5080 | { |
| 5081 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, " |
| 5082 | "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLenum format = 0x%X, " |
| 5083 | "GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", |
| 5084 | target, level, internalformat, width, height, depth, border, format, type, pixels); |
| 5085 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5086 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5087 | if (context) |
| 5088 | { |
| 5089 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5090 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5091 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5092 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5093 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5094 | |
| 5095 | // validateES3TexImageFormat sets the error code if there is an error |
| 5096 | if (!ValidateES3TexImageParameters(context, target, level, internalformat, false, false, |
| 5097 | 0, 0, 0, width, height, depth, border, format, type, pixels)) |
| 5098 | { |
| 5099 | return; |
| 5100 | } |
| 5101 | |
| 5102 | switch(target) |
| 5103 | { |
| 5104 | case GL_TEXTURE_3D: |
| 5105 | { |
| 5106 | gl::Texture3D *texture = context->getTexture3D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5107 | gl::Error error = texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 5108 | if (error.isError()) |
| 5109 | { |
| 5110 | context->recordError(error); |
| 5111 | return; |
| 5112 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5113 | } |
| 5114 | break; |
| 5115 | |
| 5116 | case GL_TEXTURE_2D_ARRAY: |
| 5117 | { |
| 5118 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5119 | gl::Error error = texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 5120 | if (error.isError()) |
| 5121 | { |
| 5122 | context->recordError(error); |
| 5123 | return; |
| 5124 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5125 | } |
| 5126 | break; |
| 5127 | |
| 5128 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5129 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5130 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5131 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5132 | } |
| 5133 | } |
| 5134 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5135 | 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] | 5136 | { |
| 5137 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5138 | "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, " |
| 5139 | "GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", |
| 5140 | target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); |
| 5141 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5142 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5143 | if (context) |
| 5144 | { |
| 5145 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5146 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5147 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5148 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5149 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5150 | |
| 5151 | // validateES3TexImageFormat sets the error code if there is an error |
| 5152 | if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true, |
| 5153 | xoffset, yoffset, zoffset, width, height, depth, 0, |
| 5154 | format, type, pixels)) |
| 5155 | { |
| 5156 | return; |
| 5157 | } |
| 5158 | |
| 5159 | // Zero sized uploads are valid but no-ops |
| 5160 | if (width == 0 || height == 0 || depth == 0) |
| 5161 | { |
| 5162 | return; |
| 5163 | } |
| 5164 | |
| 5165 | switch(target) |
| 5166 | { |
| 5167 | case GL_TEXTURE_3D: |
| 5168 | { |
| 5169 | gl::Texture3D *texture = context->getTexture3D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5170 | gl::Error error = texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels); |
| 5171 | if (error.isError()) |
| 5172 | { |
| 5173 | context->recordError(error); |
| 5174 | return; |
| 5175 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5176 | } |
| 5177 | break; |
| 5178 | |
| 5179 | case GL_TEXTURE_2D_ARRAY: |
| 5180 | { |
| 5181 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5182 | gl::Error error = texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels); |
| 5183 | if (error.isError()) |
| 5184 | { |
| 5185 | context->recordError(error); |
| 5186 | return; |
| 5187 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5188 | } |
| 5189 | break; |
| 5190 | |
| 5191 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5192 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5193 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5194 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5195 | } |
| 5196 | } |
| 5197 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5198 | 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] | 5199 | { |
| 5200 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5201 | "GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", |
| 5202 | target, level, xoffset, yoffset, zoffset, x, y, width, height); |
| 5203 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5204 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5205 | if (context) |
| 5206 | { |
| 5207 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5208 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5209 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5210 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5211 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5212 | |
| 5213 | if (!ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true, xoffset, yoffset, zoffset, |
| 5214 | x, y, width, height, 0)) |
| 5215 | { |
| 5216 | return; |
| 5217 | } |
| 5218 | |
| 5219 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 5220 | gl::Texture *texture = NULL; |
| 5221 | switch (target) |
| 5222 | { |
| 5223 | case GL_TEXTURE_3D: |
| 5224 | texture = context->getTexture3D(); |
| 5225 | break; |
| 5226 | |
| 5227 | case GL_TEXTURE_2D_ARRAY: |
| 5228 | texture = context->getTexture2DArray(); |
| 5229 | break; |
| 5230 | |
| 5231 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5232 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5233 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5234 | } |
| 5235 | |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 5236 | gl::Error error = texture->copySubImage(target, level, xoffset, yoffset, zoffset, x, y, width, height, framebuffer); |
| 5237 | if (error.isError()) |
| 5238 | { |
| 5239 | context->recordError(error); |
| 5240 | return; |
| 5241 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5242 | } |
| 5243 | } |
| 5244 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5245 | 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] | 5246 | { |
Geoff Lang | eef52cc | 2013-10-16 15:07:39 -0400 | [diff] [blame] | 5247 | 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] | 5248 | "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLsizei imageSize = %d, " |
| 5249 | "const GLvoid* data = 0x%0.8p)", |
| 5250 | target, level, internalformat, width, height, depth, border, imageSize, data); |
| 5251 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5252 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5253 | if (context) |
| 5254 | { |
| 5255 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5256 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5257 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5258 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5259 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5260 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 5261 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat); |
| 5262 | 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] | 5263 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5264 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5265 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5266 | } |
| 5267 | |
| 5268 | // validateES3TexImageFormat sets the error code if there is an error |
| 5269 | if (!ValidateES3TexImageParameters(context, target, level, internalformat, true, false, |
| 5270 | 0, 0, 0, width, height, depth, border, GL_NONE, GL_NONE, data)) |
| 5271 | { |
| 5272 | return; |
| 5273 | } |
| 5274 | |
| 5275 | switch(target) |
| 5276 | { |
| 5277 | case GL_TEXTURE_3D: |
| 5278 | { |
| 5279 | gl::Texture3D *texture = context->getTexture3D(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 5280 | 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] | 5281 | if (error.isError()) |
| 5282 | { |
| 5283 | context->recordError(error); |
| 5284 | return; |
| 5285 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5286 | } |
| 5287 | break; |
| 5288 | |
| 5289 | case GL_TEXTURE_2D_ARRAY: |
| 5290 | { |
| 5291 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 5292 | 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] | 5293 | if (error.isError()) |
| 5294 | { |
| 5295 | context->recordError(error); |
| 5296 | return; |
| 5297 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5298 | } |
| 5299 | break; |
| 5300 | |
| 5301 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5302 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5303 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5304 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5305 | } |
| 5306 | } |
| 5307 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5308 | 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] | 5309 | { |
| 5310 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5311 | "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, " |
| 5312 | "GLenum format = 0x%X, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
| 5313 | target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); |
| 5314 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5315 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5316 | if (context) |
| 5317 | { |
| 5318 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5319 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5320 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5321 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5322 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5323 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 5324 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format); |
| 5325 | 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] | 5326 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5327 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5328 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5329 | } |
| 5330 | |
| 5331 | if (!data) |
| 5332 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5333 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5334 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5335 | } |
| 5336 | |
| 5337 | // validateES3TexImageFormat sets the error code if there is an error |
| 5338 | if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true, |
| 5339 | 0, 0, 0, width, height, depth, 0, GL_NONE, GL_NONE, data)) |
| 5340 | { |
| 5341 | return; |
| 5342 | } |
| 5343 | |
| 5344 | // Zero sized uploads are valid but no-ops |
| 5345 | if (width == 0 || height == 0) |
| 5346 | { |
| 5347 | return; |
| 5348 | } |
| 5349 | |
| 5350 | switch(target) |
| 5351 | { |
| 5352 | case GL_TEXTURE_3D: |
| 5353 | { |
| 5354 | gl::Texture3D *texture = context->getTexture3D(); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5355 | gl::Error error = texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 5356 | format, imageSize, context->getState().getUnpackState(), data); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5357 | if (error.isError()) |
| 5358 | { |
| 5359 | context->recordError(error); |
| 5360 | return; |
| 5361 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5362 | } |
| 5363 | break; |
| 5364 | |
| 5365 | case GL_TEXTURE_2D_ARRAY: |
| 5366 | { |
| 5367 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5368 | gl::Error error = texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 5369 | format, imageSize, context->getState().getUnpackState(), data); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5370 | if (error.isError()) |
| 5371 | { |
| 5372 | context->recordError(error); |
| 5373 | return; |
| 5374 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5375 | } |
| 5376 | break; |
| 5377 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5378 | default: |
| 5379 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5380 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5381 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5382 | } |
| 5383 | } |
| 5384 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5385 | void GL_APIENTRY glGenQueries(GLsizei n, GLuint* ids) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5386 | { |
| 5387 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 5388 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5389 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5390 | if (context) |
| 5391 | { |
| 5392 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5393 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5394 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5395 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5396 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5397 | |
| 5398 | if (n < 0) |
| 5399 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5400 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5401 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5402 | } |
| 5403 | |
| 5404 | for (GLsizei i = 0; i < n; i++) |
| 5405 | { |
| 5406 | ids[i] = context->createQuery(); |
| 5407 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5408 | } |
| 5409 | } |
| 5410 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5411 | 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] | 5412 | { |
| 5413 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 5414 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5415 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5416 | if (context) |
| 5417 | { |
| 5418 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5419 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5420 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5421 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5422 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5423 | |
| 5424 | if (n < 0) |
| 5425 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5426 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5427 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5428 | } |
| 5429 | |
| 5430 | for (GLsizei i = 0; i < n; i++) |
| 5431 | { |
| 5432 | context->deleteQuery(ids[i]); |
| 5433 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5434 | } |
| 5435 | } |
| 5436 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5437 | GLboolean GL_APIENTRY glIsQuery(GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5438 | { |
| 5439 | EVENT("(GLuint id = %u)", id); |
| 5440 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5441 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5442 | if (context) |
| 5443 | { |
| 5444 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5445 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5446 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5447 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5448 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5449 | |
| 5450 | 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] | 5451 | } |
| 5452 | |
| 5453 | return GL_FALSE; |
| 5454 | } |
| 5455 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5456 | void GL_APIENTRY glBeginQuery(GLenum target, GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5457 | { |
| 5458 | EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id); |
| 5459 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5460 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5461 | if (context) |
| 5462 | { |
| 5463 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5464 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5465 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5466 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5467 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5468 | |
| 5469 | if (!ValidateBeginQuery(context, target, id)) |
| 5470 | { |
| 5471 | return; |
| 5472 | } |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5473 | |
| 5474 | gl::Error error = context->beginQuery(target, id); |
| 5475 | if (error.isError()) |
| 5476 | { |
| 5477 | context->recordError(error); |
| 5478 | return; |
| 5479 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5480 | } |
| 5481 | } |
| 5482 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5483 | void GL_APIENTRY glEndQuery(GLenum target) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5484 | { |
| 5485 | EVENT("(GLenum target = 0x%X)", target); |
| 5486 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5487 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5488 | if (context) |
| 5489 | { |
| 5490 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5491 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5492 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5493 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5494 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5495 | |
| 5496 | if (!ValidateEndQuery(context, target)) |
| 5497 | { |
| 5498 | return; |
| 5499 | } |
| 5500 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5501 | gl::Error error = context->endQuery(target); |
| 5502 | if (error.isError()) |
| 5503 | { |
| 5504 | context->recordError(error); |
| 5505 | return; |
| 5506 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5507 | } |
| 5508 | } |
| 5509 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5510 | 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] | 5511 | { |
| 5512 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params); |
| 5513 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5514 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5515 | if (context) |
| 5516 | { |
| 5517 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5518 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5519 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5520 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5521 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5522 | |
| 5523 | if (!ValidQueryType(context, target)) |
| 5524 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5525 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5526 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5527 | } |
| 5528 | |
| 5529 | switch (pname) |
| 5530 | { |
| 5531 | case GL_CURRENT_QUERY: |
| 5532 | params[0] = static_cast<GLint>(context->getState().getActiveQueryId(target)); |
| 5533 | break; |
| 5534 | |
| 5535 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5536 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5537 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5538 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5539 | } |
| 5540 | } |
| 5541 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5542 | 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] | 5543 | { |
| 5544 | EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", id, pname, params); |
| 5545 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5546 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5547 | if (context) |
| 5548 | { |
| 5549 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5550 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5551 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5552 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5553 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5554 | |
| 5555 | gl::Query *queryObject = context->getQuery(id, false, GL_NONE); |
| 5556 | |
| 5557 | if (!queryObject) |
| 5558 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5559 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5560 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5561 | } |
| 5562 | |
| 5563 | if (context->getState().getActiveQueryId(queryObject->getType()) == id) |
| 5564 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5565 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5566 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5567 | } |
| 5568 | |
| 5569 | switch(pname) |
| 5570 | { |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5571 | case GL_QUERY_RESULT_EXT: |
| 5572 | { |
| 5573 | gl::Error error = queryObject->getResult(params); |
| 5574 | if (error.isError()) |
| 5575 | { |
| 5576 | context->recordError(error); |
| 5577 | return; |
| 5578 | } |
| 5579 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5580 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5581 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5582 | case GL_QUERY_RESULT_AVAILABLE_EXT: |
| 5583 | { |
| 5584 | gl::Error error = queryObject->isResultAvailable(params); |
| 5585 | if (error.isError()) |
| 5586 | { |
| 5587 | context->recordError(error); |
| 5588 | return; |
| 5589 | } |
| 5590 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5591 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5592 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5593 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5594 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5595 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5596 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5597 | } |
| 5598 | } |
| 5599 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5600 | GLboolean GL_APIENTRY glUnmapBuffer(GLenum target) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5601 | { |
| 5602 | EVENT("(GLenum target = 0x%X)", target); |
| 5603 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5604 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5605 | if (context) |
| 5606 | { |
| 5607 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5608 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5609 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5610 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5611 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5612 | |
| 5613 | return glUnmapBufferOES(target); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5614 | } |
| 5615 | |
| 5616 | return GL_FALSE; |
| 5617 | } |
| 5618 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5619 | 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] | 5620 | { |
| 5621 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params); |
| 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 (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5627 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5628 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5629 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5630 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5631 | |
| 5632 | glGetBufferPointervOES(target, pname, params); |
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 glDrawBuffers(GLsizei n, const GLenum* bufs) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5637 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5638 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5639 | if (context) |
| 5640 | { |
| 5641 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5642 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5643 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5644 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 7948c5f | 2013-04-13 03:38:58 +0000 | [diff] [blame] | 5645 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5646 | |
| 5647 | glDrawBuffersEXT(n, bufs); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5648 | } |
| 5649 | } |
| 5650 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5651 | 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] | 5652 | { |
| 5653 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5654 | location, count, transpose, value); |
| 5655 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5656 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5657 | if (context) |
| 5658 | { |
| 5659 | 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] | 5660 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5661 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5662 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5663 | |
| 5664 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5665 | programBinary->setUniformMatrix2x3fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5666 | } |
| 5667 | } |
| 5668 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5669 | 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] | 5670 | { |
| 5671 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5672 | location, count, transpose, value); |
| 5673 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5674 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5675 | if (context) |
| 5676 | { |
| 5677 | 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] | 5678 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5679 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5680 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5681 | |
| 5682 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5683 | programBinary->setUniformMatrix3x2fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5684 | } |
| 5685 | } |
| 5686 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5687 | 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] | 5688 | { |
| 5689 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5690 | location, count, transpose, value); |
| 5691 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5692 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5693 | if (context) |
| 5694 | { |
| 5695 | 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] | 5696 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5697 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5698 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5699 | |
| 5700 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5701 | programBinary->setUniformMatrix2x4fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5702 | } |
| 5703 | } |
| 5704 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5705 | 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] | 5706 | { |
| 5707 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5708 | location, count, transpose, value); |
| 5709 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5710 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5711 | if (context) |
| 5712 | { |
| 5713 | 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] | 5714 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5715 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5716 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5717 | |
| 5718 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5719 | programBinary->setUniformMatrix4x2fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5720 | } |
| 5721 | } |
| 5722 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5723 | 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] | 5724 | { |
| 5725 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5726 | location, count, transpose, value); |
| 5727 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5728 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5729 | if (context) |
| 5730 | { |
| 5731 | 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] | 5732 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5733 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5734 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5735 | |
| 5736 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5737 | programBinary->setUniformMatrix3x4fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5738 | } |
| 5739 | } |
| 5740 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5741 | 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] | 5742 | { |
| 5743 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5744 | location, count, transpose, value); |
| 5745 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5746 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5747 | if (context) |
| 5748 | { |
| 5749 | 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] | 5750 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5751 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5752 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5753 | |
| 5754 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5755 | programBinary->setUniformMatrix4x3fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5756 | } |
| 5757 | } |
| 5758 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5759 | 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] | 5760 | { |
| 5761 | EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, GLint dstX0 = %d, " |
| 5762 | "GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, GLbitfield mask = 0x%X, GLenum filter = 0x%X)", |
| 5763 | srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 5764 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5765 | gl::Context *context = gl::getNonLostContext(); |
| 5766 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5767 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5768 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5769 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5770 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5771 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5772 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5773 | |
| 5774 | if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, |
| 5775 | dstX0, dstY0, dstX1, dstY1, mask, filter, |
| 5776 | false)) |
| 5777 | { |
| 5778 | return; |
| 5779 | } |
| 5780 | |
Geoff Lang | 6483915 | 2014-08-26 16:23:25 -0400 | [diff] [blame] | 5781 | gl::Error error = context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, |
| 5782 | mask, filter); |
| 5783 | if (error.isError()) |
| 5784 | { |
| 5785 | context->recordError(error); |
| 5786 | return; |
| 5787 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5788 | } |
| 5789 | } |
| 5790 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5791 | 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] | 5792 | { |
| 5793 | EVENT("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 5794 | target, samples, internalformat, width, height); |
| 5795 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5796 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5797 | if (context) |
| 5798 | { |
| 5799 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5800 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5801 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5802 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5803 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5804 | |
| 5805 | if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat, |
| 5806 | width, height, false)) |
| 5807 | { |
| 5808 | return; |
| 5809 | } |
| 5810 | |
Shannon Woods | e2632d2 | 2014-10-17 13:08:51 -0400 | [diff] [blame] | 5811 | gl::Renderbuffer *renderbuffer = context->getState().getCurrentRenderbuffer(); |
| 5812 | renderbuffer->setStorage(width, height, internalformat, samples); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5813 | } |
| 5814 | } |
| 5815 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5816 | 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] | 5817 | { |
| 5818 | EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d, GLint layer = %d)", |
| 5819 | target, attachment, texture, level, layer); |
| 5820 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5821 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5822 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5823 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5824 | if (!ValidateFramebufferTextureLayer(context, target, attachment, texture, |
| 5825 | level, layer)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5826 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5827 | return; |
| 5828 | } |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5829 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5830 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 5831 | ASSERT(framebuffer); |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5832 | |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 5833 | if (texture != 0) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5834 | { |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 5835 | gl::Texture *textureObject = context->getTexture(texture); |
| 5836 | gl::ImageIndex index(textureObject->getTarget(), level, layer); |
| 5837 | framebuffer->setTextureAttachment(attachment, textureObject, index); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5838 | } |
| 5839 | else |
| 5840 | { |
Geoff Lang | ab75a05 | 2014-10-15 12:56:37 -0400 | [diff] [blame] | 5841 | framebuffer->setNULLAttachment(attachment); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5842 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5843 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5844 | } |
| 5845 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5846 | 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] | 5847 | { |
| 5848 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)", |
| 5849 | target, offset, length, access); |
| 5850 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5851 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5852 | if (context) |
| 5853 | { |
| 5854 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5855 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5856 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5857 | return NULL; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5858 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5859 | |
| 5860 | return glMapBufferRangeEXT(target, offset, length, access); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5861 | } |
| 5862 | |
| 5863 | return NULL; |
| 5864 | } |
| 5865 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5866 | 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] | 5867 | { |
| 5868 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length); |
| 5869 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5870 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5871 | if (context) |
| 5872 | { |
| 5873 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5874 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5875 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5876 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5877 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5878 | |
| 5879 | glFlushMappedBufferRangeEXT(target, offset, length); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5880 | } |
| 5881 | } |
| 5882 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5883 | void GL_APIENTRY glBindVertexArray(GLuint array) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5884 | { |
| 5885 | EVENT("(GLuint array = %u)", array); |
| 5886 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5887 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5888 | if (context) |
| 5889 | { |
| 5890 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5891 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5892 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5893 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5894 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5895 | |
| 5896 | gl::VertexArray *vao = context->getVertexArray(array); |
| 5897 | |
| 5898 | if (!vao) |
| 5899 | { |
| 5900 | // The default VAO should always exist |
| 5901 | ASSERT(array != 0); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5902 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5903 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5904 | } |
| 5905 | |
| 5906 | context->bindVertexArray(array); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5907 | } |
| 5908 | } |
| 5909 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5910 | 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] | 5911 | { |
| 5912 | EVENT("(GLsizei n = %d, const GLuint* arrays = 0x%0.8p)", n, arrays); |
| 5913 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5914 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5915 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5916 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5917 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5918 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5919 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5920 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5921 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5922 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5923 | if (n < 0) |
| 5924 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5925 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5926 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5927 | } |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5928 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5929 | for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) |
| 5930 | { |
| 5931 | if (arrays[arrayIndex] != 0) |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5932 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5933 | context->deleteVertexArray(arrays[arrayIndex]); |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5934 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5935 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5936 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5937 | } |
| 5938 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5939 | void GL_APIENTRY glGenVertexArrays(GLsizei n, GLuint* arrays) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5940 | { |
| 5941 | EVENT("(GLsizei n = %d, GLuint* arrays = 0x%0.8p)", n, arrays); |
| 5942 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5943 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5944 | if (context) |
| 5945 | { |
| 5946 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5947 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5948 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5949 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5950 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5951 | |
| 5952 | if (n < 0) |
| 5953 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5954 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5955 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5956 | } |
| 5957 | |
| 5958 | for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) |
| 5959 | { |
| 5960 | arrays[arrayIndex] = context->createVertexArray(); |
| 5961 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5962 | } |
| 5963 | } |
| 5964 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5965 | GLboolean GL_APIENTRY glIsVertexArray(GLuint array) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5966 | { |
| 5967 | EVENT("(GLuint array = %u)", array); |
| 5968 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5969 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5970 | if (context) |
| 5971 | { |
| 5972 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5973 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5974 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5975 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5976 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5977 | |
| 5978 | if (array == 0) |
| 5979 | { |
| 5980 | return GL_FALSE; |
| 5981 | } |
| 5982 | |
| 5983 | gl::VertexArray *vao = context->getVertexArray(array); |
| 5984 | |
| 5985 | return (vao != NULL ? GL_TRUE : GL_FALSE); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5986 | } |
| 5987 | |
| 5988 | return GL_FALSE; |
| 5989 | } |
| 5990 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5991 | 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] | 5992 | { |
| 5993 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint* data = 0x%0.8p)", |
| 5994 | target, index, data); |
| 5995 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5996 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5997 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5998 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5999 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6000 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6001 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6002 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6003 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6004 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6005 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6006 | switch (target) |
| 6007 | { |
| 6008 | case GL_TRANSFORM_FEEDBACK_BUFFER_START: |
| 6009 | case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: |
| 6010 | case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6011 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
| 6012 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6013 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6014 | return; |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6015 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6016 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6017 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6018 | case GL_UNIFORM_BUFFER_START: |
| 6019 | case GL_UNIFORM_BUFFER_SIZE: |
| 6020 | case GL_UNIFORM_BUFFER_BINDING: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6021 | if (index >= caps.maxCombinedUniformBlocks) |
| 6022 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6023 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6024 | return; |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6025 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6026 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6027 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6028 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6029 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6030 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6031 | } |
| 6032 | |
| 6033 | if (!(context->getIndexedIntegerv(target, index, data))) |
| 6034 | { |
| 6035 | GLenum nativeType; |
| 6036 | unsigned int numParams = 0; |
| 6037 | if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams)) |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6038 | { |
| 6039 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6040 | return; |
| 6041 | } |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6042 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6043 | if (numParams == 0) |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6044 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6045 | 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] | 6046 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6047 | |
| 6048 | if (nativeType == GL_INT_64_ANGLEX) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6049 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6050 | GLint64 minIntValue = static_cast<GLint64>(std::numeric_limits<int>::min()); |
| 6051 | GLint64 maxIntValue = static_cast<GLint64>(std::numeric_limits<int>::max()); |
| 6052 | GLint64 *int64Params = new GLint64[numParams]; |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6053 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6054 | context->getIndexedInteger64v(target, index, int64Params); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6055 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6056 | for (unsigned int i = 0; i < numParams; ++i) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6057 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6058 | GLint64 clampedValue = std::max(std::min(int64Params[i], maxIntValue), minIntValue); |
| 6059 | data[i] = static_cast<GLint>(clampedValue); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6060 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6061 | |
| 6062 | delete [] int64Params; |
| 6063 | } |
| 6064 | else |
| 6065 | { |
| 6066 | UNREACHABLE(); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6067 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6068 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6069 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6070 | } |
| 6071 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6072 | void GL_APIENTRY glBeginTransformFeedback(GLenum primitiveMode) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6073 | { |
| 6074 | EVENT("(GLenum primitiveMode = 0x%X)", primitiveMode); |
| 6075 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6076 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6077 | if (context) |
| 6078 | { |
| 6079 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6080 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6081 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6082 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6083 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6084 | |
| 6085 | switch (primitiveMode) |
| 6086 | { |
| 6087 | case GL_TRIANGLES: |
| 6088 | case GL_LINES: |
| 6089 | case GL_POINTS: |
| 6090 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6091 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6092 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6093 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6094 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6095 | } |
| 6096 | |
| 6097 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 6098 | ASSERT(transformFeedback != NULL); |
| 6099 | |
| 6100 | if (transformFeedback->isStarted()) |
| 6101 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6102 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6103 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6104 | } |
| 6105 | |
| 6106 | if (transformFeedback->isPaused()) |
| 6107 | { |
| 6108 | transformFeedback->resume(); |
| 6109 | } |
| 6110 | else |
| 6111 | { |
| 6112 | transformFeedback->start(primitiveMode); |
| 6113 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6114 | } |
| 6115 | } |
| 6116 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6117 | void GL_APIENTRY glEndTransformFeedback(void) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6118 | { |
| 6119 | EVENT("(void)"); |
| 6120 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6121 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6122 | if (context) |
| 6123 | { |
| 6124 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6125 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6126 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6127 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6128 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6129 | |
| 6130 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 6131 | ASSERT(transformFeedback != NULL); |
| 6132 | |
| 6133 | if (!transformFeedback->isStarted()) |
| 6134 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6135 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6136 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6137 | } |
| 6138 | |
| 6139 | transformFeedback->stop(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6140 | } |
| 6141 | } |
| 6142 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6143 | 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] | 6144 | { |
| 6145 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u, GLintptr offset = %d, GLsizeiptr size = %d)", |
| 6146 | target, index, buffer, offset, size); |
| 6147 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6148 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6149 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6150 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6151 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6152 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6153 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6154 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6155 | } |
| 6156 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6157 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6158 | switch (target) |
| 6159 | { |
| 6160 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6161 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6162 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6163 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6164 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6165 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6166 | break; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6167 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6168 | case GL_UNIFORM_BUFFER: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6169 | if (index >= caps.maxUniformBufferBindings) |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6170 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6171 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6172 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6173 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6174 | break; |
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 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6177 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6178 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6179 | } |
| 6180 | |
| 6181 | if (buffer != 0 && size <= 0) |
| 6182 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6183 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6184 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6185 | } |
| 6186 | |
| 6187 | switch (target) |
| 6188 | { |
| 6189 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 6190 | |
| 6191 | // size and offset must be a multiple of 4 |
| 6192 | 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] | 6193 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6194 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6195 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6196 | } |
| 6197 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6198 | context->bindIndexedTransformFeedbackBuffer(buffer, index, offset, size); |
| 6199 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 6200 | break; |
| 6201 | |
| 6202 | case GL_UNIFORM_BUFFER: |
| 6203 | |
| 6204 | // 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] | 6205 | if (buffer != 0 && (offset % caps.uniformBufferOffsetAlignment) != 0) |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [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; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6209 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6210 | |
| 6211 | context->bindIndexedUniformBuffer(buffer, index, offset, size); |
| 6212 | context->bindGenericUniformBuffer(buffer); |
| 6213 | break; |
| 6214 | |
| 6215 | default: |
| 6216 | UNREACHABLE(); |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6217 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6218 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6219 | } |
| 6220 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6221 | 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] | 6222 | { |
| 6223 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u)", |
| 6224 | target, index, buffer); |
| 6225 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6226 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6227 | if (context) |
| 6228 | { |
| 6229 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6230 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6231 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6232 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6233 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6234 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6235 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6236 | switch (target) |
| 6237 | { |
| 6238 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6239 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6240 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6241 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6242 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6243 | } |
| 6244 | break; |
| 6245 | |
| 6246 | case GL_UNIFORM_BUFFER: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6247 | if (index >= caps.maxUniformBufferBindings) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6248 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6249 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6250 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6251 | } |
| 6252 | break; |
| 6253 | |
| 6254 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6255 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6256 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6257 | } |
| 6258 | |
| 6259 | switch (target) |
| 6260 | { |
| 6261 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 6262 | context->bindIndexedTransformFeedbackBuffer(buffer, index, 0, 0); |
| 6263 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 6264 | break; |
| 6265 | |
| 6266 | case GL_UNIFORM_BUFFER: |
| 6267 | context->bindIndexedUniformBuffer(buffer, index, 0, 0); |
| 6268 | context->bindGenericUniformBuffer(buffer); |
| 6269 | break; |
| 6270 | |
| 6271 | default: |
| 6272 | UNREACHABLE(); |
| 6273 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6274 | } |
| 6275 | } |
| 6276 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6277 | 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] | 6278 | { |
| 6279 | EVENT("(GLuint program = %u, GLsizei count = %d, const GLchar* const* varyings = 0x%0.8p, GLenum bufferMode = 0x%X)", |
| 6280 | program, count, varyings, bufferMode); |
| 6281 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6282 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6283 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6284 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6285 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6286 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6287 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6288 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6289 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6290 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6291 | if (count < 0) |
| 6292 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6293 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6294 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6295 | } |
| 6296 | |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6297 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6298 | switch (bufferMode) |
| 6299 | { |
| 6300 | case GL_INTERLEAVED_ATTRIBS: |
| 6301 | break; |
| 6302 | case GL_SEPARATE_ATTRIBS: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6303 | if (static_cast<GLuint>(count) > caps.maxTransformFeedbackSeparateAttributes) |
Geoff Lang | 48dcae7 | 2014-02-05 16:28:24 -0500 | [diff] [blame] | 6304 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6305 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6306 | return; |
Geoff Lang | 48dcae7 | 2014-02-05 16:28:24 -0500 | [diff] [blame] | 6307 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6308 | break; |
| 6309 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6310 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6311 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6312 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6313 | |
| 6314 | if (!gl::ValidProgram(context, program)) |
| 6315 | { |
| 6316 | return; |
| 6317 | } |
| 6318 | |
| 6319 | gl::Program *programObject = context->getProgram(program); |
| 6320 | ASSERT(programObject); |
| 6321 | |
| 6322 | programObject->setTransformFeedbackVaryings(count, varyings, bufferMode); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6323 | } |
| 6324 | } |
| 6325 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6326 | 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] | 6327 | { |
| 6328 | EVENT("(GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, " |
| 6329 | "GLsizei* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)", |
| 6330 | program, index, bufSize, length, size, type, name); |
| 6331 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6332 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6333 | if (context) |
| 6334 | { |
| 6335 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6336 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6337 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6338 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6339 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6340 | |
| 6341 | if (bufSize < 0) |
| 6342 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6343 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6344 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6345 | } |
| 6346 | |
| 6347 | if (!gl::ValidProgram(context, program)) |
| 6348 | { |
| 6349 | return; |
| 6350 | } |
| 6351 | |
| 6352 | gl::Program *programObject = context->getProgram(program); |
| 6353 | ASSERT(programObject); |
| 6354 | |
| 6355 | if (index >= static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount())) |
| 6356 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6357 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6358 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6359 | } |
| 6360 | |
| 6361 | programObject->getTransformFeedbackVarying(index, bufSize, length, size, type, name); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6362 | } |
| 6363 | } |
| 6364 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6365 | 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] | 6366 | { |
| 6367 | EVENT("(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid* pointer = 0x%0.8p)", |
| 6368 | index, size, type, stride, pointer); |
| 6369 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6370 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6371 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6372 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6373 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6374 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6375 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6376 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6377 | } |
| 6378 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6379 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6380 | { |
| 6381 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6382 | return; |
| 6383 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6384 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6385 | if (size < 1 || size > 4) |
| 6386 | { |
| 6387 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6388 | return; |
| 6389 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6390 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6391 | switch (type) |
| 6392 | { |
| 6393 | case GL_BYTE: |
| 6394 | case GL_UNSIGNED_BYTE: |
| 6395 | case GL_SHORT: |
| 6396 | case GL_UNSIGNED_SHORT: |
| 6397 | case GL_INT: |
| 6398 | case GL_UNSIGNED_INT: |
| 6399 | case GL_INT_2_10_10_10_REV: |
| 6400 | case GL_UNSIGNED_INT_2_10_10_10_REV: |
| 6401 | break; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6402 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6403 | default: |
| 6404 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6405 | return; |
| 6406 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6407 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6408 | if (stride < 0) |
| 6409 | { |
| 6410 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6411 | return; |
| 6412 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6413 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6414 | if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4) |
| 6415 | { |
| 6416 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6417 | return; |
| 6418 | } |
| 6419 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6420 | // [OpenGL ES 3.0.2] Section 2.8 page 24: |
| 6421 | // An INVALID_OPERATION error is generated when a non-zero vertex array object |
| 6422 | // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point, |
| 6423 | // and the pointer argument is not NULL. |
| 6424 | 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] | 6425 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6426 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6427 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 1ab57be | 2013-04-13 03:38:39 +0000 | [diff] [blame] | 6428 | } |
| 6429 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6430 | context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type, false, true, |
| 6431 | stride, pointer); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6432 | } |
| 6433 | } |
| 6434 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6435 | 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] | 6436 | { |
| 6437 | EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 6438 | index, pname, params); |
| 6439 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6440 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6441 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6442 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6443 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6444 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6445 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6446 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6447 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6448 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6449 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6450 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6451 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6452 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6453 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6454 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6455 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6456 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6457 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6458 | { |
| 6459 | return; |
| 6460 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6461 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6462 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 6463 | { |
| 6464 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 6465 | for (int i = 0; i < 4; ++i) |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6466 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6467 | params[i] = currentValueData.IntValues[i]; |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6468 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6469 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6470 | else |
| 6471 | { |
| 6472 | *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname); |
| 6473 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6474 | } |
| 6475 | } |
| 6476 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6477 | 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] | 6478 | { |
| 6479 | EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLuint* params = 0x%0.8p)", |
| 6480 | index, pname, params); |
| 6481 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6482 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6483 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6484 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6485 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6486 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6487 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6488 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6489 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6490 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6491 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6492 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6493 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6494 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6495 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6496 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6497 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6498 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6499 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6500 | { |
| 6501 | return; |
| 6502 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6503 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6504 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 6505 | { |
| 6506 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 6507 | for (int i = 0; i < 4; ++i) |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6508 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6509 | params[i] = currentValueData.UnsignedIntValues[i]; |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6510 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6511 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6512 | else |
| 6513 | { |
| 6514 | *params = gl::QuerySingleVertexAttributeParameter<GLuint>(attribState, pname); |
| 6515 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6516 | } |
| 6517 | } |
| 6518 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6519 | 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] | 6520 | { |
| 6521 | EVENT("(GLuint index = %u, GLint x = %d, GLint y = %d, GLint z = %d, GLint w = %d)", |
| 6522 | index, x, y, z, w); |
| 6523 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6524 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6525 | if (context) |
| 6526 | { |
| 6527 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6528 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6529 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6530 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6531 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6532 | |
| 6533 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6534 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6535 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6536 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6537 | } |
| 6538 | |
| 6539 | GLint vals[4] = { x, y, z, w }; |
| 6540 | context->getState().setVertexAttribi(index, vals); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6541 | } |
| 6542 | } |
| 6543 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6544 | 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] | 6545 | { |
| 6546 | EVENT("(GLuint index = %u, GLuint x = %u, GLuint y = %u, GLuint z = %u, GLuint w = %u)", |
| 6547 | index, x, y, z, w); |
| 6548 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6549 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6550 | if (context) |
| 6551 | { |
| 6552 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6553 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6554 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6555 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6556 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6557 | |
| 6558 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6559 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6560 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6561 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6562 | } |
| 6563 | |
| 6564 | GLuint vals[4] = { x, y, z, w }; |
| 6565 | context->getState().setVertexAttribu(index, vals); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6566 | } |
| 6567 | } |
| 6568 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6569 | 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] | 6570 | { |
| 6571 | EVENT("(GLuint index = %u, const GLint* v = 0x%0.8p)", index, v); |
| 6572 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6573 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6574 | if (context) |
| 6575 | { |
| 6576 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6577 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6578 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6579 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6580 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6581 | |
| 6582 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6583 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6584 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6585 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6586 | } |
| 6587 | |
| 6588 | context->getState().setVertexAttribi(index, v); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6589 | } |
| 6590 | } |
| 6591 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6592 | 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] | 6593 | { |
| 6594 | EVENT("(GLuint index = %u, const GLuint* v = 0x%0.8p)", index, v); |
| 6595 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6596 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6597 | if (context) |
| 6598 | { |
| 6599 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6600 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6601 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6602 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6603 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6604 | |
| 6605 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6606 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6607 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6608 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6609 | } |
| 6610 | |
| 6611 | context->getState().setVertexAttribu(index, v); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6612 | } |
| 6613 | } |
| 6614 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6615 | 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] | 6616 | { |
| 6617 | EVENT("(GLuint program = %u, GLint location = %d, GLuint* params = 0x%0.8p)", |
| 6618 | program, location, params); |
| 6619 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6620 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6621 | if (context) |
| 6622 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 6623 | if (!ValidateGetUniformuiv(context, program, location, params)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6624 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 6625 | return; |
shannon.woods%transgaming.com@gtempaccount.com | e229012 | 2013-04-13 03:41:07 +0000 | [diff] [blame] | 6626 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6627 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 6628 | gl::Program *programObject = context->getProgram(program); |
| 6629 | ASSERT(programObject); |
| 6630 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 6631 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6632 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 6633 | programBinary->getUniformuiv(location, params); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6634 | } |
| 6635 | } |
| 6636 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6637 | 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] | 6638 | { |
| 6639 | EVENT("(GLuint program = %u, const GLchar *name = 0x%0.8p)", |
| 6640 | program, name); |
| 6641 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6642 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6643 | if (context) |
| 6644 | { |
| 6645 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6646 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6647 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6648 | return -1; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6649 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6650 | |
| 6651 | if (program == 0) |
| 6652 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6653 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6654 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6655 | } |
| 6656 | |
| 6657 | gl::Program *programObject = context->getProgram(program); |
| 6658 | |
| 6659 | if (!programObject || !programObject->isLinked()) |
| 6660 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6661 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6662 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6663 | } |
| 6664 | |
| 6665 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 6666 | if (!programBinary) |
| 6667 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6668 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6669 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6670 | } |
| 6671 | |
| 6672 | return programBinary->getFragDataLocation(name); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6673 | } |
| 6674 | |
| 6675 | return 0; |
| 6676 | } |
| 6677 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6678 | void GL_APIENTRY glUniform1ui(GLint location, GLuint v0) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6679 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6680 | glUniform1uiv(location, 1, &v0); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6681 | } |
| 6682 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6683 | 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] | 6684 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6685 | const GLuint xy[] = { v0, v1 }; |
| 6686 | glUniform2uiv(location, 1, xy); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6687 | } |
| 6688 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6689 | 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] | 6690 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6691 | const GLuint xyz[] = { v0, v1, v2 }; |
| 6692 | glUniform3uiv(location, 1, xyz); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6693 | } |
| 6694 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6695 | 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] | 6696 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6697 | const GLuint xyzw[] = { v0, v1, v2, v3 }; |
| 6698 | glUniform4uiv(location, 1, xyzw); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6699 | } |
| 6700 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6701 | 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] | 6702 | { |
| 6703 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6704 | location, count, value); |
| 6705 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6706 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6707 | if (context) |
| 6708 | { |
| 6709 | if (!ValidateUniform(context, GL_UNSIGNED_INT, location, count)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6710 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6711 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6712 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6713 | |
| 6714 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6715 | programBinary->setUniform1uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6716 | } |
| 6717 | } |
| 6718 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6719 | 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] | 6720 | { |
| 6721 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6722 | location, count, value); |
| 6723 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6724 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6725 | if (context) |
| 6726 | { |
| 6727 | 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] | 6728 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6729 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6730 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6731 | |
| 6732 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6733 | programBinary->setUniform2uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6734 | } |
| 6735 | } |
| 6736 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6737 | 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] | 6738 | { |
| 6739 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value)", |
| 6740 | location, count, value); |
| 6741 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6742 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6743 | if (context) |
| 6744 | { |
| 6745 | 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] | 6746 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6747 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6748 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6749 | |
| 6750 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6751 | programBinary->setUniform3uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6752 | } |
| 6753 | } |
| 6754 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6755 | 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] | 6756 | { |
| 6757 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6758 | location, count, value); |
| 6759 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6760 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6761 | if (context) |
| 6762 | { |
| 6763 | 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] | 6764 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6765 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6766 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6767 | |
| 6768 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6769 | programBinary->setUniform4uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6770 | } |
| 6771 | } |
| 6772 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6773 | 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] | 6774 | { |
| 6775 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint* value = 0x%0.8p)", |
| 6776 | buffer, drawbuffer, value); |
| 6777 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6778 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6779 | if (context) |
| 6780 | { |
| 6781 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6782 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6783 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6784 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6785 | |
| 6786 | switch (buffer) |
| 6787 | { |
| 6788 | case GL_COLOR: |
| 6789 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6790 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6791 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6792 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6793 | } |
| 6794 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6795 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6796 | case GL_STENCIL: |
| 6797 | if (drawbuffer != 0) |
| 6798 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6799 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6800 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6801 | } |
| 6802 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6803 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6804 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6805 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6806 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6807 | } |
| 6808 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6809 | gl::Error error = context->clearBufferiv(buffer, drawbuffer, value); |
| 6810 | if (error.isError()) |
| 6811 | { |
| 6812 | context->recordError(error); |
| 6813 | return; |
| 6814 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6815 | } |
| 6816 | } |
| 6817 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6818 | 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] | 6819 | { |
| 6820 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint* value = 0x%0.8p)", |
| 6821 | buffer, drawbuffer, value); |
| 6822 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6823 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6824 | if (context) |
| 6825 | { |
| 6826 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6827 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6828 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6829 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6830 | |
| 6831 | switch (buffer) |
| 6832 | { |
| 6833 | case GL_COLOR: |
| 6834 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6835 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6836 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6837 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6838 | } |
| 6839 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6840 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6841 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6842 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6843 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6844 | } |
| 6845 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6846 | gl::Error error = context->clearBufferuiv(buffer, drawbuffer, value); |
| 6847 | if (error.isError()) |
| 6848 | { |
| 6849 | context->recordError(error); |
| 6850 | return; |
| 6851 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6852 | } |
| 6853 | } |
| 6854 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6855 | 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] | 6856 | { |
| 6857 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat* value = 0x%0.8p)", |
| 6858 | buffer, drawbuffer, value); |
| 6859 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6860 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6861 | if (context) |
| 6862 | { |
| 6863 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6864 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6865 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6866 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6867 | |
| 6868 | switch (buffer) |
| 6869 | { |
| 6870 | case GL_COLOR: |
| 6871 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6872 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6873 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6874 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6875 | } |
| 6876 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6877 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6878 | case GL_DEPTH: |
| 6879 | if (drawbuffer != 0) |
| 6880 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6881 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6882 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6883 | } |
| 6884 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6885 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6886 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6887 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6888 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6889 | } |
| 6890 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6891 | gl::Error error = context->clearBufferfv(buffer, drawbuffer, value); |
| 6892 | if (error.isError()) |
| 6893 | { |
| 6894 | context->recordError(error); |
| 6895 | return; |
| 6896 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6897 | } |
| 6898 | } |
| 6899 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6900 | 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] | 6901 | { |
| 6902 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth, GLint stencil = %d)", |
| 6903 | buffer, drawbuffer, depth, stencil); |
| 6904 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6905 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6906 | if (context) |
| 6907 | { |
| 6908 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6909 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6910 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6911 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6912 | |
| 6913 | switch (buffer) |
| 6914 | { |
| 6915 | case GL_DEPTH_STENCIL: |
| 6916 | if (drawbuffer != 0) |
| 6917 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6918 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6919 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6920 | } |
| 6921 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6922 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6923 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6924 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6925 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6926 | } |
| 6927 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6928 | gl::Error error = context->clearBufferfi(buffer, drawbuffer, depth, stencil); |
| 6929 | if (error.isError()) |
| 6930 | { |
| 6931 | context->recordError(error); |
| 6932 | return; |
| 6933 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6934 | } |
| 6935 | } |
| 6936 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6937 | 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] | 6938 | { |
| 6939 | EVENT("(GLenum name = 0x%X, GLuint index = %u)", name, index); |
| 6940 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6941 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6942 | if (context) |
| 6943 | { |
| 6944 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6945 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6946 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6947 | return NULL; |
shannonwoods@chromium.org | 302df74 | 2013-05-30 00:05:54 +0000 | [diff] [blame] | 6948 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6949 | |
| 6950 | if (name != GL_EXTENSIONS) |
| 6951 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6952 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6953 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6954 | } |
| 6955 | |
| 6956 | if (index >= context->getExtensionStringCount()) |
| 6957 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6958 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6959 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6960 | } |
| 6961 | |
| 6962 | 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] | 6963 | } |
| 6964 | |
| 6965 | return NULL; |
| 6966 | } |
| 6967 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6968 | 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] | 6969 | { |
| 6970 | EVENT("(GLenum readTarget = 0x%X, GLenum writeTarget = 0x%X, GLintptr readOffset = %d, GLintptr writeOffset = %d, GLsizeiptr size = %d)", |
| 6971 | readTarget, writeTarget, readOffset, writeOffset, size); |
| 6972 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6973 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6974 | if (context) |
| 6975 | { |
| 6976 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6977 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6978 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6979 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 296c3f2 | 2013-04-13 03:39:39 +0000 | [diff] [blame] | 6980 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6981 | |
Jamie Madill | 24e8319 | 2014-10-20 11:00:53 -0400 | [diff] [blame] | 6982 | if (!gl::ValidBufferTarget(context, readTarget) || !gl::ValidBufferTarget(context, writeTarget)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6983 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6984 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6985 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6986 | } |
| 6987 | |
| 6988 | gl::Buffer *readBuffer = context->getState().getTargetBuffer(readTarget); |
| 6989 | gl::Buffer *writeBuffer = context->getState().getTargetBuffer(writeTarget); |
| 6990 | |
| 6991 | if (!readBuffer || !writeBuffer) |
| 6992 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6993 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6994 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6995 | } |
| 6996 | |
Jamie Madill | cfaaf72 | 2014-07-31 10:47:54 -0400 | [diff] [blame] | 6997 | // Verify that readBuffer and writeBuffer are not currently mapped |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6998 | if (readBuffer->isMapped() || writeBuffer->isMapped()) |
| 6999 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7000 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7001 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7002 | } |
| 7003 | |
| 7004 | if (readOffset < 0 || writeOffset < 0 || size < 0 || |
| 7005 | static_cast<unsigned int>(readOffset + size) > readBuffer->getSize() || |
| 7006 | static_cast<unsigned int>(writeOffset + size) > writeBuffer->getSize()) |
| 7007 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7008 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7009 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7010 | } |
| 7011 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7012 | if (readBuffer == writeBuffer && std::abs(readOffset - writeOffset) < size) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7013 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7014 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7015 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7016 | } |
| 7017 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7018 | // if size is zero, the copy is a successful no-op |
| 7019 | if (size > 0) |
| 7020 | { |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 7021 | gl::Error error = writeBuffer->copyBufferSubData(readBuffer, readOffset, writeOffset, size); |
| 7022 | if (error.isError()) |
| 7023 | { |
| 7024 | context->recordError(error); |
| 7025 | return; |
| 7026 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7027 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7028 | } |
| 7029 | } |
| 7030 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7031 | 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] | 7032 | { |
| 7033 | EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLchar* const* uniformNames = 0x%0.8p, GLuint* uniformIndices = 0x%0.8p)", |
| 7034 | program, uniformCount, uniformNames, uniformIndices); |
| 7035 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7036 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7037 | if (context) |
| 7038 | { |
| 7039 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7040 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7041 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7042 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7043 | } |
| 7044 | |
| 7045 | if (uniformCount < 0) |
| 7046 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7047 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7048 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7049 | } |
| 7050 | |
| 7051 | gl::Program *programObject = context->getProgram(program); |
| 7052 | |
| 7053 | if (!programObject) |
| 7054 | { |
| 7055 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7056 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7057 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7058 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7059 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7060 | else |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7061 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7062 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7063 | return; |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7064 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7065 | } |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7066 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7067 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7068 | if (!programObject->isLinked() || !programBinary) |
| 7069 | { |
| 7070 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7071 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7072 | uniformIndices[uniformId] = GL_INVALID_INDEX; |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7073 | } |
| 7074 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7075 | else |
| 7076 | { |
| 7077 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 7078 | { |
| 7079 | uniformIndices[uniformId] = programBinary->getUniformIndex(uniformNames[uniformId]); |
| 7080 | } |
| 7081 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7082 | } |
| 7083 | } |
| 7084 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7085 | 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] | 7086 | { |
| 7087 | EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLuint* uniformIndices = 0x%0.8p, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 7088 | program, uniformCount, uniformIndices, pname, params); |
| 7089 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7090 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7091 | if (context) |
| 7092 | { |
| 7093 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7094 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7095 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7096 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7097 | } |
| 7098 | |
| 7099 | if (uniformCount < 0) |
| 7100 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7101 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7102 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7103 | } |
| 7104 | |
| 7105 | gl::Program *programObject = context->getProgram(program); |
| 7106 | |
| 7107 | if (!programObject) |
| 7108 | { |
| 7109 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7110 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7111 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7112 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7113 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7114 | else |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 7115 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7116 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7117 | return; |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 7118 | } |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 7119 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7120 | |
| 7121 | switch (pname) |
| 7122 | { |
| 7123 | case GL_UNIFORM_TYPE: |
| 7124 | case GL_UNIFORM_SIZE: |
| 7125 | case GL_UNIFORM_NAME_LENGTH: |
| 7126 | case GL_UNIFORM_BLOCK_INDEX: |
| 7127 | case GL_UNIFORM_OFFSET: |
| 7128 | case GL_UNIFORM_ARRAY_STRIDE: |
| 7129 | case GL_UNIFORM_MATRIX_STRIDE: |
| 7130 | case GL_UNIFORM_IS_ROW_MAJOR: |
| 7131 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7132 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7133 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7134 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7135 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7136 | } |
| 7137 | |
| 7138 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7139 | |
| 7140 | if (!programBinary && uniformCount > 0) |
| 7141 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7142 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7143 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7144 | } |
| 7145 | |
| 7146 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 7147 | { |
| 7148 | const GLuint index = uniformIndices[uniformId]; |
| 7149 | |
| 7150 | if (index >= (GLuint)programBinary->getActiveUniformCount()) |
| 7151 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7152 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7153 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7154 | } |
| 7155 | } |
| 7156 | |
| 7157 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 7158 | { |
| 7159 | const GLuint index = uniformIndices[uniformId]; |
| 7160 | params[uniformId] = programBinary->getActiveUniformi(index, pname); |
| 7161 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7162 | } |
| 7163 | } |
| 7164 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7165 | 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] | 7166 | { |
| 7167 | EVENT("(GLuint program = %u, const GLchar* uniformBlockName = 0x%0.8p)", program, uniformBlockName); |
| 7168 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7169 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7170 | if (context) |
| 7171 | { |
| 7172 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7173 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7174 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7175 | return GL_INVALID_INDEX; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7176 | } |
| 7177 | |
| 7178 | gl::Program *programObject = context->getProgram(program); |
| 7179 | |
| 7180 | if (!programObject) |
| 7181 | { |
| 7182 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7183 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7184 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7185 | return GL_INVALID_INDEX; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7186 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7187 | else |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 7188 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7189 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7190 | return GL_INVALID_INDEX; |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 7191 | } |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 7192 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7193 | |
| 7194 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7195 | if (!programBinary) |
| 7196 | { |
| 7197 | return GL_INVALID_INDEX; |
| 7198 | } |
| 7199 | |
| 7200 | return programBinary->getUniformBlockIndex(uniformBlockName); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7201 | } |
| 7202 | |
| 7203 | return 0; |
| 7204 | } |
| 7205 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7206 | 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] | 7207 | { |
| 7208 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 7209 | program, uniformBlockIndex, pname, params); |
| 7210 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7211 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7212 | if (context) |
| 7213 | { |
| 7214 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7215 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7216 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7217 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7218 | } |
| 7219 | gl::Program *programObject = context->getProgram(program); |
| 7220 | |
| 7221 | if (!programObject) |
| 7222 | { |
| 7223 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7224 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7225 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7226 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7227 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7228 | else |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 7229 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7230 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7231 | return; |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 7232 | } |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 7233 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7234 | |
| 7235 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7236 | |
| 7237 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 7238 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7239 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7240 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7241 | } |
| 7242 | |
| 7243 | switch (pname) |
| 7244 | { |
| 7245 | case GL_UNIFORM_BLOCK_BINDING: |
| 7246 | *params = static_cast<GLint>(programObject->getUniformBlockBinding(uniformBlockIndex)); |
| 7247 | break; |
| 7248 | |
| 7249 | case GL_UNIFORM_BLOCK_DATA_SIZE: |
| 7250 | case GL_UNIFORM_BLOCK_NAME_LENGTH: |
| 7251 | case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS: |
| 7252 | case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: |
| 7253 | case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: |
| 7254 | case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: |
| 7255 | programBinary->getActiveUniformBlockiv(uniformBlockIndex, pname, params); |
| 7256 | break; |
| 7257 | |
| 7258 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7259 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7260 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7261 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7262 | } |
| 7263 | } |
| 7264 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7265 | 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] | 7266 | { |
| 7267 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLchar* uniformBlockName = 0x%0.8p)", |
| 7268 | program, uniformBlockIndex, bufSize, length, uniformBlockName); |
| 7269 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7270 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7271 | if (context) |
| 7272 | { |
| 7273 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7274 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7275 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7276 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7277 | } |
| 7278 | |
| 7279 | gl::Program *programObject = context->getProgram(program); |
| 7280 | |
| 7281 | if (!programObject) |
| 7282 | { |
| 7283 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7284 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7285 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7286 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7287 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7288 | else |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 7289 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7290 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7291 | return; |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 7292 | } |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 7293 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7294 | |
| 7295 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7296 | |
| 7297 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 7298 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7299 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7300 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7301 | } |
| 7302 | |
| 7303 | programBinary->getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7304 | } |
| 7305 | } |
| 7306 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7307 | 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] | 7308 | { |
| 7309 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLuint uniformBlockBinding = %u)", |
| 7310 | program, uniformBlockIndex, uniformBlockBinding); |
| 7311 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7312 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7313 | if (context) |
| 7314 | { |
| 7315 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7316 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7317 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7318 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7319 | } |
| 7320 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7321 | if (uniformBlockBinding >= context->getCaps().maxUniformBufferBindings) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7322 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7323 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7324 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7325 | } |
| 7326 | |
| 7327 | gl::Program *programObject = context->getProgram(program); |
| 7328 | |
| 7329 | if (!programObject) |
| 7330 | { |
| 7331 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7332 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7333 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7334 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7335 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7336 | else |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 7337 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7338 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7339 | return; |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 7340 | } |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 7341 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7342 | |
| 7343 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7344 | |
| 7345 | // if never linked, there won't be any uniform blocks |
| 7346 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 7347 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7348 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7349 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7350 | } |
| 7351 | |
| 7352 | programObject->bindUniformBlock(uniformBlockIndex, uniformBlockBinding); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7353 | } |
| 7354 | } |
| 7355 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7356 | 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] | 7357 | { |
| 7358 | EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei instanceCount = %d)", |
| 7359 | mode, first, count, instanceCount); |
| 7360 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7361 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7362 | if (context) |
| 7363 | { |
| 7364 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7365 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7366 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7367 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7368 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7369 | |
| 7370 | // glDrawArraysInstanced |
| 7371 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7372 | } |
| 7373 | } |
| 7374 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7375 | 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] | 7376 | { |
| 7377 | EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei instanceCount = %d)", |
| 7378 | mode, count, type, indices, instanceCount); |
| 7379 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7380 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7381 | if (context) |
| 7382 | { |
| 7383 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7384 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7385 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7386 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7387 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7388 | |
| 7389 | // glDrawElementsInstanced |
| 7390 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7391 | } |
| 7392 | } |
| 7393 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7394 | GLsync GL_APIENTRY glFenceSync(GLenum condition, GLbitfield flags) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7395 | { |
| 7396 | EVENT("(GLenum condition = 0x%X, GLbitfield flags = 0x%X)", condition, flags); |
| 7397 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7398 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7399 | if (context) |
| 7400 | { |
| 7401 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7402 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7403 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7404 | return 0; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7405 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7406 | |
| 7407 | if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) |
| 7408 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7409 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7410 | return 0; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7411 | } |
| 7412 | |
| 7413 | if (flags != 0) |
| 7414 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7415 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7416 | return 0; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7417 | } |
| 7418 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7419 | GLsync fenceSync = context->createFenceSync(); |
| 7420 | |
| 7421 | gl::FenceSync *fenceSyncObject = context->getFenceSync(fenceSync); |
| 7422 | gl::Error error = fenceSyncObject->set(condition); |
| 7423 | if (error.isError()) |
| 7424 | { |
| 7425 | context->deleteFenceSync(fenceSync); |
| 7426 | context->recordError(error); |
| 7427 | return NULL; |
| 7428 | } |
| 7429 | |
| 7430 | return fenceSync; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7431 | } |
| 7432 | |
| 7433 | return NULL; |
| 7434 | } |
| 7435 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7436 | GLboolean GL_APIENTRY glIsSync(GLsync sync) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7437 | { |
| 7438 | EVENT("(GLsync sync = 0x%0.8p)", sync); |
| 7439 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7440 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7441 | if (context) |
| 7442 | { |
| 7443 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7444 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7445 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7446 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7447 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7448 | |
| 7449 | return (context->getFenceSync(sync) != NULL); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7450 | } |
| 7451 | |
| 7452 | return GL_FALSE; |
| 7453 | } |
| 7454 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7455 | void GL_APIENTRY glDeleteSync(GLsync sync) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7456 | { |
| 7457 | EVENT("(GLsync sync = 0x%0.8p)", sync); |
| 7458 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7459 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7460 | if (context) |
| 7461 | { |
| 7462 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7463 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7464 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7465 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7466 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7467 | |
| 7468 | if (sync != static_cast<GLsync>(0) && !context->getFenceSync(sync)) |
| 7469 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7470 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7471 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7472 | } |
| 7473 | |
| 7474 | context->deleteFenceSync(sync); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7475 | } |
| 7476 | } |
| 7477 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7478 | 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] | 7479 | { |
| 7480 | EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", |
| 7481 | sync, flags, timeout); |
| 7482 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7483 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7484 | if (context) |
| 7485 | { |
| 7486 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7487 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7488 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7489 | return GL_WAIT_FAILED; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7490 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7491 | |
| 7492 | if ((flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0) |
| 7493 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7494 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7495 | return GL_WAIT_FAILED; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7496 | } |
| 7497 | |
| 7498 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7499 | |
| 7500 | if (!fenceSync) |
| 7501 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7502 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7503 | return GL_WAIT_FAILED; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7504 | } |
| 7505 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7506 | GLenum result = GL_WAIT_FAILED; |
| 7507 | gl::Error error = fenceSync->clientWait(flags, timeout, &result); |
| 7508 | if (error.isError()) |
| 7509 | { |
| 7510 | context->recordError(error); |
| 7511 | return GL_WAIT_FAILED; |
| 7512 | } |
| 7513 | |
| 7514 | return result; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7515 | } |
| 7516 | |
| 7517 | return GL_FALSE; |
| 7518 | } |
| 7519 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7520 | 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] | 7521 | { |
| 7522 | EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", |
| 7523 | sync, flags, timeout); |
| 7524 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7525 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7526 | if (context) |
| 7527 | { |
| 7528 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7529 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7530 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7531 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7532 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7533 | |
| 7534 | if (flags != 0) |
| 7535 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7536 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7537 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7538 | } |
| 7539 | |
| 7540 | if (timeout != GL_TIMEOUT_IGNORED) |
| 7541 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7542 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7543 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7544 | } |
| 7545 | |
| 7546 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7547 | |
| 7548 | if (!fenceSync) |
| 7549 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7550 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7551 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7552 | } |
| 7553 | |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 7554 | gl::Error error = fenceSync->serverWait(flags, timeout); |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7555 | if (error.isError()) |
| 7556 | { |
| 7557 | context->recordError(error); |
| 7558 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7559 | } |
| 7560 | } |
| 7561 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7562 | void GL_APIENTRY glGetInteger64v(GLenum pname, GLint64* params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7563 | { |
| 7564 | EVENT("(GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", |
| 7565 | pname, params); |
| 7566 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7567 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7568 | if (context) |
| 7569 | { |
| 7570 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7571 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7572 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7573 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7574 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7575 | |
| 7576 | GLenum nativeType; |
| 7577 | unsigned int numParams = 0; |
| 7578 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
| 7579 | { |
| 7580 | return; |
| 7581 | } |
| 7582 | |
| 7583 | if (nativeType == GL_INT_64_ANGLEX) |
| 7584 | { |
| 7585 | context->getInteger64v(pname, params); |
| 7586 | } |
| 7587 | else |
| 7588 | { |
| 7589 | CastStateValues(context, nativeType, pname, numParams, params); |
| 7590 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7591 | } |
| 7592 | } |
| 7593 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7594 | 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] | 7595 | { |
| 7596 | EVENT("(GLsync sync = 0x%0.8p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLint* values = 0x%0.8p)", |
| 7597 | sync, pname, bufSize, length, values); |
| 7598 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7599 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7600 | if (context) |
| 7601 | { |
| 7602 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7603 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7604 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7605 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7606 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7607 | |
| 7608 | if (bufSize < 0) |
| 7609 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7610 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7611 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7612 | } |
| 7613 | |
| 7614 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7615 | |
| 7616 | if (!fenceSync) |
| 7617 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7618 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7619 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7620 | } |
| 7621 | |
| 7622 | switch (pname) |
| 7623 | { |
| 7624 | 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] | 7625 | case GL_SYNC_CONDITION: values[0] = static_cast<GLint>(fenceSync->getCondition()); break; |
| 7626 | case GL_SYNC_FLAGS: values[0] = 0; break; |
| 7627 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7628 | case GL_SYNC_STATUS: |
| 7629 | { |
| 7630 | gl::Error error = fenceSync->getStatus(values); |
| 7631 | if (error.isError()) |
| 7632 | { |
| 7633 | context->recordError(error); |
| 7634 | return; |
| 7635 | } |
| 7636 | break; |
| 7637 | } |
| 7638 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7639 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7640 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7641 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7642 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7643 | } |
| 7644 | } |
| 7645 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7646 | 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] | 7647 | { |
| 7648 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint64* data = 0x%0.8p)", |
| 7649 | target, index, data); |
| 7650 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7651 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7652 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7653 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7654 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7655 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7656 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7657 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7658 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7659 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7660 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7661 | switch (target) |
| 7662 | { |
| 7663 | case GL_TRANSFORM_FEEDBACK_BUFFER_START: |
| 7664 | case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: |
| 7665 | case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 7666 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
| 7667 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7668 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7669 | return; |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 7670 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7671 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7672 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7673 | case GL_UNIFORM_BUFFER_START: |
| 7674 | case GL_UNIFORM_BUFFER_SIZE: |
| 7675 | case GL_UNIFORM_BUFFER_BINDING: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7676 | if (index >= caps.maxUniformBufferBindings) |
| 7677 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7678 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7679 | return; |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7680 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7681 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7682 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7683 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7684 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7685 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7686 | } |
| 7687 | |
| 7688 | if (!(context->getIndexedInteger64v(target, index, data))) |
| 7689 | { |
| 7690 | GLenum nativeType; |
| 7691 | unsigned int numParams = 0; |
| 7692 | if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams)) |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7693 | { |
| 7694 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7695 | return; |
| 7696 | } |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7697 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7698 | if (numParams == 0) |
| 7699 | return; // it is known that pname is valid, but there are no parameters to return |
| 7700 | |
| 7701 | if (nativeType == GL_INT) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7702 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7703 | GLint *intParams = new GLint[numParams]; |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7704 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7705 | context->getIndexedIntegerv(target, index, intParams); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7706 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7707 | for (unsigned int i = 0; i < numParams; ++i) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7708 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7709 | data[i] = static_cast<GLint64>(intParams[i]); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7710 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7711 | |
| 7712 | delete [] intParams; |
| 7713 | } |
| 7714 | else |
| 7715 | { |
| 7716 | UNREACHABLE(); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7717 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7718 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7719 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7720 | } |
| 7721 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7722 | 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] | 7723 | { |
| 7724 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", |
| 7725 | target, pname, params); |
| 7726 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7727 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7728 | if (context) |
| 7729 | { |
| 7730 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7731 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7732 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7733 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7734 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7735 | |
| 7736 | if (!gl::ValidBufferTarget(context, target)) |
| 7737 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7738 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7739 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7740 | } |
| 7741 | |
| 7742 | if (!gl::ValidBufferParameter(context, pname)) |
| 7743 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7744 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7745 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7746 | } |
| 7747 | |
| 7748 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 7749 | |
| 7750 | if (!buffer) |
| 7751 | { |
| 7752 | // 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] | 7753 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7754 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7755 | } |
| 7756 | |
| 7757 | switch (pname) |
| 7758 | { |
| 7759 | case GL_BUFFER_USAGE: |
| 7760 | *params = static_cast<GLint64>(buffer->getUsage()); |
| 7761 | break; |
| 7762 | case GL_BUFFER_SIZE: |
| 7763 | *params = buffer->getSize(); |
| 7764 | break; |
| 7765 | case GL_BUFFER_ACCESS_FLAGS: |
| 7766 | *params = static_cast<GLint64>(buffer->getAccessFlags()); |
| 7767 | break; |
| 7768 | case GL_BUFFER_MAPPED: |
| 7769 | *params = static_cast<GLint64>(buffer->isMapped()); |
| 7770 | break; |
| 7771 | case GL_BUFFER_MAP_OFFSET: |
| 7772 | *params = buffer->getMapOffset(); |
| 7773 | break; |
| 7774 | case GL_BUFFER_MAP_LENGTH: |
| 7775 | *params = buffer->getMapLength(); |
| 7776 | break; |
| 7777 | default: UNREACHABLE(); break; |
| 7778 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7779 | } |
| 7780 | } |
| 7781 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7782 | void GL_APIENTRY glGenSamplers(GLsizei count, GLuint* samplers) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7783 | { |
| 7784 | EVENT("(GLsizei count = %d, GLuint* samplers = 0x%0.8p)", count, samplers); |
| 7785 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7786 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7787 | if (context) |
| 7788 | { |
| 7789 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7790 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7791 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7792 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7793 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7794 | |
| 7795 | if (count < 0) |
| 7796 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7797 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7798 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7799 | } |
| 7800 | |
| 7801 | for (int i = 0; i < count; i++) |
| 7802 | { |
| 7803 | samplers[i] = context->createSampler(); |
| 7804 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7805 | } |
| 7806 | } |
| 7807 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7808 | 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] | 7809 | { |
| 7810 | EVENT("(GLsizei count = %d, const GLuint* samplers = 0x%0.8p)", count, samplers); |
| 7811 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7812 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7813 | if (context) |
| 7814 | { |
| 7815 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7816 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7817 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7818 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7819 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7820 | |
| 7821 | if (count < 0) |
| 7822 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7823 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7824 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7825 | } |
| 7826 | |
| 7827 | for (int i = 0; i < count; i++) |
| 7828 | { |
| 7829 | context->deleteSampler(samplers[i]); |
| 7830 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7831 | } |
| 7832 | } |
| 7833 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7834 | GLboolean GL_APIENTRY glIsSampler(GLuint sampler) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7835 | { |
| 7836 | EVENT("(GLuint sampler = %u)", sampler); |
| 7837 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7838 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7839 | if (context) |
| 7840 | { |
| 7841 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7842 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7843 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7844 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7845 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7846 | |
| 7847 | return context->isSampler(sampler); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7848 | } |
| 7849 | |
| 7850 | return GL_FALSE; |
| 7851 | } |
| 7852 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7853 | void GL_APIENTRY glBindSampler(GLuint unit, GLuint sampler) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7854 | { |
| 7855 | EVENT("(GLuint unit = %u, GLuint sampler = %u)", unit, sampler); |
| 7856 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7857 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7858 | if (context) |
| 7859 | { |
| 7860 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7861 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7862 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7863 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7864 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7865 | |
| 7866 | if (sampler != 0 && !context->isSampler(sampler)) |
| 7867 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7868 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7869 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7870 | } |
| 7871 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7872 | if (unit >= context->getCaps().maxCombinedTextureImageUnits) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7873 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7874 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7875 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7876 | } |
| 7877 | |
| 7878 | context->bindSampler(unit, sampler); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7879 | } |
| 7880 | } |
| 7881 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7882 | 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] | 7883 | { |
| 7884 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint param = %d)", sampler, pname, param); |
| 7885 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7886 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7887 | if (context) |
| 7888 | { |
| 7889 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7890 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7891 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7892 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7893 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7894 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7895 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7896 | { |
| 7897 | return; |
| 7898 | } |
| 7899 | |
| 7900 | if (!gl::ValidateTexParamParameters(context, pname, param)) |
| 7901 | { |
| 7902 | return; |
| 7903 | } |
| 7904 | |
| 7905 | if (!context->isSampler(sampler)) |
| 7906 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7907 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7908 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7909 | } |
| 7910 | |
| 7911 | context->samplerParameteri(sampler, pname, param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7912 | } |
| 7913 | } |
| 7914 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7915 | 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] | 7916 | { |
Jamie Madill | f6cc8cc | 2013-07-03 12:44:15 -0400 | [diff] [blame] | 7917 | glSamplerParameteri(sampler, pname, *param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7918 | } |
| 7919 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7920 | 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] | 7921 | { |
| 7922 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat param = %g)", sampler, pname, param); |
| 7923 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7924 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7925 | if (context) |
| 7926 | { |
| 7927 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7928 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7929 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7930 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7931 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7932 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7933 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7934 | { |
| 7935 | return; |
| 7936 | } |
| 7937 | |
| 7938 | if (!gl::ValidateTexParamParameters(context, pname, static_cast<GLint>(param))) |
| 7939 | { |
| 7940 | return; |
| 7941 | } |
| 7942 | |
| 7943 | if (!context->isSampler(sampler)) |
| 7944 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7945 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7946 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7947 | } |
| 7948 | |
| 7949 | context->samplerParameterf(sampler, pname, param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7950 | } |
| 7951 | } |
| 7952 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7953 | 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] | 7954 | { |
Jamie Madill | f6cc8cc | 2013-07-03 12:44:15 -0400 | [diff] [blame] | 7955 | glSamplerParameterf(sampler, pname, *param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7956 | } |
| 7957 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7958 | 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] | 7959 | { |
| 7960 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", sampler, pname, params); |
| 7961 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7962 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7963 | if (context) |
| 7964 | { |
| 7965 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7966 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7967 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7968 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7969 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7970 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7971 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7972 | { |
| 7973 | return; |
| 7974 | } |
| 7975 | |
| 7976 | if (!context->isSampler(sampler)) |
| 7977 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7978 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7979 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7980 | } |
| 7981 | |
| 7982 | *params = context->getSamplerParameteri(sampler, pname); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7983 | } |
| 7984 | } |
| 7985 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7986 | 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] | 7987 | { |
| 7988 | EVENT("(GLuint sample = %ur, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", sampler, pname, params); |
| 7989 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7990 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7991 | if (context) |
| 7992 | { |
| 7993 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7994 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7995 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7996 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7997 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7998 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7999 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8000 | { |
| 8001 | return; |
| 8002 | } |
| 8003 | |
| 8004 | if (!context->isSampler(sampler)) |
| 8005 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8006 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8007 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8008 | } |
| 8009 | |
| 8010 | *params = context->getSamplerParameterf(sampler, pname); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8011 | } |
| 8012 | } |
| 8013 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8014 | void GL_APIENTRY glVertexAttribDivisor(GLuint index, GLuint divisor) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8015 | { |
| 8016 | EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor); |
| 8017 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8018 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8019 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8020 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8021 | if (context->getClientVersion() < 3) |
| 8022 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8023 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8024 | return; |
| 8025 | } |
| 8026 | |
| 8027 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 8028 | { |
| 8029 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8030 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8031 | } |
| 8032 | |
| 8033 | context->setVertexAttribDivisor(index, divisor); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8034 | } |
| 8035 | } |
| 8036 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8037 | void GL_APIENTRY glBindTransformFeedback(GLenum target, GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8038 | { |
| 8039 | EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id); |
| 8040 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8041 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8042 | if (context) |
| 8043 | { |
| 8044 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8045 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8046 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8047 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8048 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8049 | |
| 8050 | switch (target) |
| 8051 | { |
| 8052 | case GL_TRANSFORM_FEEDBACK: |
| 8053 | { |
| 8054 | // Cannot bind a transform feedback object if the current one is started and not paused (3.0.2 pg 85 section 2.14.1) |
| 8055 | gl::TransformFeedback *curTransformFeedback = context->getState().getCurrentTransformFeedback(); |
| 8056 | if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused()) |
| 8057 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8058 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8059 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8060 | } |
| 8061 | |
| 8062 | // Cannot bind a transform feedback object that does not exist (3.0.2 pg 85 section 2.14.1) |
| 8063 | if (context->getTransformFeedback(id) == NULL) |
| 8064 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8065 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8066 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8067 | } |
| 8068 | |
| 8069 | context->bindTransformFeedback(id); |
| 8070 | } |
| 8071 | break; |
| 8072 | |
| 8073 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8074 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8075 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8076 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8077 | } |
| 8078 | } |
| 8079 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8080 | 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] | 8081 | { |
| 8082 | EVENT("(GLsizei n = %d, const GLuint* ids = 0x%0.8p)", n, ids); |
| 8083 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8084 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8085 | if (context) |
| 8086 | { |
| 8087 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8088 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8089 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8090 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8091 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8092 | |
| 8093 | for (int i = 0; i < n; i++) |
| 8094 | { |
| 8095 | context->deleteTransformFeedback(ids[i]); |
| 8096 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8097 | } |
| 8098 | } |
| 8099 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8100 | void GL_APIENTRY glGenTransformFeedbacks(GLsizei n, GLuint* ids) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8101 | { |
| 8102 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 8103 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8104 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8105 | if (context) |
| 8106 | { |
| 8107 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8108 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8109 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8110 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8111 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8112 | |
| 8113 | for (int i = 0; i < n; i++) |
| 8114 | { |
| 8115 | ids[i] = context->createTransformFeedback(); |
| 8116 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8117 | } |
| 8118 | } |
| 8119 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8120 | GLboolean GL_APIENTRY glIsTransformFeedback(GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8121 | { |
| 8122 | EVENT("(GLuint id = %u)", id); |
| 8123 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8124 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8125 | if (context) |
| 8126 | { |
| 8127 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8128 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8129 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8130 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8131 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8132 | |
| 8133 | 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] | 8134 | } |
| 8135 | |
| 8136 | return GL_FALSE; |
| 8137 | } |
| 8138 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8139 | void GL_APIENTRY glPauseTransformFeedback(void) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8140 | { |
| 8141 | EVENT("(void)"); |
| 8142 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8143 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8144 | if (context) |
| 8145 | { |
| 8146 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8147 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8148 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8149 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8150 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8151 | |
| 8152 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 8153 | ASSERT(transformFeedback != NULL); |
| 8154 | |
| 8155 | // Current transform feedback must be started and not paused in order to pause (3.0.2 pg 86) |
| 8156 | if (!transformFeedback->isStarted() || transformFeedback->isPaused()) |
| 8157 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8158 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8159 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8160 | } |
| 8161 | |
| 8162 | transformFeedback->pause(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8163 | } |
| 8164 | } |
| 8165 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8166 | void GL_APIENTRY glResumeTransformFeedback(void) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8167 | { |
| 8168 | EVENT("(void)"); |
| 8169 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8170 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8171 | if (context) |
| 8172 | { |
| 8173 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8174 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8175 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8176 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8177 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8178 | |
| 8179 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 8180 | ASSERT(transformFeedback != NULL); |
| 8181 | |
| 8182 | // Current transform feedback must be started and paused in order to resume (3.0.2 pg 86) |
| 8183 | if (!transformFeedback->isStarted() || !transformFeedback->isPaused()) |
| 8184 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8185 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8186 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8187 | } |
| 8188 | |
| 8189 | transformFeedback->resume(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8190 | } |
| 8191 | } |
| 8192 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8193 | 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] | 8194 | { |
| 8195 | EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLenum* binaryFormat = 0x%0.8p, GLvoid* binary = 0x%0.8p)", |
| 8196 | program, bufSize, length, binaryFormat, binary); |
| 8197 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8198 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8199 | if (context) |
| 8200 | { |
| 8201 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8202 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8203 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8204 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8205 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8206 | |
| 8207 | // glGetProgramBinary |
| 8208 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8209 | } |
| 8210 | } |
| 8211 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8212 | 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] | 8213 | { |
| 8214 | EVENT("(GLuint program = %u, GLenum binaryFormat = 0x%X, const GLvoid* binary = 0x%0.8p, GLsizei length = %d)", |
| 8215 | program, binaryFormat, binary, length); |
| 8216 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8217 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8218 | if (context) |
| 8219 | { |
| 8220 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8221 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8222 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8223 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8224 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8225 | |
| 8226 | // glProgramBinary |
| 8227 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8228 | } |
| 8229 | } |
| 8230 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8231 | 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] | 8232 | { |
| 8233 | EVENT("(GLuint program = %u, GLenum pname = 0x%X, GLint value = %d)", |
| 8234 | program, pname, value); |
| 8235 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8236 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8237 | if (context) |
| 8238 | { |
| 8239 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8240 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8241 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8242 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8243 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8244 | |
| 8245 | // glProgramParameteri |
| 8246 | UNIMPLEMENTED(); |
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 glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments) |
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)", |
| 8253 | target, numAttachments, attachments); |
| 8254 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8255 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8256 | if (context) |
| 8257 | { |
| 8258 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8259 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8260 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8261 | return; |
shannonwoods@chromium.org | d63ef89 | 2013-05-30 00:10:56 +0000 | [diff] [blame] | 8262 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8263 | |
| 8264 | if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments)) |
| 8265 | { |
| 8266 | return; |
| 8267 | } |
| 8268 | |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8269 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 8270 | ASSERT(framebuffer); |
| 8271 | |
| 8272 | if (framebuffer->completeness(context->getData()) == GL_FRAMEBUFFER_COMPLETE) |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8273 | { |
Geoff Lang | 64f23f6 | 2014-09-10 14:40:12 -0400 | [diff] [blame] | 8274 | gl::Error error = framebuffer->invalidate(context->getCaps(), numAttachments, attachments); |
| 8275 | if (error.isError()) |
| 8276 | { |
| 8277 | context->recordError(error); |
| 8278 | return; |
| 8279 | } |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8280 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8281 | } |
| 8282 | } |
| 8283 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8284 | 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] | 8285 | { |
| 8286 | EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p, GLint x = %d, " |
| 8287 | "GLint y = %d, GLsizei width = %d, GLsizei height = %d)", |
| 8288 | target, numAttachments, attachments, x, y, 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 | d63ef89 | 2013-05-30 00:10:56 +0000 | [diff] [blame] | 8297 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8298 | |
| 8299 | if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments)) |
| 8300 | { |
| 8301 | return; |
| 8302 | } |
| 8303 | |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8304 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 8305 | ASSERT(framebuffer); |
| 8306 | |
| 8307 | if (framebuffer->completeness(context->getData()) == GL_FRAMEBUFFER_COMPLETE) |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8308 | { |
Geoff Lang | 64f23f6 | 2014-09-10 14:40:12 -0400 | [diff] [blame] | 8309 | gl::Error error = framebuffer->invalidateSub(numAttachments, attachments, x, y, width, height); |
| 8310 | if (error.isError()) |
| 8311 | { |
| 8312 | context->recordError(error); |
| 8313 | return; |
| 8314 | } |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8315 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8316 | } |
| 8317 | } |
| 8318 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8319 | 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] | 8320 | { |
| 8321 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 8322 | target, levels, internalformat, width, height); |
| 8323 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8324 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8325 | if (context) |
| 8326 | { |
| 8327 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8328 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8329 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8330 | return; |
shannonwoods@chromium.org | 8757c06 | 2013-05-30 00:14:24 +0000 | [diff] [blame] | 8331 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8332 | |
| 8333 | if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1)) |
| 8334 | { |
| 8335 | return; |
| 8336 | } |
| 8337 | |
| 8338 | switch (target) |
| 8339 | { |
| 8340 | case GL_TEXTURE_2D: |
| 8341 | { |
| 8342 | gl::Texture2D *texture2d = context->getTexture2D(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8343 | gl::Error error = texture2d->storage(levels, internalformat, width, height); |
| 8344 | if (error.isError()) |
| 8345 | { |
| 8346 | context->recordError(error); |
| 8347 | return; |
| 8348 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8349 | } |
| 8350 | break; |
| 8351 | |
| 8352 | case GL_TEXTURE_CUBE_MAP: |
| 8353 | { |
| 8354 | gl::TextureCubeMap *textureCube = context->getTextureCubeMap(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8355 | gl::Error error = textureCube->storage(levels, internalformat, width); |
| 8356 | if (error.isError()) |
| 8357 | { |
| 8358 | context->recordError(error); |
| 8359 | return; |
| 8360 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8361 | } |
| 8362 | break; |
| 8363 | |
| 8364 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8365 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8366 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8367 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8368 | } |
| 8369 | } |
| 8370 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8371 | 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] | 8372 | { |
| 8373 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " |
| 8374 | "GLsizei height = %d, GLsizei depth = %d)", |
| 8375 | target, levels, internalformat, width, height, depth); |
| 8376 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8377 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8378 | if (context) |
| 8379 | { |
| 8380 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8381 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8382 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8383 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 14eb55e | 2013-04-13 03:35:06 +0000 | [diff] [blame] | 8384 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8385 | |
| 8386 | if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, depth)) |
| 8387 | { |
| 8388 | return; |
| 8389 | } |
| 8390 | |
| 8391 | switch (target) |
| 8392 | { |
| 8393 | case GL_TEXTURE_3D: |
| 8394 | { |
| 8395 | gl::Texture3D *texture3d = context->getTexture3D(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8396 | gl::Error error = texture3d->storage(levels, internalformat, width, height, depth); |
| 8397 | if (error.isError()) |
| 8398 | { |
| 8399 | context->recordError(error); |
| 8400 | return; |
| 8401 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8402 | } |
| 8403 | break; |
| 8404 | |
| 8405 | case GL_TEXTURE_2D_ARRAY: |
| 8406 | { |
| 8407 | gl::Texture2DArray *texture2darray = context->getTexture2DArray(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8408 | gl::Error error = texture2darray->storage(levels, internalformat, width, height, depth); |
| 8409 | if (error.isError()) |
| 8410 | { |
| 8411 | context->recordError(error); |
| 8412 | return; |
| 8413 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8414 | } |
| 8415 | break; |
| 8416 | |
| 8417 | default: |
| 8418 | UNREACHABLE(); |
| 8419 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8420 | } |
| 8421 | } |
| 8422 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8423 | 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] | 8424 | { |
| 8425 | EVENT("(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, " |
| 8426 | "GLint* params = 0x%0.8p)", |
| 8427 | target, internalformat, pname, bufSize, params); |
| 8428 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8429 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8430 | if (context) |
| 8431 | { |
| 8432 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8433 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8434 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8435 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8436 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8437 | |
| 8438 | const gl::TextureCaps &formatCaps = context->getTextureCaps().get(internalformat); |
| 8439 | if (!formatCaps.renderable) |
| 8440 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8441 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8442 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8443 | } |
| 8444 | |
| 8445 | if (target != GL_RENDERBUFFER) |
| 8446 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8447 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8448 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8449 | } |
| 8450 | |
| 8451 | if (bufSize < 0) |
| 8452 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8453 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8454 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8455 | } |
| 8456 | |
| 8457 | switch (pname) |
| 8458 | { |
| 8459 | case GL_NUM_SAMPLE_COUNTS: |
| 8460 | if (bufSize != 0) |
Geoff Lang | 5f4c463 | 2014-07-03 13:46:52 -0400 | [diff] [blame] | 8461 | { |
| 8462 | *params = formatCaps.sampleCounts.size(); |
| 8463 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8464 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8465 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8466 | case GL_SAMPLES: |
Geoff Lang | 5f4c463 | 2014-07-03 13:46:52 -0400 | [diff] [blame] | 8467 | 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] | 8468 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8469 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8470 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8471 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8472 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8473 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8474 | } |
| 8475 | } |
| 8476 | |
| 8477 | // Extension functions |
| 8478 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8479 | 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] | 8480 | GLbitfield mask, GLenum filter) |
| 8481 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 8482 | 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] | 8483 | "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, " |
| 8484 | "GLbitfield mask = 0x%X, GLenum filter = 0x%X)", |
| 8485 | srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 8486 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8487 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8488 | if (context) |
| 8489 | { |
| 8490 | if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, |
| 8491 | dstX0, dstY0, dstX1, dstY1, mask, filter, |
| 8492 | true)) |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8493 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8494 | return; |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8495 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8496 | |
Geoff Lang | 6483915 | 2014-08-26 16:23:25 -0400 | [diff] [blame] | 8497 | gl::Error error = context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, |
| 8498 | mask, filter); |
| 8499 | if (error.isError()) |
| 8500 | { |
| 8501 | context->recordError(error); |
| 8502 | return; |
| 8503 | } |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8504 | } |
| 8505 | } |
| 8506 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8507 | 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] | 8508 | GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8509 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 8510 | 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] | 8511 | "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] | 8512 | "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] | 8513 | target, level, internalformat, width, height, depth, border, format, type, pixels); |
| 8514 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8515 | UNIMPLEMENTED(); // FIXME |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8516 | } |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8517 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8518 | void GL_APIENTRY glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8519 | GLenum *binaryFormat, void *binary) |
| 8520 | { |
apatrick@chromium.org | 90080e3 | 2012-07-09 22:15:33 +0000 | [diff] [blame] | 8521 | 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] | 8522 | program, bufSize, length, binaryFormat, binary); |
| 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 | { |
| 8527 | gl::Program *programObject = context->getProgram(program); |
| 8528 | |
| 8529 | if (!programObject || !programObject->isLinked()) |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8530 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8531 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8532 | return; |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8533 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8534 | |
| 8535 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 8536 | |
| 8537 | if (!programBinary) |
| 8538 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8539 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8540 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8541 | } |
| 8542 | |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 8543 | gl::Error error = programBinary->save(binaryFormat, binary, bufSize, length); |
| 8544 | if (error.isError()) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8545 | { |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 8546 | context->recordError(error); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8547 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8548 | } |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8549 | } |
| 8550 | } |
| 8551 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8552 | void GL_APIENTRY glProgramBinaryOES(GLuint program, GLenum binaryFormat, |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8553 | const void *binary, GLint length) |
| 8554 | { |
| 8555 | EVENT("(GLenum program = 0x%X, binaryFormat = 0x%x, binary = 0x%0.8p, length = %d)", |
| 8556 | program, binaryFormat, binary, length); |
| 8557 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8558 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8559 | if (context) |
| 8560 | { |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 8561 | const std::vector<GLenum> &programBinaryFormats = context->getCaps().programBinaryFormats; |
| 8562 | if (std::find(programBinaryFormats.begin(), programBinaryFormats.end(), binaryFormat) == programBinaryFormats.end()) |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8563 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8564 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8565 | return; |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8566 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8567 | |
| 8568 | gl::Program *programObject = context->getProgram(program); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8569 | if (!programObject) |
| 8570 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8571 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8572 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8573 | } |
| 8574 | |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 8575 | gl::Error error = context->setProgramBinary(program, binaryFormat, binary, length); |
| 8576 | if (error.isError()) |
| 8577 | { |
| 8578 | context->recordError(error); |
| 8579 | return; |
| 8580 | } |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8581 | } |
| 8582 | } |
| 8583 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8584 | 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] | 8585 | { |
| 8586 | EVENT("(GLenum n = %d, bufs = 0x%0.8p)", n, bufs); |
| 8587 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8588 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8589 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8590 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8591 | 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] | 8592 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8593 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8594 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8595 | } |
| 8596 | |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 8597 | ASSERT(context->getState().getDrawFramebuffer()); |
| 8598 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8599 | if (context->getState().getDrawFramebuffer()->id() == 0) |
| 8600 | { |
| 8601 | if (n != 1) |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8602 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8603 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8604 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8605 | } |
| 8606 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8607 | 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] | 8608 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8609 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8610 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 2fa73c5 | 2013-04-13 03:37:20 +0000 | [diff] [blame] | 8611 | } |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8612 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8613 | else |
| 8614 | { |
| 8615 | for (int colorAttachment = 0; colorAttachment < n; colorAttachment++) |
| 8616 | { |
| 8617 | const GLenum attachment = GL_COLOR_ATTACHMENT0_EXT + colorAttachment; |
| 8618 | if (bufs[colorAttachment] != GL_NONE && bufs[colorAttachment] != attachment) |
| 8619 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8620 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8621 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8622 | } |
| 8623 | } |
| 8624 | } |
| 8625 | |
| 8626 | gl::Framebuffer *framebuffer = context->getState().getDrawFramebuffer(); |
Jamie Madill | 48faf80 | 2014-11-06 15:27:22 -0500 | [diff] [blame] | 8627 | ASSERT(framebuffer); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8628 | |
| 8629 | for (unsigned int colorAttachment = 0; colorAttachment < static_cast<unsigned int>(n); colorAttachment++) |
| 8630 | { |
| 8631 | framebuffer->setDrawBufferState(colorAttachment, bufs[colorAttachment]); |
| 8632 | } |
| 8633 | |
| 8634 | for (unsigned int colorAttachment = n; colorAttachment < context->getCaps().maxDrawBuffers; colorAttachment++) |
| 8635 | { |
| 8636 | framebuffer->setDrawBufferState(colorAttachment, GL_NONE); |
| 8637 | } |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8638 | } |
| 8639 | } |
| 8640 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8641 | void GL_APIENTRY glGetBufferPointervOES(GLenum target, GLenum pname, void** params) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8642 | { |
| 8643 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params); |
| 8644 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8645 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8646 | if (context) |
| 8647 | { |
| 8648 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8649 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8650 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8651 | return; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8652 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8653 | |
| 8654 | if (pname != GL_BUFFER_MAP_POINTER) |
| 8655 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8656 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8657 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8658 | } |
| 8659 | |
| 8660 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8661 | |
| 8662 | if (!buffer || !buffer->isMapped()) |
| 8663 | { |
| 8664 | *params = NULL; |
| 8665 | } |
| 8666 | else |
| 8667 | { |
| 8668 | *params = buffer->getMapPointer(); |
| 8669 | } |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8670 | } |
| 8671 | } |
| 8672 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8673 | void * GL_APIENTRY glMapBufferOES(GLenum target, GLenum access) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8674 | { |
| 8675 | EVENT("(GLenum target = 0x%X, GLbitfield access = 0x%X)", target, access); |
| 8676 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8677 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8678 | if (context) |
| 8679 | { |
| 8680 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8681 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8682 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8683 | return NULL; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8684 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8685 | |
| 8686 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8687 | |
| 8688 | if (buffer == NULL) |
| 8689 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8690 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8691 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8692 | } |
| 8693 | |
| 8694 | if (access != GL_WRITE_ONLY_OES) |
| 8695 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8696 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8697 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8698 | } |
| 8699 | |
| 8700 | if (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 NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8704 | } |
| 8705 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 8706 | gl::Error error = buffer->mapRange(0, buffer->getSize(), GL_MAP_WRITE_BIT); |
| 8707 | if (error.isError()) |
| 8708 | { |
| 8709 | context->recordError(error); |
| 8710 | return NULL; |
| 8711 | } |
| 8712 | |
| 8713 | return buffer->getMapPointer(); |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8714 | } |
| 8715 | |
| 8716 | return NULL; |
| 8717 | } |
| 8718 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8719 | GLboolean GL_APIENTRY glUnmapBufferOES(GLenum target) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8720 | { |
| 8721 | EVENT("(GLenum target = 0x%X)", target); |
| 8722 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8723 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8724 | if (context) |
| 8725 | { |
| 8726 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8727 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8728 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8729 | return GL_FALSE; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8730 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8731 | |
| 8732 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8733 | |
| 8734 | if (buffer == NULL || !buffer->isMapped()) |
| 8735 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8736 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8737 | return GL_FALSE; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8738 | } |
| 8739 | |
| 8740 | // TODO: detect if we had corruption. if so, throw an error and return false. |
| 8741 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 8742 | gl::Error error = buffer->unmap(); |
| 8743 | if (error.isError()) |
| 8744 | { |
| 8745 | context->recordError(error); |
| 8746 | return GL_FALSE; |
| 8747 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8748 | |
| 8749 | return GL_TRUE; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8750 | } |
| 8751 | |
| 8752 | return GL_FALSE; |
| 8753 | } |
| 8754 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8755 | void* GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8756 | { |
| 8757 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)", |
| 8758 | target, offset, length, access); |
| 8759 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8760 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8761 | if (context) |
| 8762 | { |
| 8763 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8764 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8765 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8766 | return NULL; |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8767 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8768 | |
| 8769 | if (offset < 0 || length < 0) |
| 8770 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8771 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8772 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8773 | } |
| 8774 | |
| 8775 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8776 | |
| 8777 | if (buffer == NULL) |
| 8778 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8779 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8780 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8781 | } |
| 8782 | |
| 8783 | // Check for buffer overflow |
| 8784 | size_t offsetSize = static_cast<size_t>(offset); |
| 8785 | size_t lengthSize = static_cast<size_t>(length); |
| 8786 | |
| 8787 | if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) || |
| 8788 | offsetSize + lengthSize > static_cast<size_t>(buffer->getSize())) |
| 8789 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8790 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8791 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8792 | } |
| 8793 | |
| 8794 | // Check for invalid bits in the mask |
| 8795 | GLbitfield allAccessBits = GL_MAP_READ_BIT | |
| 8796 | GL_MAP_WRITE_BIT | |
| 8797 | GL_MAP_INVALIDATE_RANGE_BIT | |
| 8798 | GL_MAP_INVALIDATE_BUFFER_BIT | |
| 8799 | GL_MAP_FLUSH_EXPLICIT_BIT | |
| 8800 | GL_MAP_UNSYNCHRONIZED_BIT; |
| 8801 | |
| 8802 | if (access & ~(allAccessBits)) |
| 8803 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8804 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8805 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8806 | } |
| 8807 | |
| 8808 | if (length == 0 || buffer->isMapped()) |
| 8809 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8810 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8811 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8812 | } |
| 8813 | |
| 8814 | // Check for invalid bit combinations |
| 8815 | if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0) |
| 8816 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8817 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8818 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8819 | } |
| 8820 | |
| 8821 | GLbitfield writeOnlyBits = GL_MAP_INVALIDATE_RANGE_BIT | |
| 8822 | GL_MAP_INVALIDATE_BUFFER_BIT | |
| 8823 | GL_MAP_UNSYNCHRONIZED_BIT; |
| 8824 | |
| 8825 | if ((access & GL_MAP_READ_BIT) != 0 && (access & writeOnlyBits) != 0) |
| 8826 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8827 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8828 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8829 | } |
| 8830 | |
| 8831 | if ((access & GL_MAP_WRITE_BIT) == 0 && (access & GL_MAP_FLUSH_EXPLICIT_BIT) != 0) |
| 8832 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8833 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8834 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8835 | } |
| 8836 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 8837 | gl::Error error = buffer->mapRange(offset, length, access); |
| 8838 | if (error.isError()) |
| 8839 | { |
| 8840 | context->recordError(error); |
| 8841 | return NULL; |
| 8842 | } |
| 8843 | |
| 8844 | return buffer->getMapPointer(); |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8845 | } |
| 8846 | |
| 8847 | return NULL; |
| 8848 | } |
| 8849 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8850 | void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8851 | { |
| 8852 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length); |
| 8853 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8854 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8855 | if (context) |
| 8856 | { |
| 8857 | if (offset < 0 || length < 0) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8858 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8859 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8860 | return; |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8861 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8862 | |
| 8863 | if (!gl::ValidBufferTarget(context, target)) |
| 8864 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8865 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8866 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8867 | } |
| 8868 | |
| 8869 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8870 | |
| 8871 | if (buffer == NULL) |
| 8872 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8873 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8874 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8875 | } |
| 8876 | |
| 8877 | if (!buffer->isMapped() || (buffer->getAccessFlags() & GL_MAP_FLUSH_EXPLICIT_BIT) == 0) |
| 8878 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8879 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8880 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8881 | } |
| 8882 | |
| 8883 | // Check for buffer overflow |
| 8884 | size_t offsetSize = static_cast<size_t>(offset); |
| 8885 | size_t lengthSize = static_cast<size_t>(length); |
| 8886 | |
| 8887 | if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) || |
| 8888 | offsetSize + lengthSize > static_cast<size_t>(buffer->getMapLength())) |
| 8889 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8890 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8891 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8892 | } |
| 8893 | |
| 8894 | // We do not currently support a non-trivial implementation of FlushMappedBufferRange |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8895 | } |
| 8896 | } |
| 8897 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8898 | __eglMustCastToProperFunctionPointerType EGLAPIENTRY glGetProcAddress(const char *procname) |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8899 | { |
| 8900 | struct Extension |
| 8901 | { |
| 8902 | const char *name; |
| 8903 | __eglMustCastToProperFunctionPointerType address; |
| 8904 | }; |
| 8905 | |
| 8906 | static const Extension glExtensions[] = |
| 8907 | { |
| 8908 | {"glTexImage3DOES", (__eglMustCastToProperFunctionPointerType)glTexImage3DOES}, |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 8909 | {"glBlitFramebufferANGLE", (__eglMustCastToProperFunctionPointerType)glBlitFramebufferANGLE}, |
daniel@transgaming.com | 1fe96c9 | 2011-01-14 15:08:44 +0000 | [diff] [blame] | 8910 | {"glRenderbufferStorageMultisampleANGLE", (__eglMustCastToProperFunctionPointerType)glRenderbufferStorageMultisampleANGLE}, |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 8911 | {"glDeleteFencesNV", (__eglMustCastToProperFunctionPointerType)glDeleteFencesNV}, |
| 8912 | {"glGenFencesNV", (__eglMustCastToProperFunctionPointerType)glGenFencesNV}, |
| 8913 | {"glIsFenceNV", (__eglMustCastToProperFunctionPointerType)glIsFenceNV}, |
| 8914 | {"glTestFenceNV", (__eglMustCastToProperFunctionPointerType)glTestFenceNV}, |
| 8915 | {"glGetFenceivNV", (__eglMustCastToProperFunctionPointerType)glGetFenceivNV}, |
| 8916 | {"glFinishFenceNV", (__eglMustCastToProperFunctionPointerType)glFinishFenceNV}, |
| 8917 | {"glSetFenceNV", (__eglMustCastToProperFunctionPointerType)glSetFenceNV}, |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 8918 | {"glGetTranslatedShaderSourceANGLE", (__eglMustCastToProperFunctionPointerType)glGetTranslatedShaderSourceANGLE}, |
daniel@transgaming.com | 0bd1f2f | 2011-11-11 04:19:03 +0000 | [diff] [blame] | 8919 | {"glTexStorage2DEXT", (__eglMustCastToProperFunctionPointerType)glTexStorage2DEXT}, |
daniel@transgaming.com | 709ed11 | 2011-11-12 03:18:10 +0000 | [diff] [blame] | 8920 | {"glGetGraphicsResetStatusEXT", (__eglMustCastToProperFunctionPointerType)glGetGraphicsResetStatusEXT}, |
| 8921 | {"glReadnPixelsEXT", (__eglMustCastToProperFunctionPointerType)glReadnPixelsEXT}, |
| 8922 | {"glGetnUniformfvEXT", (__eglMustCastToProperFunctionPointerType)glGetnUniformfvEXT}, |
| 8923 | {"glGetnUniformivEXT", (__eglMustCastToProperFunctionPointerType)glGetnUniformivEXT}, |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 8924 | {"glGenQueriesEXT", (__eglMustCastToProperFunctionPointerType)glGenQueriesEXT}, |
| 8925 | {"glDeleteQueriesEXT", (__eglMustCastToProperFunctionPointerType)glDeleteQueriesEXT}, |
| 8926 | {"glIsQueryEXT", (__eglMustCastToProperFunctionPointerType)glIsQueryEXT}, |
| 8927 | {"glBeginQueryEXT", (__eglMustCastToProperFunctionPointerType)glBeginQueryEXT}, |
| 8928 | {"glEndQueryEXT", (__eglMustCastToProperFunctionPointerType)glEndQueryEXT}, |
| 8929 | {"glGetQueryivEXT", (__eglMustCastToProperFunctionPointerType)glGetQueryivEXT}, |
| 8930 | {"glGetQueryObjectuivEXT", (__eglMustCastToProperFunctionPointerType)glGetQueryObjectuivEXT}, |
shannon.woods%transgaming.com@gtempaccount.com | 77d9472 | 2013-04-13 03:34:22 +0000 | [diff] [blame] | 8931 | {"glDrawBuffersEXT", (__eglMustCastToProperFunctionPointerType)glDrawBuffersEXT}, |
daniel@transgaming.com | dce02fd | 2012-01-27 15:39:51 +0000 | [diff] [blame] | 8932 | {"glVertexAttribDivisorANGLE", (__eglMustCastToProperFunctionPointerType)glVertexAttribDivisorANGLE}, |
| 8933 | {"glDrawArraysInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawArraysInstancedANGLE}, |
| 8934 | {"glDrawElementsInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawElementsInstancedANGLE}, |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8935 | {"glGetProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glGetProgramBinaryOES}, |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8936 | {"glProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glProgramBinaryOES}, |
| 8937 | {"glGetBufferPointervOES", (__eglMustCastToProperFunctionPointerType)glGetBufferPointervOES}, |
| 8938 | {"glMapBufferOES", (__eglMustCastToProperFunctionPointerType)glMapBufferOES}, |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8939 | {"glUnmapBufferOES", (__eglMustCastToProperFunctionPointerType)glUnmapBufferOES}, |
| 8940 | {"glMapBufferRangeEXT", (__eglMustCastToProperFunctionPointerType)glMapBufferRangeEXT}, |
| 8941 | {"glFlushMappedBufferRangeEXT", (__eglMustCastToProperFunctionPointerType)glFlushMappedBufferRangeEXT}, }; |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8942 | |
shannon.woods@transgaming.com | d438fd4 | 2013-02-28 23:17:45 +0000 | [diff] [blame] | 8943 | for (unsigned int ext = 0; ext < ArraySize(glExtensions); ext++) |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8944 | { |
| 8945 | if (strcmp(procname, glExtensions[ext].name) == 0) |
| 8946 | { |
| 8947 | return (__eglMustCastToProperFunctionPointerType)glExtensions[ext].address; |
| 8948 | } |
| 8949 | } |
| 8950 | |
| 8951 | return NULL; |
| 8952 | } |
| 8953 | |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 8954 | // Non-public functions used by EGL |
| 8955 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8956 | bool EGLAPIENTRY glBindTexImage(egl::Surface *surface) |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8957 | { |
| 8958 | EVENT("(egl::Surface* surface = 0x%0.8p)", |
| 8959 | surface); |
| 8960 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8961 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8962 | if (context) |
| 8963 | { |
| 8964 | gl::Texture2D *textureObject = context->getTexture2D(); |
| 8965 | ASSERT(textureObject != NULL); |
| 8966 | |
| 8967 | if (textureObject->isImmutable()) |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8968 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8969 | return false; |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8970 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8971 | |
| 8972 | textureObject->bindTexImage(surface); |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8973 | } |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 8974 | |
| 8975 | return true; |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8976 | } |
| 8977 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8978 | } |