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); |
| 624 | return framebuffer->completeness(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 625 | } |
| 626 | |
| 627 | return 0; |
| 628 | } |
| 629 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 630 | void GL_APIENTRY glClear(GLbitfield mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 631 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 632 | EVENT("(GLbitfield mask = 0x%X)", mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 633 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 634 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 635 | if (context) |
| 636 | { |
| 637 | gl::Framebuffer *framebufferObject = context->getState().getDrawFramebuffer(); |
| 638 | |
| 639 | if (!framebufferObject || framebufferObject->completeness() != GL_FRAMEBUFFER_COMPLETE) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 640 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 641 | context->recordError(gl::Error(GL_INVALID_FRAMEBUFFER_OPERATION)); |
| 642 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 643 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 644 | |
| 645 | if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0) |
| 646 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 647 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 648 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 649 | } |
| 650 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 651 | gl::Error error = context->clear(mask); |
| 652 | if (error.isError()) |
| 653 | { |
| 654 | context->recordError(error); |
| 655 | return; |
| 656 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 657 | } |
| 658 | } |
| 659 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 660 | 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] | 661 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 662 | 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] | 663 | red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 664 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 665 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 666 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 667 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 668 | context->getState().setClearColor(red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 669 | } |
| 670 | } |
| 671 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 672 | void GL_APIENTRY glClearDepthf(GLclampf depth) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 673 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 674 | EVENT("(GLclampf depth = %f)", depth); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 675 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 676 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 677 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 678 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 679 | context->getState().setClearDepth(depth); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 680 | } |
| 681 | } |
| 682 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 683 | void GL_APIENTRY glClearStencil(GLint s) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 684 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 685 | EVENT("(GLint s = %d)", s); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 686 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 687 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 688 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 689 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 690 | context->getState().setClearStencil(s); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 691 | } |
| 692 | } |
| 693 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 694 | 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] | 695 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 696 | 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] | 697 | red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 698 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 699 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 700 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 701 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 702 | 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] | 703 | } |
| 704 | } |
| 705 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 706 | void GL_APIENTRY glCompileShader(GLuint shader) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 707 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 708 | EVENT("(GLuint shader = %d)", shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 709 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 710 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 711 | if (context) |
| 712 | { |
| 713 | gl::Shader *shaderObject = context->getShader(shader); |
| 714 | |
| 715 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 716 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 717 | if (context->getProgram(shader)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 718 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 719 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 720 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 721 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 722 | else |
daniel@transgaming.com | 5d752f2 | 2010-10-07 13:37:20 +0000 | [diff] [blame] | 723 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 724 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 725 | return; |
daniel@transgaming.com | 5d752f2 | 2010-10-07 13:37:20 +0000 | [diff] [blame] | 726 | } |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 727 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 728 | |
| 729 | shaderObject->compile(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 730 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 731 | } |
| 732 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 733 | 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] | 734 | GLint border, GLsizei imageSize, const GLvoid* data) |
| 735 | { |
| 736 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " |
| 737 | "GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
| 738 | target, level, internalformat, width, height, border, imageSize, data); |
| 739 | |
| 740 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 741 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 742 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 743 | if (context->getClientVersion() < 3 && |
| 744 | !ValidateES2TexImageParameters(context, target, level, internalformat, true, false, |
| 745 | 0, 0, width, height, border, GL_NONE, GL_NONE, data)) |
| 746 | { |
| 747 | return; |
| 748 | } |
| 749 | |
| 750 | if (context->getClientVersion() >= 3 && |
| 751 | !ValidateES3TexImageParameters(context, target, level, internalformat, true, false, |
| 752 | 0, 0, 0, width, height, 1, border, GL_NONE, GL_NONE, data)) |
| 753 | { |
| 754 | return; |
| 755 | } |
| 756 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 757 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat); |
| 758 | 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] | 759 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 760 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 761 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 762 | } |
| 763 | |
| 764 | switch (target) |
| 765 | { |
| 766 | case GL_TEXTURE_2D: |
| 767 | { |
| 768 | gl::Texture2D *texture = context->getTexture2D(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 769 | 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] | 770 | if (error.isError()) |
| 771 | { |
| 772 | context->recordError(error); |
| 773 | return; |
| 774 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 775 | } |
| 776 | break; |
| 777 | |
| 778 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 779 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 780 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 781 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 782 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 783 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 784 | { |
| 785 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 786 | 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] | 787 | if (error.isError()) |
| 788 | { |
| 789 | context->recordError(error); |
| 790 | return; |
| 791 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 792 | } |
| 793 | break; |
| 794 | |
| 795 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 796 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 797 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 798 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 799 | } |
| 800 | } |
| 801 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 802 | 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] | 803 | GLenum format, GLsizei imageSize, const GLvoid* data) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 804 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 805 | 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] | 806 | "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, " |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 807 | "GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 808 | target, level, xoffset, yoffset, width, height, format, imageSize, data); |
| 809 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 810 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 811 | if (context) |
| 812 | { |
| 813 | if (context->getClientVersion() < 3 && |
| 814 | !ValidateES2TexImageParameters(context, target, level, GL_NONE, true, true, |
| 815 | xoffset, yoffset, width, height, 0, GL_NONE, GL_NONE, data)) |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 816 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 817 | return; |
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 | |
| 820 | if (context->getClientVersion() >= 3 && |
| 821 | !ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true, |
| 822 | xoffset, yoffset, 0, width, height, 1, 0, GL_NONE, GL_NONE, data)) |
| 823 | { |
| 824 | return; |
| 825 | } |
| 826 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 827 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format); |
| 828 | 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] | 829 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 830 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 831 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 832 | } |
| 833 | |
| 834 | switch (target) |
| 835 | { |
| 836 | case GL_TEXTURE_2D: |
| 837 | { |
| 838 | gl::Texture2D *texture = context->getTexture2D(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 839 | 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] | 840 | if (error.isError()) |
| 841 | { |
| 842 | context->recordError(error); |
| 843 | return; |
| 844 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 845 | } |
| 846 | break; |
| 847 | |
| 848 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 849 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 850 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 851 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 852 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 853 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 854 | { |
| 855 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 856 | 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] | 857 | if (error.isError()) |
| 858 | { |
| 859 | context->recordError(error); |
| 860 | return; |
| 861 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 862 | } |
| 863 | break; |
| 864 | |
| 865 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 866 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 867 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 868 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 869 | } |
| 870 | } |
| 871 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 872 | 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] | 873 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 874 | 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] | 875 | "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] | 876 | target, level, internalformat, x, y, width, height, border); |
| 877 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 878 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 879 | if (context) |
| 880 | { |
| 881 | if (context->getClientVersion() < 3 && |
| 882 | !ValidateES2CopyTexImageParameters(context, target, level, internalformat, false, |
| 883 | 0, 0, x, y, width, height, border)) |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 884 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 885 | return; |
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 | |
| 888 | if (context->getClientVersion() >= 3 && |
| 889 | !ValidateES3CopyTexImageParameters(context, target, level, internalformat, false, |
| 890 | 0, 0, 0, x, y, width, height, border)) |
| 891 | { |
| 892 | return; |
| 893 | } |
| 894 | |
| 895 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 896 | |
| 897 | switch (target) |
| 898 | { |
| 899 | case GL_TEXTURE_2D: |
| 900 | { |
| 901 | gl::Texture2D *texture = context->getTexture2D(); |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 902 | gl::Error error = texture->copyImage(level, internalformat, x, y, width, height, framebuffer); |
| 903 | if (error.isError()) |
| 904 | { |
| 905 | context->recordError(error); |
| 906 | return; |
| 907 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 908 | } |
| 909 | break; |
| 910 | |
| 911 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 912 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 913 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 914 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 915 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 916 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 917 | { |
| 918 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 919 | gl::Error error = texture->copyImage(target, level, internalformat, x, y, width, height, framebuffer); |
| 920 | if (error.isError()) |
| 921 | { |
| 922 | context->recordError(error); |
| 923 | return; |
| 924 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 925 | } |
| 926 | break; |
| 927 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 928 | default: |
| 929 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 930 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 931 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 932 | } |
| 933 | } |
| 934 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 935 | 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] | 936 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 937 | 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] | 938 | "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] | 939 | target, level, xoffset, yoffset, x, y, width, height); |
| 940 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 941 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 942 | if (context) |
| 943 | { |
| 944 | if (context->getClientVersion() < 3 && |
| 945 | !ValidateES2CopyTexImageParameters(context, target, level, GL_NONE, true, |
| 946 | xoffset, yoffset, x, y, width, height, 0)) |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 947 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 948 | return; |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 949 | } |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 950 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 951 | if (context->getClientVersion() >= 3 && |
| 952 | !ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true, |
| 953 | xoffset, yoffset, 0, x, y, width, height, 0)) |
| 954 | { |
| 955 | return; |
| 956 | } |
| 957 | |
| 958 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 959 | |
| 960 | switch (target) |
| 961 | { |
| 962 | case GL_TEXTURE_2D: |
| 963 | { |
| 964 | gl::Texture2D *texture = context->getTexture2D(); |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 965 | gl::Error error = texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer); |
| 966 | if (error.isError()) |
| 967 | { |
| 968 | context->recordError(error); |
| 969 | return; |
| 970 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 971 | } |
| 972 | break; |
| 973 | |
| 974 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 975 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 976 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 977 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 978 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 979 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 980 | { |
| 981 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 982 | gl::Error error = texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer); |
| 983 | if (error.isError()) |
| 984 | { |
| 985 | context->recordError(error); |
| 986 | return; |
| 987 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 988 | } |
| 989 | break; |
| 990 | |
| 991 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 992 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 993 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 994 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 995 | } |
| 996 | } |
| 997 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 998 | GLuint GL_APIENTRY glCreateProgram(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 999 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1000 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1001 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1002 | gl::Context *context = gl::getNonLostContext(); |
| 1003 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1004 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1005 | return context->createProgram(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1006 | } |
| 1007 | |
| 1008 | return 0; |
| 1009 | } |
| 1010 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1011 | GLuint GL_APIENTRY glCreateShader(GLenum type) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1012 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1013 | EVENT("(GLenum type = 0x%X)", type); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1014 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1015 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1016 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1017 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1018 | switch (type) |
| 1019 | { |
| 1020 | case GL_FRAGMENT_SHADER: |
| 1021 | case GL_VERTEX_SHADER: |
| 1022 | return context->createShader(type); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1023 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1024 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1025 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1026 | return 0; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1027 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1028 | } |
| 1029 | |
| 1030 | return 0; |
| 1031 | } |
| 1032 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1033 | void GL_APIENTRY glCullFace(GLenum mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1034 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1035 | EVENT("(GLenum mode = 0x%X)", mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1036 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1037 | gl::Context *context = gl::getNonLostContext(); |
| 1038 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1039 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1040 | switch (mode) |
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 | case GL_FRONT: |
| 1043 | case GL_BACK: |
| 1044 | case GL_FRONT_AND_BACK: |
| 1045 | break; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1046 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1047 | default: |
| 1048 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1049 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1050 | } |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1051 | |
| 1052 | context->getState().setCullMode(mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1053 | } |
| 1054 | } |
| 1055 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1056 | void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint* buffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1057 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1058 | 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] | 1059 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1060 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1061 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1062 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1063 | if (n < 0) |
| 1064 | { |
| 1065 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1066 | return; |
| 1067 | } |
| 1068 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1069 | for (int i = 0; i < n; i++) |
| 1070 | { |
| 1071 | context->deleteBuffer(buffers[i]); |
| 1072 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1073 | } |
| 1074 | } |
| 1075 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1076 | void GL_APIENTRY glDeleteFencesNV(GLsizei n, const GLuint* fences) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1077 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1078 | 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] | 1079 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1080 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1081 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1082 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1083 | if (n < 0) |
| 1084 | { |
| 1085 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1086 | return; |
| 1087 | } |
| 1088 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1089 | for (int i = 0; i < n; i++) |
| 1090 | { |
| 1091 | context->deleteFenceNV(fences[i]); |
| 1092 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1093 | } |
| 1094 | } |
| 1095 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1096 | void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1097 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1098 | 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] | 1099 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1100 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1101 | if (context) |
| 1102 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1103 | if (n < 0) |
| 1104 | { |
| 1105 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1106 | return; |
| 1107 | } |
| 1108 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1109 | for (int i = 0; i < n; i++) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1110 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1111 | if (framebuffers[i] != 0) |
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 | context->deleteFramebuffer(framebuffers[i]); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1114 | } |
| 1115 | } |
| 1116 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1117 | } |
| 1118 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1119 | void GL_APIENTRY glDeleteProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1120 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1121 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1122 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1123 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1124 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1125 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1126 | if (program == 0) |
| 1127 | { |
| 1128 | return; |
| 1129 | } |
| 1130 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1131 | if (!context->getProgram(program)) |
| 1132 | { |
| 1133 | if(context->getShader(program)) |
| 1134 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1135 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1136 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1137 | } |
| 1138 | else |
| 1139 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1140 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1141 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1142 | } |
| 1143 | } |
| 1144 | |
| 1145 | context->deleteProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1146 | } |
| 1147 | } |
| 1148 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1149 | void GL_APIENTRY glDeleteQueriesEXT(GLsizei n, const GLuint *ids) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1150 | { |
| 1151 | EVENT("(GLsizei n = %d, const GLuint *ids = 0x%0.8p)", n, ids); |
| 1152 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1153 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1154 | if (context) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1155 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1156 | if (n < 0) |
| 1157 | { |
| 1158 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1159 | return; |
| 1160 | } |
| 1161 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1162 | for (int i = 0; i < n; i++) |
| 1163 | { |
| 1164 | context->deleteQuery(ids[i]); |
| 1165 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1166 | } |
| 1167 | } |
| 1168 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1169 | void GL_APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1170 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1171 | 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] | 1172 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1173 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1174 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1175 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1176 | if (n < 0) |
| 1177 | { |
| 1178 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1179 | return; |
| 1180 | } |
| 1181 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1182 | for (int i = 0; i < n; i++) |
| 1183 | { |
| 1184 | context->deleteRenderbuffer(renderbuffers[i]); |
| 1185 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1186 | } |
| 1187 | } |
| 1188 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1189 | void GL_APIENTRY glDeleteShader(GLuint shader) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1190 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1191 | EVENT("(GLuint shader = %d)", shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1192 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1193 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1194 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1195 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1196 | if (shader == 0) |
| 1197 | { |
| 1198 | return; |
| 1199 | } |
| 1200 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1201 | if (!context->getShader(shader)) |
| 1202 | { |
| 1203 | if(context->getProgram(shader)) |
| 1204 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1205 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1206 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1207 | } |
| 1208 | else |
| 1209 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1210 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1211 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1212 | } |
| 1213 | } |
| 1214 | |
| 1215 | context->deleteShader(shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1216 | } |
| 1217 | } |
| 1218 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1219 | void GL_APIENTRY glDeleteTextures(GLsizei n, const GLuint* textures) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1220 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1221 | 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] | 1222 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1223 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1224 | if (context) |
| 1225 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1226 | if (n < 0) |
| 1227 | { |
| 1228 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1229 | return; |
| 1230 | } |
| 1231 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1232 | for (int i = 0; i < n; i++) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1233 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1234 | if (textures[i] != 0) |
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 | context->deleteTexture(textures[i]); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1237 | } |
| 1238 | } |
| 1239 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1240 | } |
| 1241 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1242 | void GL_APIENTRY glDepthFunc(GLenum func) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1243 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1244 | EVENT("(GLenum func = 0x%X)", func); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1245 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1246 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1247 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1248 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1249 | switch (func) |
| 1250 | { |
| 1251 | case GL_NEVER: |
| 1252 | case GL_ALWAYS: |
| 1253 | case GL_LESS: |
| 1254 | case GL_LEQUAL: |
| 1255 | case GL_EQUAL: |
| 1256 | case GL_GREATER: |
| 1257 | case GL_GEQUAL: |
| 1258 | case GL_NOTEQUAL: |
| 1259 | context->getState().setDepthFunc(func); |
| 1260 | break; |
| 1261 | |
| 1262 | default: |
| 1263 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1264 | return; |
| 1265 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1266 | } |
| 1267 | } |
| 1268 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1269 | void GL_APIENTRY glDepthMask(GLboolean flag) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1270 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 1271 | EVENT("(GLboolean flag = %u)", flag); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1272 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1273 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1274 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1275 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1276 | context->getState().setDepthMask(flag != GL_FALSE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1277 | } |
| 1278 | } |
| 1279 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1280 | void GL_APIENTRY glDepthRangef(GLclampf zNear, GLclampf zFar) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1281 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1282 | EVENT("(GLclampf zNear = %f, GLclampf zFar = %f)", zNear, zFar); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1283 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1284 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1285 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1286 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1287 | context->getState().setDepthRange(zNear, zFar); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1288 | } |
| 1289 | } |
| 1290 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1291 | void GL_APIENTRY glDetachShader(GLuint program, GLuint shader) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1292 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1293 | EVENT("(GLuint program = %d, GLuint shader = %d)", program, shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1294 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1295 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1296 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1297 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1298 | gl::Program *programObject = context->getProgram(program); |
| 1299 | gl::Shader *shaderObject = context->getShader(shader); |
| 1300 | |
| 1301 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1302 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1303 | gl::Shader *shaderByProgramHandle; |
| 1304 | shaderByProgramHandle = context->getShader(program); |
| 1305 | if (!shaderByProgramHandle) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1306 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1307 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1308 | return; |
daniel@transgaming.com | 73c2c2e | 2010-04-13 03:26:11 +0000 | [diff] [blame] | 1309 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1310 | else |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1311 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1312 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1313 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1314 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1315 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1316 | |
| 1317 | if (!shaderObject) |
| 1318 | { |
| 1319 | gl::Program *programByShaderHandle = context->getProgram(shader); |
| 1320 | if (!programByShaderHandle) |
| 1321 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1322 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1323 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1324 | } |
| 1325 | else |
| 1326 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1327 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1328 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1329 | } |
| 1330 | } |
| 1331 | |
| 1332 | if (!programObject->detachShader(shaderObject)) |
| 1333 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1334 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1335 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1336 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1337 | } |
| 1338 | } |
| 1339 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1340 | void GL_APIENTRY glDisable(GLenum cap) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1341 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1342 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1343 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1344 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1345 | if (context) |
| 1346 | { |
| 1347 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1348 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1349 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1350 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1351 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1352 | |
| 1353 | context->getState().setEnableFeature(cap, false); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1354 | } |
| 1355 | } |
| 1356 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1357 | void GL_APIENTRY glDisableVertexAttribArray(GLuint index) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1358 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1359 | EVENT("(GLuint index = %d)", index); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1360 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1361 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1362 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1363 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1364 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 1365 | { |
| 1366 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1367 | return; |
| 1368 | } |
| 1369 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1370 | context->getState().setEnableVertexAttribArray(index, false); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1371 | } |
| 1372 | } |
| 1373 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1374 | void GL_APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1375 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1376 | 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] | 1377 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1378 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1379 | if (context) |
| 1380 | { |
Jamie Madill | 2b97681 | 2014-08-25 15:47:49 -0400 | [diff] [blame] | 1381 | if (!ValidateDrawArrays(context, mode, first, count, 0)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1382 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1383 | return; |
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 | |
Geoff Lang | c77e8c3 | 2014-09-08 16:28:24 -0400 | [diff] [blame] | 1386 | gl::Error error = context->drawArrays(mode, first, count, 0); |
| 1387 | if (error.isError()) |
| 1388 | { |
| 1389 | context->recordError(error); |
| 1390 | return; |
| 1391 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1392 | } |
| 1393 | } |
| 1394 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1395 | 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] | 1396 | { |
| 1397 | EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei primcount = %d)", mode, first, count, primcount); |
| 1398 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1399 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1400 | if (context) |
| 1401 | { |
Geoff Lang | 87a9330 | 2014-09-16 13:29:43 -0400 | [diff] [blame] | 1402 | if (!ValidateDrawArraysInstancedANGLE(context, mode, first, count, primcount)) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1403 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1404 | return; |
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 | |
Geoff Lang | c77e8c3 | 2014-09-08 16:28:24 -0400 | [diff] [blame] | 1407 | gl::Error error = context->drawArrays(mode, first, count, primcount); |
| 1408 | if (error.isError()) |
| 1409 | { |
| 1410 | context->recordError(error); |
| 1411 | return; |
| 1412 | } |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1413 | } |
| 1414 | } |
| 1415 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1416 | 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] | 1417 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1418 | 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] | 1419 | mode, count, type, indices); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1420 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1421 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1422 | if (context) |
| 1423 | { |
Jamie Madill | 2b97681 | 2014-08-25 15:47:49 -0400 | [diff] [blame] | 1424 | rx::RangeUI indexRange; |
| 1425 | if (!ValidateDrawElements(context, mode, count, type, indices, 0, &indexRange)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1426 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1427 | return; |
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 | |
Geoff Lang | c77e8c3 | 2014-09-08 16:28:24 -0400 | [diff] [blame] | 1430 | gl::Error error = context->drawElements(mode, count, type, indices, 0, indexRange); |
| 1431 | if (error.isError()) |
| 1432 | { |
| 1433 | context->recordError(error); |
| 1434 | return; |
| 1435 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1436 | } |
| 1437 | } |
| 1438 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1439 | 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] | 1440 | { |
| 1441 | EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei primcount = %d)", |
| 1442 | mode, count, type, indices, primcount); |
| 1443 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1444 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1445 | if (context) |
| 1446 | { |
Jamie Madill | 2b97681 | 2014-08-25 15:47:49 -0400 | [diff] [blame] | 1447 | rx::RangeUI indexRange; |
Geoff Lang | 87a9330 | 2014-09-16 13:29:43 -0400 | [diff] [blame] | 1448 | if (!ValidateDrawElementsInstancedANGLE(context, mode, count, type, indices, primcount, &indexRange)) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1449 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1450 | return; |
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 | |
Geoff Lang | c77e8c3 | 2014-09-08 16:28:24 -0400 | [diff] [blame] | 1453 | gl::Error error = context->drawElements(mode, count, type, indices, primcount, indexRange); |
| 1454 | if (error.isError()) |
| 1455 | { |
| 1456 | context->recordError(error); |
| 1457 | return; |
| 1458 | } |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1459 | } |
| 1460 | } |
| 1461 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1462 | void GL_APIENTRY glEnable(GLenum cap) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1463 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1464 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1465 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1466 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1467 | if (context) |
| 1468 | { |
| 1469 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1470 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1471 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1472 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1473 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1474 | |
| 1475 | context->getState().setEnableFeature(cap, true); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1476 | } |
| 1477 | } |
| 1478 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1479 | void GL_APIENTRY glEnableVertexAttribArray(GLuint index) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1480 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1481 | EVENT("(GLuint index = %d)", index); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1482 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1483 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1484 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1485 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1486 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 1487 | { |
| 1488 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1489 | return; |
| 1490 | } |
| 1491 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1492 | context->getState().setEnableVertexAttribArray(index, true); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1493 | } |
| 1494 | } |
| 1495 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1496 | void GL_APIENTRY glEndQueryEXT(GLenum target) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1497 | { |
| 1498 | EVENT("GLenum target = 0x%X)", target); |
| 1499 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1500 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1501 | if (context) |
| 1502 | { |
| 1503 | if (!ValidateEndQuery(context, target)) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1504 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1505 | return; |
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 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 1508 | gl::Error error = context->endQuery(target); |
| 1509 | if (error.isError()) |
| 1510 | { |
| 1511 | context->recordError(error); |
| 1512 | return; |
| 1513 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1514 | } |
| 1515 | } |
| 1516 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1517 | void GL_APIENTRY glFinishFenceNV(GLuint fence) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1518 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1519 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1520 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1521 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1522 | if (context) |
| 1523 | { |
| 1524 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 1525 | |
| 1526 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1527 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1528 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1529 | return; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1530 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1531 | |
| 1532 | if (fenceObject->isFence() != GL_TRUE) |
| 1533 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1534 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1535 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1536 | } |
| 1537 | |
| 1538 | fenceObject->finishFence(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1539 | } |
| 1540 | } |
| 1541 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1542 | void GL_APIENTRY glFinish(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1543 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1544 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1545 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1546 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1547 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1548 | { |
Geoff Lang | 2629856 | 2014-10-01 10:49:03 -0400 | [diff] [blame] | 1549 | gl::Error error = context->sync(true); |
| 1550 | if (error.isError()) |
| 1551 | { |
| 1552 | context->recordError(error); |
| 1553 | return; |
| 1554 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1555 | } |
| 1556 | } |
| 1557 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1558 | void GL_APIENTRY glFlush(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1559 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1560 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1561 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1562 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1563 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1564 | { |
Geoff Lang | 2629856 | 2014-10-01 10:49:03 -0400 | [diff] [blame] | 1565 | gl::Error error = context->sync(false); |
| 1566 | if (error.isError()) |
| 1567 | { |
| 1568 | context->recordError(error); |
| 1569 | return; |
| 1570 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1571 | } |
| 1572 | } |
| 1573 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1574 | 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] | 1575 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1576 | 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] | 1577 | "GLuint renderbuffer = %d)", target, attachment, renderbuffertarget, renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1578 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1579 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1580 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1581 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1582 | if (!gl::ValidFramebufferTarget(target) || (renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0)) |
| 1583 | { |
| 1584 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1585 | return; |
| 1586 | } |
| 1587 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1588 | if (!gl::ValidateFramebufferRenderbufferParameters(context, target, attachment, renderbuffertarget, renderbuffer)) |
| 1589 | { |
| 1590 | return; |
| 1591 | } |
| 1592 | |
| 1593 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 1594 | ASSERT(framebuffer); |
| 1595 | |
| 1596 | if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT) |
| 1597 | { |
| 1598 | unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT); |
| 1599 | framebuffer->setColorbuffer(colorAttachment, GL_RENDERBUFFER, renderbuffer, 0, 0); |
| 1600 | } |
| 1601 | else |
| 1602 | { |
| 1603 | switch (attachment) |
| 1604 | { |
| 1605 | case GL_DEPTH_ATTACHMENT: |
| 1606 | framebuffer->setDepthbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0); |
| 1607 | break; |
| 1608 | case GL_STENCIL_ATTACHMENT: |
| 1609 | framebuffer->setStencilbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0); |
| 1610 | break; |
| 1611 | case GL_DEPTH_STENCIL_ATTACHMENT: |
| 1612 | framebuffer->setDepthStencilBuffer(GL_RENDERBUFFER, renderbuffer, 0, 0); |
| 1613 | break; |
| 1614 | default: |
| 1615 | UNREACHABLE(); |
| 1616 | break; |
| 1617 | } |
| 1618 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1619 | } |
| 1620 | } |
| 1621 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1622 | 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] | 1623 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1624 | 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] | 1625 | "GLuint texture = %d, GLint level = %d)", target, attachment, textarget, texture, level); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1626 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1627 | gl::Context *context = gl::getNonLostContext(); |
| 1628 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1629 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1630 | if (!ValidateFramebufferTexture2D(context, target, attachment, textarget, texture, level)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1631 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1632 | return; |
| 1633 | } |
shannon.woods%transgaming.com@gtempaccount.com | 89ae113 | 2013-04-13 03:28:43 +0000 | [diff] [blame] | 1634 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1635 | if (texture == 0) |
| 1636 | { |
| 1637 | textarget = GL_NONE; |
| 1638 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1639 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1640 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1641 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1642 | if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT) |
| 1643 | { |
| 1644 | const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT); |
| 1645 | framebuffer->setColorbuffer(colorAttachment, textarget, texture, level, 0); |
| 1646 | } |
| 1647 | else |
| 1648 | { |
| 1649 | switch (attachment) |
daniel@transgaming.com | fbc0953 | 2010-04-26 15:33:41 +0000 | [diff] [blame] | 1650 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1651 | case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level, 0); break; |
| 1652 | case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level, 0); break; |
| 1653 | case GL_DEPTH_STENCIL_ATTACHMENT: framebuffer->setDepthStencilBuffer(textarget, texture, level, 0); break; |
daniel@transgaming.com | fbc0953 | 2010-04-26 15:33:41 +0000 | [diff] [blame] | 1654 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1655 | } |
| 1656 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1657 | } |
| 1658 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1659 | void GL_APIENTRY glFrontFace(GLenum mode) |
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("(GLenum mode = 0x%X)", mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1662 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1663 | gl::Context *context = gl::getNonLostContext(); |
| 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 | switch (mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1667 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1668 | case GL_CW: |
| 1669 | case GL_CCW: |
| 1670 | context->getState().setFrontFace(mode); |
| 1671 | break; |
| 1672 | default: |
| 1673 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1674 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 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 glGenBuffers(GLsizei n, GLuint* buffers) |
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("(GLsizei n = %d, GLuint* buffers = 0x%0.8p)", n, buffers); |
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) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1685 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1686 | if (n < 0) |
| 1687 | { |
| 1688 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1689 | return; |
| 1690 | } |
| 1691 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1692 | for (int i = 0; i < n; i++) |
| 1693 | { |
| 1694 | buffers[i] = context->createBuffer(); |
| 1695 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1696 | } |
| 1697 | } |
| 1698 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1699 | void GL_APIENTRY glGenerateMipmap(GLenum target) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1700 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1701 | EVENT("(GLenum target = 0x%X)", target); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1702 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1703 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1704 | if (context) |
| 1705 | { |
| 1706 | if (!ValidTextureTarget(context, target)) |
daniel@transgaming.com | 8fd99e2 | 2010-04-20 18:52:00 +0000 | [diff] [blame] | 1707 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1708 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1709 | return; |
daniel@transgaming.com | 8fd99e2 | 2010-04-20 18:52:00 +0000 | [diff] [blame] | 1710 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1711 | |
| 1712 | gl::Texture *texture = context->getTargetTexture(target); |
| 1713 | |
| 1714 | if (texture == NULL) |
| 1715 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1716 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1717 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1718 | } |
| 1719 | |
| 1720 | GLenum internalFormat = texture->getBaseLevelInternalFormat(); |
| 1721 | const gl::TextureCaps &formatCaps = context->getTextureCaps().get(internalFormat); |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 1722 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1723 | |
| 1724 | // GenerateMipmap should not generate an INVALID_OPERATION for textures created with |
| 1725 | // unsized formats or that are color renderable and filterable. Since we do not track if |
| 1726 | // the texture was created with sized or unsized format (only sized formats are stored), |
| 1727 | // it is not possible to make sure the the LUMA formats can generate mipmaps (they should |
| 1728 | // be able to) because they aren't color renderable. Simply do a special case for LUMA |
| 1729 | // textures since they're the only texture format that can be created with unsized formats |
| 1730 | // that is not color renderable. New unsized formats are unlikely to be added, since ES2 |
| 1731 | // was the last version to use add them. |
| 1732 | bool isLUMA = internalFormat == GL_LUMINANCE8_EXT || |
| 1733 | internalFormat == GL_LUMINANCE8_ALPHA8_EXT || |
| 1734 | internalFormat == GL_ALPHA8_EXT; |
| 1735 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 1736 | if (formatInfo.depthBits > 0 || formatInfo.stencilBits > 0 || !formatCaps.filterable || |
| 1737 | (!formatCaps.renderable && !isLUMA) || formatInfo.compressed) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1738 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1739 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1740 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1741 | } |
| 1742 | |
| 1743 | // GL_EXT_sRGB does not support mipmap generation on sRGB textures |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 1744 | if (context->getClientVersion() == 2 && formatInfo.colorEncoding == GL_SRGB) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1745 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1746 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1747 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1748 | } |
| 1749 | |
| 1750 | // Non-power of 2 ES2 check |
| 1751 | if (!context->getExtensions().textureNPOT && (!gl::isPow2(texture->getBaseLevelWidth()) || !gl::isPow2(texture->getBaseLevelHeight()))) |
| 1752 | { |
| 1753 | 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] | 1754 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1755 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1756 | } |
| 1757 | |
| 1758 | // Cube completeness check |
| 1759 | if (target == GL_TEXTURE_CUBE_MAP) |
| 1760 | { |
| 1761 | gl::TextureCubeMap *textureCube = static_cast<gl::TextureCubeMap *>(texture); |
| 1762 | if (!textureCube->isCubeComplete()) |
| 1763 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1764 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1765 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1766 | } |
| 1767 | } |
| 1768 | |
Geoff Lang | 06ecf3d | 2014-09-23 16:39:50 -0400 | [diff] [blame] | 1769 | gl::Error error = texture->generateMipmaps(); |
| 1770 | if (error.isError()) |
| 1771 | { |
| 1772 | context->recordError(error); |
| 1773 | return; |
| 1774 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1775 | } |
| 1776 | } |
| 1777 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1778 | void GL_APIENTRY glGenFencesNV(GLsizei n, GLuint* fences) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1779 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1780 | EVENT("(GLsizei n = %d, GLuint* fences = 0x%0.8p)", n, fences); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +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) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +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 | fences[i] = context->createFenceNV(); |
| 1794 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1795 | } |
| 1796 | } |
| 1797 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1798 | void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1799 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1800 | EVENT("(GLsizei n = %d, GLuint* framebuffers = 0x%0.8p)", n, framebuffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 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) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1804 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1805 | if (n < 0) |
| 1806 | { |
| 1807 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1808 | return; |
| 1809 | } |
| 1810 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1811 | for (int i = 0; i < n; i++) |
| 1812 | { |
| 1813 | framebuffers[i] = context->createFramebuffer(); |
| 1814 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1815 | } |
| 1816 | } |
| 1817 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1818 | void GL_APIENTRY glGenQueriesEXT(GLsizei n, GLuint* ids) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1819 | { |
| 1820 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 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) |
| 1824 | { |
| 1825 | if (n < 0) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1826 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1827 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1828 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1829 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1830 | |
| 1831 | for (GLsizei i = 0; i < n; i++) |
| 1832 | { |
| 1833 | ids[i] = context->createQuery(); |
| 1834 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1835 | } |
| 1836 | } |
| 1837 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1838 | void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1839 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1840 | EVENT("(GLsizei n = %d, GLuint* renderbuffers = 0x%0.8p)", n, renderbuffers); |
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 | renderbuffers[i] = context->createRenderbuffer(); |
| 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 glGenTextures(GLsizei n, GLuint* textures) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1859 | { |
Jamie Madill | 1fc7e2c | 2014-01-21 16:47:10 -0500 | [diff] [blame] | 1860 | EVENT("(GLsizei n = %d, GLuint* textures = 0x%0.8p)", n, textures); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1861 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1862 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1863 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1864 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1865 | if (n < 0) |
| 1866 | { |
| 1867 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1868 | return; |
| 1869 | } |
| 1870 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1871 | for (int i = 0; i < n; i++) |
| 1872 | { |
| 1873 | textures[i] = context->createTexture(); |
| 1874 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1875 | } |
| 1876 | } |
| 1877 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1878 | 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] | 1879 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1880 | 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] | 1881 | "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] | 1882 | program, index, bufsize, length, size, type, name); |
| 1883 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1884 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1885 | if (context) |
| 1886 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1887 | if (bufsize < 0) |
| 1888 | { |
| 1889 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1890 | return; |
| 1891 | } |
| 1892 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1893 | gl::Program *programObject = context->getProgram(program); |
| 1894 | |
| 1895 | if (!programObject) |
| 1896 | { |
| 1897 | if (context->getShader(program)) |
| 1898 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1899 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1900 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1901 | } |
| 1902 | else |
| 1903 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1904 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1905 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1906 | } |
| 1907 | } |
| 1908 | |
| 1909 | if (index >= (GLuint)programObject->getActiveAttributeCount()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1910 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1911 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1912 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1913 | } |
| 1914 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1915 | programObject->getActiveAttribute(index, bufsize, length, size, type, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1916 | } |
| 1917 | } |
| 1918 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1919 | 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] | 1920 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1921 | EVENT("(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, " |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 1922 | "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] | 1923 | program, index, bufsize, length, size, type, name); |
| 1924 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1925 | |
| 1926 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1927 | if (context) |
| 1928 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1929 | if (bufsize < 0) |
| 1930 | { |
| 1931 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1932 | return; |
| 1933 | } |
| 1934 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1935 | gl::Program *programObject = context->getProgram(program); |
| 1936 | |
| 1937 | if (!programObject) |
| 1938 | { |
| 1939 | if (context->getShader(program)) |
| 1940 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1941 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1942 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1943 | } |
| 1944 | else |
| 1945 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1946 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1947 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1948 | } |
| 1949 | } |
| 1950 | |
| 1951 | if (index >= (GLuint)programObject->getActiveUniformCount()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1952 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1953 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1954 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1955 | } |
| 1956 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1957 | programObject->getActiveUniform(index, bufsize, length, size, type, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1958 | } |
| 1959 | } |
| 1960 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1961 | 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] | 1962 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1963 | 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] | 1964 | program, maxcount, count, shaders); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1965 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1966 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1967 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1968 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1969 | if (maxcount < 0) |
| 1970 | { |
| 1971 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1972 | return; |
| 1973 | } |
| 1974 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1975 | gl::Program *programObject = context->getProgram(program); |
| 1976 | |
| 1977 | if (!programObject) |
| 1978 | { |
| 1979 | if (context->getShader(program)) |
| 1980 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1981 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1982 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1983 | } |
| 1984 | else |
| 1985 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1986 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1987 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1988 | } |
| 1989 | } |
| 1990 | |
| 1991 | return programObject->getAttachedShaders(maxcount, count, shaders); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1992 | } |
| 1993 | } |
| 1994 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1995 | GLint GL_APIENTRY glGetAttribLocation(GLuint program, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1996 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1997 | EVENT("(GLuint program = %d, const GLchar* name = %s)", program, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1998 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1999 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2000 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2001 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2002 | gl::Program *programObject = context->getProgram(program); |
| 2003 | |
| 2004 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2005 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2006 | if (context->getShader(program)) |
daniel@transgaming.com | cf4aa87 | 2010-04-13 03:26:27 +0000 | [diff] [blame] | 2007 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2008 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2009 | return -1; |
daniel@transgaming.com | cf4aa87 | 2010-04-13 03:26:27 +0000 | [diff] [blame] | 2010 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2011 | else |
| 2012 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2013 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2014 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2015 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2016 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2017 | |
| 2018 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 2019 | if (!programObject->isLinked() || !programBinary) |
| 2020 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2021 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2022 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2023 | } |
| 2024 | |
| 2025 | return programBinary->getAttributeLocation(name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2026 | } |
| 2027 | |
| 2028 | return -1; |
| 2029 | } |
| 2030 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2031 | void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2032 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2033 | 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] | 2034 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2035 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2036 | if (context) |
| 2037 | { |
| 2038 | GLenum nativeType; |
| 2039 | unsigned int numParams = 0; |
| 2040 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2041 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2042 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2043 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2044 | |
| 2045 | if (nativeType == GL_BOOL) |
| 2046 | { |
| 2047 | context->getBooleanv(pname, params); |
| 2048 | } |
| 2049 | else |
| 2050 | { |
| 2051 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2052 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2053 | } |
| 2054 | } |
| 2055 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2056 | void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2057 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2058 | 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] | 2059 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2060 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2061 | if (context) |
| 2062 | { |
| 2063 | if (!gl::ValidBufferTarget(context, target)) |
daniel@transgaming.com | aa0ccbd | 2010-04-15 20:45:05 +0000 | [diff] [blame] | 2064 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2065 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2066 | return; |
daniel@transgaming.com | aa0ccbd | 2010-04-15 20:45:05 +0000 | [diff] [blame] | 2067 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2068 | |
| 2069 | if (!gl::ValidBufferParameter(context, pname)) |
| 2070 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2071 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2072 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2073 | } |
| 2074 | |
| 2075 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 2076 | |
| 2077 | if (!buffer) |
| 2078 | { |
| 2079 | // 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] | 2080 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2081 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2082 | } |
| 2083 | |
| 2084 | switch (pname) |
| 2085 | { |
| 2086 | case GL_BUFFER_USAGE: |
| 2087 | *params = static_cast<GLint>(buffer->getUsage()); |
| 2088 | break; |
| 2089 | case GL_BUFFER_SIZE: |
| 2090 | *params = gl::clampCast<GLint>(buffer->getSize()); |
| 2091 | break; |
| 2092 | case GL_BUFFER_ACCESS_FLAGS: |
| 2093 | *params = buffer->getAccessFlags(); |
| 2094 | break; |
| 2095 | case GL_BUFFER_MAPPED: |
| 2096 | *params = static_cast<GLint>(buffer->isMapped()); |
| 2097 | break; |
| 2098 | case GL_BUFFER_MAP_OFFSET: |
| 2099 | *params = gl::clampCast<GLint>(buffer->getMapOffset()); |
| 2100 | break; |
| 2101 | case GL_BUFFER_MAP_LENGTH: |
| 2102 | *params = gl::clampCast<GLint>(buffer->getMapLength()); |
| 2103 | break; |
| 2104 | default: UNREACHABLE(); break; |
| 2105 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2106 | } |
| 2107 | } |
| 2108 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2109 | GLenum GL_APIENTRY glGetError(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2110 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2111 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2112 | |
| 2113 | gl::Context *context = gl::getContext(); |
| 2114 | |
| 2115 | if (context) |
| 2116 | { |
daniel@transgaming.com | 82b2891 | 2011-12-12 21:01:35 +0000 | [diff] [blame] | 2117 | return context->getError(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2118 | } |
| 2119 | |
| 2120 | return GL_NO_ERROR; |
| 2121 | } |
| 2122 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2123 | void GL_APIENTRY glGetFenceivNV(GLuint fence, GLenum pname, GLint *params) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2124 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2125 | 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] | 2126 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2127 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2128 | if (context) |
| 2129 | { |
| 2130 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 2131 | |
| 2132 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2133 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2134 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2135 | return; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2136 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2137 | |
| 2138 | if (fenceObject->isFence() != GL_TRUE) |
| 2139 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2140 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2141 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2142 | } |
| 2143 | |
| 2144 | switch (pname) |
| 2145 | { |
| 2146 | case GL_FENCE_STATUS_NV: |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 2147 | { |
| 2148 | // GL_NV_fence spec: |
| 2149 | // Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV |
| 2150 | // or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence. |
| 2151 | GLboolean status = GL_TRUE; |
| 2152 | if (fenceObject->getStatus() != GL_TRUE) |
| 2153 | { |
| 2154 | gl::Error error = fenceObject->testFence(&status); |
| 2155 | if (error.isError()) |
| 2156 | { |
| 2157 | context->recordError(error); |
| 2158 | return; |
| 2159 | } |
| 2160 | } |
| 2161 | *params = status; |
| 2162 | break; |
| 2163 | } |
| 2164 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2165 | case GL_FENCE_CONDITION_NV: |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 2166 | { |
| 2167 | *params = fenceObject->getCondition(); |
| 2168 | break; |
| 2169 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2170 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2171 | default: |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 2172 | { |
| 2173 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2174 | return; |
| 2175 | } |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 2176 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2177 | } |
| 2178 | } |
| 2179 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2180 | void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2181 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2182 | 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] | 2183 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2184 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2185 | if (context) |
| 2186 | { |
| 2187 | GLenum nativeType; |
| 2188 | unsigned int numParams = 0; |
| 2189 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 32e58cd | 2010-03-24 09:44:10 +0000 | [diff] [blame] | 2190 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2191 | return; |
daniel@transgaming.com | 32e58cd | 2010-03-24 09:44:10 +0000 | [diff] [blame] | 2192 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2193 | |
| 2194 | if (nativeType == GL_FLOAT) |
| 2195 | { |
| 2196 | context->getFloatv(pname, params); |
| 2197 | } |
| 2198 | else |
| 2199 | { |
| 2200 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2201 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2202 | } |
| 2203 | } |
| 2204 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2205 | 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] | 2206 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2207 | 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] | 2208 | target, attachment, pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2209 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2210 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2211 | if (context) |
| 2212 | { |
| 2213 | if (!gl::ValidFramebufferTarget(target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2214 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2215 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2216 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2217 | } |
| 2218 | |
| 2219 | int clientVersion = context->getClientVersion(); |
| 2220 | |
| 2221 | switch (pname) |
| 2222 | { |
| 2223 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2224 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2225 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| 2226 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| 2227 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2228 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2229 | case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: |
| 2230 | if (clientVersion < 3 && !context->getExtensions().sRGB) |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2231 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2232 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2233 | return; |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2234 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2235 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2236 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2237 | case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: |
| 2238 | case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: |
| 2239 | case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: |
| 2240 | case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: |
| 2241 | case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: |
| 2242 | case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: |
| 2243 | case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: |
| 2244 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: |
| 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; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2251 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2252 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2253 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2254 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2255 | } |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2256 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2257 | // Determine if the attachment is a valid enum |
| 2258 | switch (attachment) |
| 2259 | { |
| 2260 | case GL_BACK: |
| 2261 | case GL_FRONT: |
| 2262 | case GL_DEPTH: |
| 2263 | case GL_STENCIL: |
| 2264 | case GL_DEPTH_STENCIL_ATTACHMENT: |
| 2265 | if (clientVersion < 3) |
| 2266 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2267 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2268 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2269 | } |
| 2270 | break; |
| 2271 | |
| 2272 | case GL_DEPTH_ATTACHMENT: |
| 2273 | case GL_STENCIL_ATTACHMENT: |
| 2274 | break; |
| 2275 | |
| 2276 | default: |
| 2277 | if (attachment < GL_COLOR_ATTACHMENT0_EXT || |
| 2278 | (attachment - GL_COLOR_ATTACHMENT0_EXT) >= context->getCaps().maxColorAttachments) |
| 2279 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2280 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2281 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2282 | } |
| 2283 | break; |
| 2284 | } |
| 2285 | |
| 2286 | GLuint framebufferHandle = context->getState().getTargetFramebuffer(target)->id(); |
| 2287 | gl::Framebuffer *framebuffer = context->getFramebuffer(framebufferHandle); |
| 2288 | |
| 2289 | if (framebufferHandle == 0) |
| 2290 | { |
| 2291 | if (clientVersion < 3) |
| 2292 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2293 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2294 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2295 | } |
| 2296 | |
| 2297 | switch (attachment) |
| 2298 | { |
| 2299 | case GL_BACK: |
| 2300 | case GL_DEPTH: |
| 2301 | case GL_STENCIL: |
| 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 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2305 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2306 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2307 | } |
| 2308 | } |
| 2309 | else |
| 2310 | { |
| 2311 | if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT) |
| 2312 | { |
| 2313 | // Valid attachment query |
| 2314 | } |
| 2315 | else |
| 2316 | { |
| 2317 | switch (attachment) |
| 2318 | { |
| 2319 | case GL_DEPTH_ATTACHMENT: |
| 2320 | case GL_STENCIL_ATTACHMENT: |
| 2321 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2322 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2323 | case GL_DEPTH_STENCIL_ATTACHMENT: |
| 2324 | if (framebuffer->hasValidDepthStencil()) |
| 2325 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2326 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2327 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2328 | } |
| 2329 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2330 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2331 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2332 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2333 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2334 | } |
| 2335 | } |
| 2336 | } |
| 2337 | |
| 2338 | GLenum attachmentType = GL_NONE; |
| 2339 | GLuint attachmentHandle = 0; |
| 2340 | GLuint attachmentLevel = 0; |
| 2341 | GLuint attachmentLayer = 0; |
| 2342 | |
| 2343 | const gl::FramebufferAttachment *attachmentObject = framebuffer->getAttachment(attachment); |
| 2344 | |
| 2345 | if (attachmentObject) |
| 2346 | { |
| 2347 | attachmentType = attachmentObject->type(); |
| 2348 | attachmentHandle = attachmentObject->id(); |
| 2349 | attachmentLevel = attachmentObject->mipLevel(); |
| 2350 | attachmentLayer = attachmentObject->layer(); |
| 2351 | } |
| 2352 | |
| 2353 | GLenum attachmentObjectType; // Type category |
| 2354 | if (framebufferHandle == 0) |
| 2355 | { |
| 2356 | attachmentObjectType = GL_FRAMEBUFFER_DEFAULT; |
| 2357 | } |
| 2358 | else if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER) |
| 2359 | { |
| 2360 | attachmentObjectType = attachmentType; |
| 2361 | } |
| 2362 | else if (gl::ValidTexture2DDestinationTarget(context, attachmentType)) |
| 2363 | { |
| 2364 | attachmentObjectType = GL_TEXTURE; |
| 2365 | } |
| 2366 | else |
| 2367 | { |
| 2368 | UNREACHABLE(); |
| 2369 | return; |
| 2370 | } |
| 2371 | |
| 2372 | if (attachmentObjectType == GL_NONE) |
| 2373 | { |
| 2374 | // ES 2.0.25 spec pg 127 states that if the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE |
| 2375 | // is NONE, then querying any other pname will generate INVALID_ENUM. |
| 2376 | |
| 2377 | // ES 3.0.2 spec pg 235 states that if the attachment type is none, |
| 2378 | // GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero and be an |
| 2379 | // INVALID_OPERATION for all other pnames |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 2380 | |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2381 | switch (pname) |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2382 | { |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2383 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2384 | *params = attachmentObjectType; |
| 2385 | break; |
| 2386 | |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2387 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
Geoff Lang | 05b0502 | 2014-06-11 15:31:45 -0400 | [diff] [blame] | 2388 | if (clientVersion < 3) |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2389 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2390 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2391 | return; |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2392 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2393 | *params = 0; |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2394 | break; |
| 2395 | |
| 2396 | default: |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 2397 | if (clientVersion < 3) |
shannon.woods%transgaming.com@gtempaccount.com | 89ae113 | 2013-04-13 03:28:43 +0000 | [diff] [blame] | 2398 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2399 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2400 | return; |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2401 | } |
| 2402 | else |
| 2403 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2404 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2405 | return; |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2406 | } |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2407 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2408 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2409 | else |
| 2410 | { |
| 2411 | ASSERT(attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE || |
| 2412 | attachmentObjectType == GL_FRAMEBUFFER_DEFAULT); |
| 2413 | ASSERT(attachmentObject != NULL); |
| 2414 | |
| 2415 | switch (pname) |
| 2416 | { |
| 2417 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2418 | *params = attachmentObjectType; |
| 2419 | break; |
| 2420 | |
| 2421 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2422 | if (attachmentObjectType != GL_RENDERBUFFER && attachmentObjectType != GL_TEXTURE) |
| 2423 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2424 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2425 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2426 | } |
| 2427 | *params = attachmentHandle; |
| 2428 | break; |
| 2429 | |
| 2430 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| 2431 | if (attachmentObjectType != GL_TEXTURE) |
| 2432 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2433 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2434 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2435 | } |
| 2436 | *params = attachmentLevel; |
| 2437 | break; |
| 2438 | |
| 2439 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| 2440 | if (attachmentObjectType != GL_TEXTURE) |
| 2441 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2442 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2443 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2444 | } |
| 2445 | *params = gl::IsCubemapTextureTarget(attachmentType) ? attachmentType : 0; |
| 2446 | break; |
| 2447 | |
| 2448 | case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: |
| 2449 | *params = attachmentObject->getRedSize(); |
| 2450 | break; |
| 2451 | |
| 2452 | case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: |
| 2453 | *params = attachmentObject->getGreenSize(); |
| 2454 | break; |
| 2455 | |
| 2456 | case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: |
| 2457 | *params = attachmentObject->getBlueSize(); |
| 2458 | break; |
| 2459 | |
| 2460 | case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: |
| 2461 | *params = attachmentObject->getAlphaSize(); |
| 2462 | break; |
| 2463 | |
| 2464 | case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: |
| 2465 | *params = attachmentObject->getDepthSize(); |
| 2466 | break; |
| 2467 | |
| 2468 | case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: |
| 2469 | *params = attachmentObject->getStencilSize(); |
| 2470 | break; |
| 2471 | |
| 2472 | case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: |
Jamie Madill | ee85d1b | 2014-09-17 10:35:23 -0400 | [diff] [blame] | 2473 | if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2474 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2475 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2476 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2477 | } |
| 2478 | *params = attachmentObject->getComponentType(); |
| 2479 | break; |
| 2480 | |
| 2481 | case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: |
| 2482 | *params = attachmentObject->getColorEncoding(); |
| 2483 | break; |
| 2484 | |
| 2485 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: |
| 2486 | if (attachmentObjectType != GL_TEXTURE) |
| 2487 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2488 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2489 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2490 | } |
| 2491 | *params = attachmentLayer; |
| 2492 | break; |
| 2493 | |
| 2494 | default: |
| 2495 | UNREACHABLE(); |
| 2496 | break; |
| 2497 | } |
| 2498 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2499 | } |
| 2500 | } |
| 2501 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2502 | GLenum GL_APIENTRY glGetGraphicsResetStatusEXT(void) |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2503 | { |
| 2504 | EVENT("()"); |
| 2505 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2506 | gl::Context *context = gl::getContext(); |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2507 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2508 | if (context) |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2509 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2510 | return context->getResetStatus(); |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2511 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2512 | |
| 2513 | return GL_NO_ERROR; |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2514 | } |
| 2515 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2516 | void GL_APIENTRY glGetIntegerv(GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2517 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2518 | 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] | 2519 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2520 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2521 | if (context) |
| 2522 | { |
| 2523 | GLenum nativeType; |
| 2524 | unsigned int numParams = 0; |
| 2525 | |
| 2526 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2527 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2528 | return; |
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 | |
| 2531 | if (nativeType == GL_INT) |
| 2532 | { |
| 2533 | context->getIntegerv(pname, params); |
| 2534 | } |
| 2535 | else |
| 2536 | { |
| 2537 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2538 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2539 | } |
| 2540 | } |
| 2541 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2542 | void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2543 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2544 | 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] | 2545 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2546 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2547 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2548 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2549 | gl::Program *programObject = context->getProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2550 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2551 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2552 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2553 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2554 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2555 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2556 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2557 | if (context->getClientVersion() < 3) |
| 2558 | { |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2559 | switch (pname) |
| 2560 | { |
shannonwoods@chromium.org | e684b58 | 2013-05-30 00:07:42 +0000 | [diff] [blame] | 2561 | case GL_ACTIVE_UNIFORM_BLOCKS: |
shannonwoods@chromium.org | e684b58 | 2013-05-30 00:07:42 +0000 | [diff] [blame] | 2562 | case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2563 | case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2564 | case GL_TRANSFORM_FEEDBACK_VARYINGS: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2565 | case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2566 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2567 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2568 | } |
| 2569 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2570 | |
| 2571 | switch (pname) |
| 2572 | { |
| 2573 | case GL_DELETE_STATUS: |
| 2574 | *params = programObject->isFlaggedForDeletion(); |
| 2575 | return; |
| 2576 | case GL_LINK_STATUS: |
| 2577 | *params = programObject->isLinked(); |
| 2578 | return; |
| 2579 | case GL_VALIDATE_STATUS: |
| 2580 | *params = programObject->isValidated(); |
| 2581 | return; |
| 2582 | case GL_INFO_LOG_LENGTH: |
| 2583 | *params = programObject->getInfoLogLength(); |
| 2584 | return; |
| 2585 | case GL_ATTACHED_SHADERS: |
| 2586 | *params = programObject->getAttachedShadersCount(); |
| 2587 | return; |
| 2588 | case GL_ACTIVE_ATTRIBUTES: |
| 2589 | *params = programObject->getActiveAttributeCount(); |
| 2590 | return; |
| 2591 | case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH: |
| 2592 | *params = programObject->getActiveAttributeMaxLength(); |
| 2593 | return; |
| 2594 | case GL_ACTIVE_UNIFORMS: |
| 2595 | *params = programObject->getActiveUniformCount(); |
| 2596 | return; |
| 2597 | case GL_ACTIVE_UNIFORM_MAX_LENGTH: |
| 2598 | *params = programObject->getActiveUniformMaxLength(); |
| 2599 | return; |
| 2600 | case GL_PROGRAM_BINARY_LENGTH_OES: |
| 2601 | *params = programObject->getProgramBinaryLength(); |
| 2602 | return; |
| 2603 | case GL_ACTIVE_UNIFORM_BLOCKS: |
| 2604 | *params = programObject->getActiveUniformBlockCount(); |
| 2605 | return; |
| 2606 | case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: |
| 2607 | *params = programObject->getActiveUniformBlockMaxLength(); |
| 2608 | break; |
| 2609 | case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: |
| 2610 | *params = programObject->getTransformFeedbackBufferMode(); |
| 2611 | break; |
| 2612 | case GL_TRANSFORM_FEEDBACK_VARYINGS: |
| 2613 | *params = programObject->getTransformFeedbackVaryingCount(); |
| 2614 | break; |
| 2615 | case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: |
| 2616 | *params = programObject->getTransformFeedbackVaryingMaxLength(); |
| 2617 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2618 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2619 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2620 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2621 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2622 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2623 | } |
| 2624 | } |
| 2625 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2626 | 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] | 2627 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2628 | 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] | 2629 | program, bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2630 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2631 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2632 | if (context) |
| 2633 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2634 | if (bufsize < 0) |
| 2635 | { |
| 2636 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2637 | return; |
| 2638 | } |
| 2639 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2640 | gl::Program *programObject = context->getProgram(program); |
| 2641 | |
| 2642 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2643 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2644 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2645 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2646 | } |
| 2647 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2648 | programObject->getInfoLog(bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2649 | } |
| 2650 | } |
| 2651 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2652 | void GL_APIENTRY glGetQueryivEXT(GLenum target, GLenum pname, GLint *params) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2653 | { |
| 2654 | EVENT("GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname, params); |
| 2655 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2656 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2657 | if (context) |
| 2658 | { |
| 2659 | if (!ValidQueryType(context, target)) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2660 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2661 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2662 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2663 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2664 | |
| 2665 | switch (pname) |
| 2666 | { |
| 2667 | case GL_CURRENT_QUERY_EXT: |
| 2668 | params[0] = context->getState().getActiveQueryId(target); |
| 2669 | break; |
| 2670 | |
| 2671 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2672 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2673 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2674 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2675 | } |
| 2676 | } |
| 2677 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2678 | void GL_APIENTRY glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2679 | { |
| 2680 | EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)", id, pname, params); |
| 2681 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2682 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2683 | if (context) |
| 2684 | { |
| 2685 | gl::Query *queryObject = context->getQuery(id, false, GL_NONE); |
| 2686 | |
| 2687 | if (!queryObject) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2688 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2689 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2690 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2691 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2692 | |
| 2693 | if (context->getState().getActiveQueryId(queryObject->getType()) == id) |
| 2694 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2695 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2696 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2697 | } |
| 2698 | |
| 2699 | switch(pname) |
| 2700 | { |
| 2701 | case GL_QUERY_RESULT_EXT: |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2702 | { |
| 2703 | gl::Error error = queryObject->getResult(params); |
| 2704 | if (error.isError()) |
| 2705 | { |
| 2706 | context->recordError(error); |
| 2707 | return; |
| 2708 | } |
| 2709 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2710 | break; |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2711 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2712 | case GL_QUERY_RESULT_AVAILABLE_EXT: |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2713 | { |
| 2714 | gl::Error error = queryObject->isResultAvailable(params); |
| 2715 | if (error.isError()) |
| 2716 | { |
| 2717 | context->recordError(error); |
| 2718 | return; |
| 2719 | } |
| 2720 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2721 | break; |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2722 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2723 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2724 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2725 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2726 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2727 | } |
| 2728 | } |
| 2729 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2730 | void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2731 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2732 | 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] | 2733 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2734 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2735 | if (context) |
| 2736 | { |
| 2737 | if (target != GL_RENDERBUFFER) |
daniel@transgaming.com | 4901fca | 2010-04-20 18:52:41 +0000 | [diff] [blame] | 2738 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2739 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2740 | return; |
daniel@transgaming.com | 4901fca | 2010-04-20 18:52:41 +0000 | [diff] [blame] | 2741 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2742 | |
| 2743 | if (context->getState().getRenderbufferId() == 0) |
| 2744 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2745 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2746 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2747 | } |
| 2748 | |
| 2749 | gl::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getState().getRenderbufferId()); |
| 2750 | |
| 2751 | switch (pname) |
| 2752 | { |
| 2753 | case GL_RENDERBUFFER_WIDTH: *params = renderbuffer->getWidth(); break; |
| 2754 | case GL_RENDERBUFFER_HEIGHT: *params = renderbuffer->getHeight(); break; |
| 2755 | case GL_RENDERBUFFER_INTERNAL_FORMAT: *params = renderbuffer->getInternalFormat(); break; |
| 2756 | case GL_RENDERBUFFER_RED_SIZE: *params = renderbuffer->getRedSize(); break; |
| 2757 | case GL_RENDERBUFFER_GREEN_SIZE: *params = renderbuffer->getGreenSize(); break; |
| 2758 | case GL_RENDERBUFFER_BLUE_SIZE: *params = renderbuffer->getBlueSize(); break; |
| 2759 | case GL_RENDERBUFFER_ALPHA_SIZE: *params = renderbuffer->getAlphaSize(); break; |
| 2760 | case GL_RENDERBUFFER_DEPTH_SIZE: *params = renderbuffer->getDepthSize(); break; |
| 2761 | case GL_RENDERBUFFER_STENCIL_SIZE: *params = renderbuffer->getStencilSize(); break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2762 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2763 | case GL_RENDERBUFFER_SAMPLES_ANGLE: |
| 2764 | if (!context->getExtensions().framebufferMultisample) |
| 2765 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2766 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2767 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2768 | } |
| 2769 | *params = renderbuffer->getSamples(); |
| 2770 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2771 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2772 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2773 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2774 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2775 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2776 | } |
| 2777 | } |
| 2778 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2779 | void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2780 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2781 | 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] | 2782 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2783 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2784 | if (context) |
| 2785 | { |
| 2786 | gl::Shader *shaderObject = context->getShader(shader); |
| 2787 | |
| 2788 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2789 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2790 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2791 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2792 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2793 | |
| 2794 | switch (pname) |
| 2795 | { |
| 2796 | case GL_SHADER_TYPE: |
| 2797 | *params = shaderObject->getType(); |
| 2798 | return; |
| 2799 | case GL_DELETE_STATUS: |
| 2800 | *params = shaderObject->isFlaggedForDeletion(); |
| 2801 | return; |
| 2802 | case GL_COMPILE_STATUS: |
| 2803 | *params = shaderObject->isCompiled() ? GL_TRUE : GL_FALSE; |
| 2804 | return; |
| 2805 | case GL_INFO_LOG_LENGTH: |
| 2806 | *params = shaderObject->getInfoLogLength(); |
| 2807 | return; |
| 2808 | case GL_SHADER_SOURCE_LENGTH: |
| 2809 | *params = shaderObject->getSourceLength(); |
| 2810 | return; |
| 2811 | case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: |
| 2812 | *params = shaderObject->getTranslatedSourceLength(); |
| 2813 | return; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2814 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2815 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2816 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2817 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2818 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2819 | } |
| 2820 | } |
| 2821 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2822 | 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] | 2823 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2824 | 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] | 2825 | shader, bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2826 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2827 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2828 | if (context) |
| 2829 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2830 | if (bufsize < 0) |
| 2831 | { |
| 2832 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2833 | return; |
| 2834 | } |
| 2835 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2836 | gl::Shader *shaderObject = context->getShader(shader); |
| 2837 | |
| 2838 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2839 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2840 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2841 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2842 | } |
| 2843 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2844 | shaderObject->getInfoLog(bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2845 | } |
| 2846 | } |
| 2847 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2848 | 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] | 2849 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2850 | 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] | 2851 | shadertype, precisiontype, range, precision); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2852 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2853 | gl::Context *context = gl::getNonLostContext(); |
| 2854 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2855 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2856 | switch (shadertype) |
| 2857 | { |
| 2858 | case GL_VERTEX_SHADER: |
| 2859 | case GL_FRAGMENT_SHADER: |
| 2860 | break; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2861 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2862 | default: |
| 2863 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2864 | return; |
| 2865 | } |
| 2866 | |
| 2867 | switch (precisiontype) |
| 2868 | { |
| 2869 | case GL_LOW_FLOAT: |
| 2870 | case GL_MEDIUM_FLOAT: |
| 2871 | case GL_HIGH_FLOAT: |
| 2872 | // Assume IEEE 754 precision |
| 2873 | range[0] = 127; |
| 2874 | range[1] = 127; |
| 2875 | *precision = 23; |
| 2876 | break; |
| 2877 | |
| 2878 | case GL_LOW_INT: |
| 2879 | case GL_MEDIUM_INT: |
| 2880 | case GL_HIGH_INT: |
| 2881 | // Some (most) hardware only supports single-precision floating-point numbers, |
| 2882 | // which can accurately represent integers up to +/-16777216 |
| 2883 | range[0] = 24; |
| 2884 | range[1] = 24; |
| 2885 | *precision = 0; |
| 2886 | break; |
| 2887 | |
| 2888 | default: |
| 2889 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2890 | return; |
| 2891 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2892 | } |
| 2893 | } |
| 2894 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2895 | 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] | 2896 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2897 | 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] | 2898 | shader, bufsize, length, source); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2899 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2900 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2901 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2902 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2903 | if (bufsize < 0) |
| 2904 | { |
| 2905 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2906 | return; |
| 2907 | } |
| 2908 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2909 | gl::Shader *shaderObject = context->getShader(shader); |
| 2910 | |
| 2911 | if (!shaderObject) |
| 2912 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2913 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2914 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2915 | } |
| 2916 | |
| 2917 | shaderObject->getSource(bufsize, length, source); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2918 | } |
| 2919 | } |
| 2920 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2921 | 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] | 2922 | { |
| 2923 | EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)", |
| 2924 | shader, bufsize, length, source); |
| 2925 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2926 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2927 | if (context) |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2928 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2929 | if (bufsize < 0) |
| 2930 | { |
| 2931 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2932 | return; |
| 2933 | } |
| 2934 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2935 | gl::Shader *shaderObject = context->getShader(shader); |
| 2936 | |
| 2937 | if (!shaderObject) |
| 2938 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2939 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2940 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2941 | } |
| 2942 | |
Tibor den Ouden | 97049c6 | 2014-10-06 21:39:16 +0200 | [diff] [blame] | 2943 | // Only returns extra info if ANGLE_GENERATE_SHADER_DEBUG_INFO is defined |
| 2944 | shaderObject->getTranslatedSourceWithDebugInfo(bufsize, length, source); |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2945 | } |
| 2946 | } |
| 2947 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2948 | const GLubyte* GL_APIENTRY glGetString(GLenum name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2949 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2950 | EVENT("(GLenum name = 0x%X)", name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2951 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2952 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 3e4c600 | 2010-05-05 18:50:13 +0000 | [diff] [blame] | 2953 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2954 | switch (name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2955 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2956 | case GL_VENDOR: |
| 2957 | return (GLubyte*)"Google Inc."; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2958 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2959 | case GL_RENDERER: |
| 2960 | return (GLubyte*)((context != NULL) ? context->getRendererString().c_str() : "ANGLE"); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2961 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2962 | case GL_VERSION: |
| 2963 | if (context->getClientVersion() == 2) |
| 2964 | { |
| 2965 | return (GLubyte*)"OpenGL ES 2.0 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2966 | } |
| 2967 | else |
| 2968 | { |
| 2969 | return (GLubyte*)"OpenGL ES 3.0 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2970 | } |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2971 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2972 | case GL_SHADING_LANGUAGE_VERSION: |
| 2973 | if (context->getClientVersion() == 2) |
| 2974 | { |
| 2975 | return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2976 | } |
| 2977 | else |
| 2978 | { |
| 2979 | return (GLubyte*)"OpenGL ES GLSL ES 3.00 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2980 | } |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2981 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2982 | case GL_EXTENSIONS: |
| 2983 | return (GLubyte*)((context != NULL) ? context->getExtensionString().c_str() : ""); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2984 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2985 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2986 | if (context) |
| 2987 | { |
| 2988 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2989 | } |
| 2990 | return NULL; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2991 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2992 | } |
| 2993 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2994 | void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2995 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2996 | 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] | 2997 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2998 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2999 | if (context) |
| 3000 | { |
| 3001 | gl::Texture *texture = context->getTargetTexture(target); |
| 3002 | |
| 3003 | if (!texture) |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 3004 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3005 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3006 | return; |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 3007 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3008 | |
| 3009 | switch (pname) |
| 3010 | { |
| 3011 | case GL_TEXTURE_MAG_FILTER: |
| 3012 | *params = (GLfloat)texture->getSamplerState().magFilter; |
| 3013 | break; |
| 3014 | case GL_TEXTURE_MIN_FILTER: |
| 3015 | *params = (GLfloat)texture->getSamplerState().minFilter; |
| 3016 | break; |
| 3017 | case GL_TEXTURE_WRAP_S: |
| 3018 | *params = (GLfloat)texture->getSamplerState().wrapS; |
| 3019 | break; |
| 3020 | case GL_TEXTURE_WRAP_T: |
| 3021 | *params = (GLfloat)texture->getSamplerState().wrapT; |
| 3022 | break; |
| 3023 | case GL_TEXTURE_WRAP_R: |
| 3024 | if (context->getClientVersion() < 3) |
| 3025 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3026 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3027 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3028 | } |
| 3029 | *params = (GLfloat)texture->getSamplerState().wrapR; |
| 3030 | break; |
| 3031 | case GL_TEXTURE_IMMUTABLE_FORMAT: |
| 3032 | // Exposed to ES2.0 through EXT_texture_storage, no client version validation. |
| 3033 | *params = (GLfloat)(texture->isImmutable() ? GL_TRUE : GL_FALSE); |
| 3034 | break; |
| 3035 | case GL_TEXTURE_IMMUTABLE_LEVELS: |
| 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->immutableLevelCount(); |
| 3042 | break; |
| 3043 | case GL_TEXTURE_USAGE_ANGLE: |
| 3044 | *params = (GLfloat)texture->getUsage(); |
| 3045 | break; |
| 3046 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
| 3047 | if (!context->getExtensions().textureFilterAnisotropic) |
| 3048 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3049 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3050 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3051 | } |
| 3052 | *params = (GLfloat)texture->getSamplerState().maxAnisotropy; |
| 3053 | break; |
| 3054 | case GL_TEXTURE_SWIZZLE_R: |
| 3055 | if (context->getClientVersion() < 3) |
| 3056 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3057 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3058 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3059 | } |
| 3060 | *params = (GLfloat)texture->getSamplerState().swizzleRed; |
| 3061 | break; |
| 3062 | case GL_TEXTURE_SWIZZLE_G: |
| 3063 | if (context->getClientVersion() < 3) |
| 3064 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3065 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3066 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3067 | } |
| 3068 | *params = (GLfloat)texture->getSamplerState().swizzleGreen; |
| 3069 | break; |
| 3070 | case GL_TEXTURE_SWIZZLE_B: |
| 3071 | if (context->getClientVersion() < 3) |
| 3072 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3073 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3074 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3075 | } |
| 3076 | *params = (GLfloat)texture->getSamplerState().swizzleBlue; |
| 3077 | break; |
| 3078 | case GL_TEXTURE_SWIZZLE_A: |
| 3079 | if (context->getClientVersion() < 3) |
| 3080 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3081 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3082 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3083 | } |
| 3084 | *params = (GLfloat)texture->getSamplerState().swizzleAlpha; |
| 3085 | break; |
| 3086 | case GL_TEXTURE_BASE_LEVEL: |
| 3087 | if (context->getClientVersion() < 3) |
| 3088 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3089 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3090 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3091 | } |
| 3092 | *params = (GLfloat)texture->getSamplerState().baseLevel; |
| 3093 | break; |
| 3094 | case GL_TEXTURE_MAX_LEVEL: |
| 3095 | if (context->getClientVersion() < 3) |
| 3096 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3097 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3098 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3099 | } |
| 3100 | *params = (GLfloat)texture->getSamplerState().maxLevel; |
| 3101 | break; |
| 3102 | case GL_TEXTURE_MIN_LOD: |
| 3103 | if (context->getClientVersion() < 3) |
| 3104 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3105 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3106 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3107 | } |
| 3108 | *params = texture->getSamplerState().minLod; |
| 3109 | break; |
| 3110 | case GL_TEXTURE_MAX_LOD: |
| 3111 | if (context->getClientVersion() < 3) |
| 3112 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3113 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3114 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3115 | } |
| 3116 | *params = texture->getSamplerState().maxLod; |
| 3117 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3118 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3119 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3120 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3121 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3122 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3123 | } |
| 3124 | } |
| 3125 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3126 | void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3127 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3128 | 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] | 3129 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3130 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3131 | if (context) |
| 3132 | { |
| 3133 | gl::Texture *texture = context->getTargetTexture(target); |
| 3134 | |
| 3135 | if (!texture) |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 3136 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3137 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3138 | return; |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 3139 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3140 | |
| 3141 | switch (pname) |
| 3142 | { |
| 3143 | case GL_TEXTURE_MAG_FILTER: |
| 3144 | *params = texture->getSamplerState().magFilter; |
| 3145 | break; |
| 3146 | case GL_TEXTURE_MIN_FILTER: |
| 3147 | *params = texture->getSamplerState().minFilter; |
| 3148 | break; |
| 3149 | case GL_TEXTURE_WRAP_S: |
| 3150 | *params = texture->getSamplerState().wrapS; |
| 3151 | break; |
| 3152 | case GL_TEXTURE_WRAP_T: |
| 3153 | *params = texture->getSamplerState().wrapT; |
| 3154 | break; |
| 3155 | case GL_TEXTURE_WRAP_R: |
| 3156 | if (context->getClientVersion() < 3) |
| 3157 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3158 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3159 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3160 | } |
| 3161 | *params = texture->getSamplerState().wrapR; |
| 3162 | break; |
| 3163 | case GL_TEXTURE_IMMUTABLE_FORMAT: |
| 3164 | // Exposed to ES2.0 through EXT_texture_storage, no client version validation. |
| 3165 | *params = texture->isImmutable() ? GL_TRUE : GL_FALSE; |
| 3166 | break; |
| 3167 | case GL_TEXTURE_IMMUTABLE_LEVELS: |
| 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 | } |
Jamie Madill | 6948e30 | 2014-10-20 17:04:33 -0400 | [diff] [blame] | 3173 | *params = static_cast<GLint>(texture->immutableLevelCount()); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3174 | break; |
| 3175 | case GL_TEXTURE_USAGE_ANGLE: |
| 3176 | *params = texture->getUsage(); |
| 3177 | break; |
| 3178 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
| 3179 | if (!context->getExtensions().textureFilterAnisotropic) |
| 3180 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3181 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3182 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3183 | } |
| 3184 | *params = (GLint)texture->getSamplerState().maxAnisotropy; |
| 3185 | break; |
| 3186 | case GL_TEXTURE_SWIZZLE_R: |
| 3187 | if (context->getClientVersion() < 3) |
| 3188 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3189 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3190 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3191 | } |
| 3192 | *params = texture->getSamplerState().swizzleRed; |
| 3193 | break; |
| 3194 | case GL_TEXTURE_SWIZZLE_G: |
| 3195 | if (context->getClientVersion() < 3) |
| 3196 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3197 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3198 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3199 | } |
| 3200 | *params = texture->getSamplerState().swizzleGreen; |
| 3201 | break; |
| 3202 | case GL_TEXTURE_SWIZZLE_B: |
| 3203 | if (context->getClientVersion() < 3) |
| 3204 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3205 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3206 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3207 | } |
| 3208 | *params = texture->getSamplerState().swizzleBlue; |
| 3209 | break; |
| 3210 | case GL_TEXTURE_SWIZZLE_A: |
| 3211 | if (context->getClientVersion() < 3) |
| 3212 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3213 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3214 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3215 | } |
| 3216 | *params = texture->getSamplerState().swizzleAlpha; |
| 3217 | break; |
| 3218 | case GL_TEXTURE_BASE_LEVEL: |
| 3219 | if (context->getClientVersion() < 3) |
| 3220 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3221 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3222 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3223 | } |
| 3224 | *params = texture->getSamplerState().baseLevel; |
| 3225 | break; |
| 3226 | case GL_TEXTURE_MAX_LEVEL: |
| 3227 | if (context->getClientVersion() < 3) |
| 3228 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3229 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3230 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3231 | } |
| 3232 | *params = texture->getSamplerState().maxLevel; |
| 3233 | break; |
| 3234 | case GL_TEXTURE_MIN_LOD: |
| 3235 | if (context->getClientVersion() < 3) |
| 3236 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3237 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3238 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3239 | } |
| 3240 | *params = (GLint)texture->getSamplerState().minLod; |
| 3241 | break; |
| 3242 | case GL_TEXTURE_MAX_LOD: |
| 3243 | if (context->getClientVersion() < 3) |
| 3244 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3245 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3246 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3247 | } |
| 3248 | *params = (GLint)texture->getSamplerState().maxLod; |
| 3249 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3250 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3251 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3252 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3253 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3254 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3255 | } |
| 3256 | } |
| 3257 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3258 | 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] | 3259 | { |
| 3260 | EVENT("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLfloat* params = 0x%0.8p)", |
| 3261 | program, location, bufSize, params); |
| 3262 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3263 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3264 | if (context) |
| 3265 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3266 | if (!ValidateGetnUniformfvEXT(context, program, location, bufSize, params)) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3267 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3268 | return; |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3269 | } |
| 3270 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3271 | gl::Program *programObject = context->getProgram(program); |
| 3272 | ASSERT(programObject); |
| 3273 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3274 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3275 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3276 | programBinary->getUniformfv(location, params); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3277 | } |
| 3278 | } |
| 3279 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3280 | void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3281 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3282 | 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] | 3283 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3284 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3285 | if (context) |
| 3286 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3287 | if (!ValidateGetUniformfv(context, program, location, params)) |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3288 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3289 | return; |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3290 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3291 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3292 | gl::Program *programObject = context->getProgram(program); |
| 3293 | ASSERT(programObject); |
| 3294 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3295 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3296 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3297 | programBinary->getUniformfv(location, params); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3298 | } |
| 3299 | } |
| 3300 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3301 | 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] | 3302 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3303 | 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] | 3304 | program, location, bufSize, params); |
| 3305 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3306 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3307 | if (context) |
| 3308 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3309 | if (!ValidateGetnUniformivEXT(context, program, location, bufSize, params)) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3310 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3311 | return; |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3312 | } |
| 3313 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3314 | gl::Program *programObject = context->getProgram(program); |
| 3315 | ASSERT(programObject); |
| 3316 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3317 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3318 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3319 | programBinary->getUniformiv(location, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3320 | } |
| 3321 | } |
| 3322 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3323 | void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3324 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3325 | 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] | 3326 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3327 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3328 | if (context) |
| 3329 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3330 | if (!ValidateGetUniformiv(context, program, location, params)) |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3331 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3332 | return; |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3333 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3334 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3335 | gl::Program *programObject = context->getProgram(program); |
| 3336 | ASSERT(programObject); |
| 3337 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3338 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3339 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3340 | programBinary->getUniformiv(location, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3341 | } |
| 3342 | } |
| 3343 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3344 | GLint GL_APIENTRY glGetUniformLocation(GLuint program, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3345 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3346 | 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] | 3347 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3348 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3349 | if (context) |
| 3350 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3351 | if (strstr(name, "gl_") == name) |
| 3352 | { |
| 3353 | return -1; |
| 3354 | } |
| 3355 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3356 | gl::Program *programObject = context->getProgram(program); |
| 3357 | |
| 3358 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3359 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3360 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3361 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3362 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3363 | return -1; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3364 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3365 | else |
| 3366 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3367 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3368 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3369 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3370 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3371 | |
| 3372 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 3373 | if (!programObject->isLinked() || !programBinary) |
| 3374 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3375 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3376 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3377 | } |
| 3378 | |
| 3379 | return programBinary->getUniformLocation(name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3380 | } |
| 3381 | |
| 3382 | return -1; |
| 3383 | } |
| 3384 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3385 | void GL_APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3386 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3387 | 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] | 3388 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3389 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3390 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3391 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3392 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3393 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3394 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3395 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3396 | } |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3397 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3398 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3399 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3400 | { |
| 3401 | return; |
| 3402 | } |
daniel@transgaming.com | 428d158 | 2010-05-04 03:35:25 +0000 | [diff] [blame] | 3403 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3404 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 3405 | { |
| 3406 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 3407 | for (int i = 0; i < 4; ++i) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3408 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3409 | params[i] = currentValueData.FloatValues[i]; |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3410 | } |
| 3411 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3412 | else |
| 3413 | { |
| 3414 | *params = gl::QuerySingleVertexAttributeParameter<GLfloat>(attribState, pname); |
| 3415 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3416 | } |
| 3417 | } |
| 3418 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3419 | void GL_APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3420 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3421 | 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] | 3422 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3423 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3424 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3425 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3426 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3427 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3428 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3429 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3430 | } |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3431 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3432 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
daniel@transgaming.com | 428d158 | 2010-05-04 03:35:25 +0000 | [diff] [blame] | 3433 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3434 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3435 | { |
| 3436 | return; |
| 3437 | } |
Jamie Madill | aff7150 | 2013-07-02 11:57:05 -0400 | [diff] [blame] | 3438 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3439 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 3440 | { |
| 3441 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 3442 | for (int i = 0; i < 4; ++i) |
Jamie Madill | aff7150 | 2013-07-02 11:57:05 -0400 | [diff] [blame] | 3443 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3444 | float currentValue = currentValueData.FloatValues[i]; |
| 3445 | params[i] = gl::iround<GLint>(currentValue); |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3446 | } |
| 3447 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3448 | else |
| 3449 | { |
| 3450 | *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname); |
| 3451 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3452 | } |
| 3453 | } |
| 3454 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3455 | void GL_APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3456 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3457 | 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] | 3458 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3459 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3460 | if (context) |
| 3461 | { |
| 3462 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3463 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3464 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3465 | return; |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3466 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3467 | |
| 3468 | if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER) |
| 3469 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3470 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3471 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3472 | } |
| 3473 | |
| 3474 | *pointer = const_cast<GLvoid*>(context->getState().getVertexAttribPointer(index)); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3475 | } |
| 3476 | } |
| 3477 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3478 | void GL_APIENTRY glHint(GLenum target, GLenum mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3479 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3480 | EVENT("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3481 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3482 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3483 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3484 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3485 | switch (mode) |
| 3486 | { |
| 3487 | case GL_FASTEST: |
| 3488 | case GL_NICEST: |
| 3489 | case GL_DONT_CARE: |
| 3490 | break; |
| 3491 | |
| 3492 | default: |
| 3493 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3494 | return; |
| 3495 | } |
| 3496 | |
| 3497 | switch (target) |
| 3498 | { |
| 3499 | case GL_GENERATE_MIPMAP_HINT: |
| 3500 | context->getState().setGenerateMipmapHint(mode); |
| 3501 | break; |
| 3502 | |
| 3503 | case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: |
| 3504 | context->getState().setFragmentShaderDerivativeHint(mode); |
| 3505 | break; |
| 3506 | |
| 3507 | default: |
| 3508 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3509 | return; |
| 3510 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3511 | } |
| 3512 | } |
| 3513 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3514 | GLboolean GL_APIENTRY glIsBuffer(GLuint buffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3515 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3516 | EVENT("(GLuint buffer = %d)", buffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3517 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3518 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3519 | if (context && buffer) |
| 3520 | { |
| 3521 | gl::Buffer *bufferObject = context->getBuffer(buffer); |
| 3522 | |
| 3523 | if (bufferObject) |
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 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3526 | } |
| 3527 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3528 | |
| 3529 | return GL_FALSE; |
| 3530 | } |
| 3531 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3532 | GLboolean GL_APIENTRY glIsEnabled(GLenum cap) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3533 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3534 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +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 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3540 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3541 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3542 | return GL_FALSE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3543 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3544 | |
| 3545 | return context->getState().getEnableFeature(cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3546 | } |
| 3547 | |
| 3548 | return false; |
| 3549 | } |
| 3550 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3551 | GLboolean GL_APIENTRY glIsFenceNV(GLuint fence) |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3552 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3553 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3554 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3555 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3556 | if (context) |
| 3557 | { |
| 3558 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 3559 | |
| 3560 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3561 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3562 | return GL_FALSE; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3563 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3564 | |
| 3565 | return fenceObject->isFence(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3566 | } |
| 3567 | |
| 3568 | return GL_FALSE; |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3569 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3570 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3571 | GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3572 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3573 | EVENT("(GLuint framebuffer = %d)", framebuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3574 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3575 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3576 | if (context && framebuffer) |
| 3577 | { |
| 3578 | gl::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer); |
| 3579 | |
| 3580 | if (framebufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3581 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3582 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3583 | } |
| 3584 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3585 | |
| 3586 | return GL_FALSE; |
| 3587 | } |
| 3588 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3589 | GLboolean GL_APIENTRY glIsProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3590 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3591 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3592 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3593 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3594 | if (context && program) |
| 3595 | { |
| 3596 | gl::Program *programObject = context->getProgram(program); |
| 3597 | |
| 3598 | if (programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3599 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3600 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3601 | } |
| 3602 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3603 | |
| 3604 | return GL_FALSE; |
| 3605 | } |
| 3606 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3607 | GLboolean GL_APIENTRY glIsQueryEXT(GLuint id) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 3608 | { |
| 3609 | EVENT("(GLuint id = %d)", id); |
| 3610 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3611 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3612 | if (context) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 3613 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3614 | 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] | 3615 | } |
| 3616 | |
| 3617 | return GL_FALSE; |
| 3618 | } |
| 3619 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3620 | GLboolean GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3621 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3622 | EVENT("(GLuint renderbuffer = %d)", renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3623 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3624 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3625 | if (context && renderbuffer) |
| 3626 | { |
| 3627 | gl::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer); |
| 3628 | |
| 3629 | if (renderbufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3630 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3631 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3632 | } |
| 3633 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3634 | |
| 3635 | return GL_FALSE; |
| 3636 | } |
| 3637 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3638 | GLboolean GL_APIENTRY glIsShader(GLuint shader) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3639 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3640 | EVENT("(GLuint shader = %d)", shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3641 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3642 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3643 | if (context && shader) |
| 3644 | { |
| 3645 | gl::Shader *shaderObject = context->getShader(shader); |
| 3646 | |
| 3647 | if (shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3648 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3649 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3650 | } |
| 3651 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3652 | |
| 3653 | return GL_FALSE; |
| 3654 | } |
| 3655 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3656 | GLboolean GL_APIENTRY glIsTexture(GLuint texture) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3657 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3658 | EVENT("(GLuint texture = %d)", texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3659 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3660 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3661 | if (context && texture) |
| 3662 | { |
| 3663 | gl::Texture *textureObject = context->getTexture(texture); |
| 3664 | |
| 3665 | if (textureObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3666 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3667 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3668 | } |
| 3669 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3670 | |
| 3671 | return GL_FALSE; |
| 3672 | } |
| 3673 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3674 | void GL_APIENTRY glLineWidth(GLfloat width) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3675 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3676 | EVENT("(GLfloat width = %f)", width); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3677 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3678 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3679 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3680 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3681 | if (width <= 0.0f) |
| 3682 | { |
| 3683 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3684 | return; |
| 3685 | } |
| 3686 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3687 | context->getState().setLineWidth(width); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3688 | } |
| 3689 | } |
| 3690 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3691 | void GL_APIENTRY glLinkProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3692 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3693 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3694 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3695 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3696 | if (context) |
| 3697 | { |
| 3698 | gl::Program *programObject = context->getProgram(program); |
| 3699 | |
| 3700 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3701 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3702 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3703 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3704 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3705 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3706 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3707 | else |
| 3708 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3709 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3710 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3711 | } |
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 | |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 3714 | gl::Error error = context->linkProgram(program); |
| 3715 | if (error.isError()) |
| 3716 | { |
| 3717 | context->recordError(error); |
| 3718 | return; |
| 3719 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3720 | } |
| 3721 | } |
| 3722 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3723 | void GL_APIENTRY glPixelStorei(GLenum pname, GLint param) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3724 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3725 | EVENT("(GLenum pname = 0x%X, GLint param = %d)", pname, param); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3726 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3727 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3728 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3729 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3730 | switch (pname) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3731 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3732 | case GL_UNPACK_ALIGNMENT: |
| 3733 | if (param != 1 && param != 2 && param != 4 && param != 8) |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3734 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3735 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3736 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3737 | } |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3738 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3739 | context->getState().setUnpackAlignment(param); |
| 3740 | break; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3741 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3742 | case GL_PACK_ALIGNMENT: |
| 3743 | if (param != 1 && param != 2 && param != 4 && param != 8) |
| 3744 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3745 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3746 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3747 | } |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3748 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3749 | context->getState().setPackAlignment(param); |
| 3750 | break; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3751 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3752 | case GL_PACK_REVERSE_ROW_ORDER_ANGLE: |
| 3753 | context->getState().setPackReverseRowOrder(param != 0); |
| 3754 | break; |
bsalomon@google.com | 56d46ab | 2011-11-23 14:53:10 +0000 | [diff] [blame] | 3755 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3756 | case GL_UNPACK_IMAGE_HEIGHT: |
| 3757 | case GL_UNPACK_SKIP_IMAGES: |
| 3758 | case GL_UNPACK_ROW_LENGTH: |
| 3759 | case GL_UNPACK_SKIP_ROWS: |
| 3760 | case GL_UNPACK_SKIP_PIXELS: |
| 3761 | case GL_PACK_ROW_LENGTH: |
| 3762 | case GL_PACK_SKIP_ROWS: |
| 3763 | case GL_PACK_SKIP_PIXELS: |
| 3764 | if (context->getClientVersion() < 3) |
| 3765 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3766 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3767 | return; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3768 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3769 | UNIMPLEMENTED(); |
| 3770 | break; |
| 3771 | |
| 3772 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3773 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3774 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3775 | } |
| 3776 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3777 | } |
| 3778 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3779 | void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3780 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3781 | EVENT("(GLfloat factor = %f, GLfloat units = %f)", factor, units); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3782 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3783 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3784 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3785 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3786 | context->getState().setPolygonOffsetParams(factor, units); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3787 | } |
| 3788 | } |
| 3789 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3790 | 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] | 3791 | GLenum format, GLenum type, GLsizei bufSize, |
| 3792 | GLvoid *data) |
| 3793 | { |
| 3794 | EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, " |
| 3795 | "GLenum format = 0x%X, GLenum type = 0x%X, GLsizei bufSize = 0x%d, GLvoid *data = 0x%0.8p)", |
| 3796 | x, y, width, height, format, type, bufSize, data); |
| 3797 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3798 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3799 | if (context) |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3800 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3801 | if (width < 0 || height < 0 || bufSize < 0) |
| 3802 | { |
| 3803 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3804 | return; |
| 3805 | } |
| 3806 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3807 | if (!gl::ValidateReadPixelsParameters(context, x, y, width, height, |
| 3808 | format, type, &bufSize, data)) |
| 3809 | { |
| 3810 | return; |
| 3811 | } |
| 3812 | |
Geoff Lang | 63d2fc7 | 2014-07-25 14:51:41 -0400 | [diff] [blame] | 3813 | gl::Error error = context->readPixels(x, y, width, height, format, type, &bufSize, data); |
| 3814 | if (error.isError()) |
| 3815 | { |
| 3816 | context->recordError(error); |
| 3817 | return; |
| 3818 | } |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3819 | } |
| 3820 | } |
| 3821 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3822 | 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] | 3823 | GLenum format, GLenum type, GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3824 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3825 | 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] | 3826 | "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] | 3827 | x, y, width, height, format, type, pixels); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3828 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3829 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3830 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3831 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3832 | if (width < 0 || height < 0) |
| 3833 | { |
| 3834 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3835 | return; |
| 3836 | } |
| 3837 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3838 | if (!gl::ValidateReadPixelsParameters(context, x, y, width, height, |
| 3839 | format, type, NULL, pixels)) |
| 3840 | { |
| 3841 | return; |
| 3842 | } |
| 3843 | |
Geoff Lang | 63d2fc7 | 2014-07-25 14:51:41 -0400 | [diff] [blame] | 3844 | gl::Error error = context->readPixels(x, y, width, height, format, type, NULL, pixels); |
| 3845 | if (error.isError()) |
| 3846 | { |
| 3847 | context->recordError(error); |
| 3848 | return; |
| 3849 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3850 | } |
| 3851 | } |
| 3852 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3853 | void GL_APIENTRY glReleaseShaderCompiler(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3854 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3855 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3856 | |
Brandon Jones | f05cdee | 2014-08-27 15:24:07 -0700 | [diff] [blame] | 3857 | gl::Context *context = gl::getNonLostContext(); |
| 3858 | |
| 3859 | if (context) |
| 3860 | { |
| 3861 | context->releaseShaderCompiler(); |
| 3862 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3863 | } |
| 3864 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3865 | 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] | 3866 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3867 | 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] | 3868 | target, samples, internalformat, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3869 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3870 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3871 | if (context) |
| 3872 | { |
| 3873 | if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat, |
| 3874 | width, height, true)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3875 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3876 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3877 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3878 | |
Shannon Woods | e2632d2 | 2014-10-17 13:08:51 -0400 | [diff] [blame^] | 3879 | gl::Renderbuffer *renderbuffer = context->getState().getCurrentRenderbuffer(); |
| 3880 | renderbuffer->setStorage(width, height, internalformat, samples); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3881 | } |
| 3882 | } |
| 3883 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3884 | 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] | 3885 | { |
| 3886 | glRenderbufferStorageMultisampleANGLE(target, 0, internalformat, width, height); |
| 3887 | } |
| 3888 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3889 | void GL_APIENTRY glSampleCoverage(GLclampf value, GLboolean invert) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3890 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 3891 | EVENT("(GLclampf value = %f, GLboolean invert = %u)", value, invert); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3892 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3893 | gl::Context* context = gl::getNonLostContext(); |
daniel@transgaming.com | fab5a1a | 2010-03-11 19:22:30 +0000 | [diff] [blame] | 3894 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3895 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3896 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3897 | context->getState().setSampleCoverageParams(gl::clamp01(value), invert == GL_TRUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3898 | } |
| 3899 | } |
| 3900 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3901 | void GL_APIENTRY glSetFenceNV(GLuint fence, GLenum condition) |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3902 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3903 | EVENT("(GLuint fence = %d, GLenum condition = 0x%X)", fence, condition); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3904 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3905 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3906 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3907 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3908 | if (condition != GL_ALL_COMPLETED_NV) |
| 3909 | { |
| 3910 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3911 | return; |
| 3912 | } |
| 3913 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3914 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 3915 | |
| 3916 | if (fenceObject == NULL) |
| 3917 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3918 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3919 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3920 | } |
| 3921 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 3922 | gl::Error error = fenceObject->setFence(condition); |
| 3923 | if (error.isError()) |
| 3924 | { |
| 3925 | context->recordError(error); |
| 3926 | return; |
| 3927 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3928 | } |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3929 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3930 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3931 | 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] | 3932 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3933 | 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] | 3934 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3935 | gl::Context* context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3936 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3937 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3938 | if (width < 0 || height < 0) |
| 3939 | { |
| 3940 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3941 | return; |
| 3942 | } |
| 3943 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3944 | context->getState().setScissorParams(x, y, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3945 | } |
| 3946 | } |
| 3947 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3948 | 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] | 3949 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3950 | 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] | 3951 | "const GLvoid* binary = 0x%0.8p, GLsizei length = %d)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 3952 | n, shaders, binaryformat, binary, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3953 | |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 3954 | gl::Context* context = gl::getNonLostContext(); |
| 3955 | if (context) |
| 3956 | { |
| 3957 | const std::vector<GLenum> &shaderBinaryFormats = context->getCaps().shaderBinaryFormats; |
| 3958 | if (std::find(shaderBinaryFormats.begin(), shaderBinaryFormats.end(), binaryformat) == shaderBinaryFormats.end()) |
| 3959 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3960 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3961 | return; |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 3962 | } |
| 3963 | |
| 3964 | // No binary shader formats are supported. |
| 3965 | UNIMPLEMENTED(); |
| 3966 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3967 | } |
| 3968 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3969 | 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] | 3970 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3971 | 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] | 3972 | shader, count, string, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3973 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3974 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3975 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3976 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3977 | if (count < 0) |
| 3978 | { |
| 3979 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3980 | return; |
| 3981 | } |
| 3982 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3983 | gl::Shader *shaderObject = context->getShader(shader); |
| 3984 | |
| 3985 | if (!shaderObject) |
| 3986 | { |
| 3987 | if (context->getProgram(shader)) |
| 3988 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3989 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3990 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3991 | } |
| 3992 | else |
| 3993 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3994 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3995 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3996 | } |
| 3997 | } |
| 3998 | |
| 3999 | shaderObject->setSource(count, string, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4000 | } |
| 4001 | } |
| 4002 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4003 | void GL_APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4004 | { |
daniel@transgaming.com | fab5a1a | 2010-03-11 19:22:30 +0000 | [diff] [blame] | 4005 | glStencilFuncSeparate(GL_FRONT_AND_BACK, func, ref, mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4006 | } |
| 4007 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4008 | 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] | 4009 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4010 | 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] | 4011 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4012 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4013 | if (context) |
| 4014 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4015 | switch (face) |
| 4016 | { |
| 4017 | case GL_FRONT: |
| 4018 | case GL_BACK: |
| 4019 | case GL_FRONT_AND_BACK: |
| 4020 | break; |
| 4021 | |
| 4022 | default: |
| 4023 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4024 | return; |
| 4025 | } |
| 4026 | |
| 4027 | switch (func) |
| 4028 | { |
| 4029 | case GL_NEVER: |
| 4030 | case GL_ALWAYS: |
| 4031 | case GL_LESS: |
| 4032 | case GL_LEQUAL: |
| 4033 | case GL_EQUAL: |
| 4034 | case GL_GEQUAL: |
| 4035 | case GL_GREATER: |
| 4036 | case GL_NOTEQUAL: |
| 4037 | break; |
| 4038 | |
| 4039 | default: |
| 4040 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4041 | return; |
| 4042 | } |
| 4043 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4044 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 4045 | { |
| 4046 | context->getState().setStencilParams(func, ref, mask); |
| 4047 | } |
| 4048 | |
| 4049 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 4050 | { |
| 4051 | context->getState().setStencilBackParams(func, ref, mask); |
| 4052 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4053 | } |
| 4054 | } |
| 4055 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4056 | void GL_APIENTRY glStencilMask(GLuint mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4057 | { |
| 4058 | glStencilMaskSeparate(GL_FRONT_AND_BACK, mask); |
| 4059 | } |
| 4060 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4061 | void GL_APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4062 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4063 | EVENT("(GLenum face = 0x%X, GLuint mask = %d)", face, mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4064 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4065 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4066 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4067 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4068 | switch (face) |
| 4069 | { |
| 4070 | case GL_FRONT: |
| 4071 | case GL_BACK: |
| 4072 | case GL_FRONT_AND_BACK: |
| 4073 | break; |
| 4074 | |
| 4075 | default: |
| 4076 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4077 | return; |
| 4078 | } |
| 4079 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4080 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 4081 | { |
| 4082 | context->getState().setStencilWritemask(mask); |
| 4083 | } |
| 4084 | |
| 4085 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 4086 | { |
| 4087 | context->getState().setStencilBackWritemask(mask); |
| 4088 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4089 | } |
| 4090 | } |
| 4091 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4092 | void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4093 | { |
| 4094 | glStencilOpSeparate(GL_FRONT_AND_BACK, fail, zfail, zpass); |
| 4095 | } |
| 4096 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4097 | 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] | 4098 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4099 | 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] | 4100 | face, fail, zfail, zpass); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4101 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4102 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4103 | if (context) |
| 4104 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4105 | switch (face) |
| 4106 | { |
| 4107 | case GL_FRONT: |
| 4108 | case GL_BACK: |
| 4109 | case GL_FRONT_AND_BACK: |
| 4110 | break; |
| 4111 | |
| 4112 | default: |
| 4113 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4114 | return; |
| 4115 | } |
| 4116 | |
| 4117 | switch (fail) |
| 4118 | { |
| 4119 | case GL_ZERO: |
| 4120 | case GL_KEEP: |
| 4121 | case GL_REPLACE: |
| 4122 | case GL_INCR: |
| 4123 | case GL_DECR: |
| 4124 | case GL_INVERT: |
| 4125 | case GL_INCR_WRAP: |
| 4126 | case GL_DECR_WRAP: |
| 4127 | break; |
| 4128 | |
| 4129 | default: |
| 4130 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4131 | return; |
| 4132 | } |
| 4133 | |
| 4134 | switch (zfail) |
| 4135 | { |
| 4136 | case GL_ZERO: |
| 4137 | case GL_KEEP: |
| 4138 | case GL_REPLACE: |
| 4139 | case GL_INCR: |
| 4140 | case GL_DECR: |
| 4141 | case GL_INVERT: |
| 4142 | case GL_INCR_WRAP: |
| 4143 | case GL_DECR_WRAP: |
| 4144 | break; |
| 4145 | |
| 4146 | default: |
| 4147 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4148 | return; |
| 4149 | } |
| 4150 | |
| 4151 | switch (zpass) |
| 4152 | { |
| 4153 | case GL_ZERO: |
| 4154 | case GL_KEEP: |
| 4155 | case GL_REPLACE: |
| 4156 | case GL_INCR: |
| 4157 | case GL_DECR: |
| 4158 | case GL_INVERT: |
| 4159 | case GL_INCR_WRAP: |
| 4160 | case GL_DECR_WRAP: |
| 4161 | break; |
| 4162 | |
| 4163 | default: |
| 4164 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4165 | return; |
| 4166 | } |
| 4167 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4168 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 4169 | { |
| 4170 | context->getState().setStencilOperations(fail, zfail, zpass); |
| 4171 | } |
| 4172 | |
| 4173 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 4174 | { |
| 4175 | context->getState().setStencilBackOperations(fail, zfail, zpass); |
| 4176 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4177 | } |
| 4178 | } |
| 4179 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4180 | GLboolean GL_APIENTRY glTestFenceNV(GLuint fence) |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 4181 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4182 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4183 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4184 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4185 | if (context) |
| 4186 | { |
| 4187 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 4188 | |
| 4189 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4190 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4191 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4192 | return GL_TRUE; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4193 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4194 | |
| 4195 | if (fenceObject->isFence() != GL_TRUE) |
| 4196 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4197 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4198 | return GL_TRUE; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4199 | } |
| 4200 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 4201 | GLboolean result; |
| 4202 | gl::Error error = fenceObject->testFence(&result); |
| 4203 | if (error.isError()) |
| 4204 | { |
| 4205 | context->recordError(error); |
| 4206 | return GL_TRUE; |
| 4207 | } |
| 4208 | |
| 4209 | return result; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4210 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4211 | |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4212 | return GL_TRUE; |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 4213 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4214 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4215 | 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] | 4216 | GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4217 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4218 | 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] | 4219 | "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] | 4220 | target, level, internalformat, width, height, border, format, type, pixels); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4221 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4222 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4223 | if (context) |
| 4224 | { |
| 4225 | if (context->getClientVersion() < 3 && |
| 4226 | !ValidateES2TexImageParameters(context, target, level, internalformat, false, false, |
| 4227 | 0, 0, width, height, border, format, type, pixels)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4228 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4229 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4230 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4231 | |
| 4232 | if (context->getClientVersion() >= 3 && |
| 4233 | !ValidateES3TexImageParameters(context, target, level, internalformat, false, false, |
| 4234 | 0, 0, 0, width, height, 1, border, format, type, pixels)) |
| 4235 | { |
| 4236 | return; |
| 4237 | } |
| 4238 | |
| 4239 | switch (target) |
| 4240 | { |
| 4241 | case GL_TEXTURE_2D: |
| 4242 | { |
| 4243 | gl::Texture2D *texture = context->getTexture2D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 4244 | gl::Error error = texture->setImage(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4245 | if (error.isError()) |
| 4246 | { |
| 4247 | context->recordError(error); |
| 4248 | return; |
| 4249 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4250 | } |
| 4251 | break; |
Geoff Lang | 8376cea | 2014-09-02 11:47:07 -0400 | [diff] [blame] | 4252 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4253 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4254 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4255 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4256 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4257 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4258 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 4259 | { |
| 4260 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Geoff Lang | 8376cea | 2014-09-02 11:47:07 -0400 | [diff] [blame] | 4261 | 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] | 4262 | if (error.isError()) |
| 4263 | { |
| 4264 | context->recordError(error); |
| 4265 | return; |
| 4266 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4267 | } |
| 4268 | break; |
Geoff Lang | 8376cea | 2014-09-02 11:47:07 -0400 | [diff] [blame] | 4269 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4270 | default: UNREACHABLE(); |
| 4271 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4272 | } |
| 4273 | } |
| 4274 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4275 | void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4276 | { |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4277 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %f)", target, pname, param); |
| 4278 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4279 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4280 | if (context) |
| 4281 | { |
| 4282 | if (!ValidateTexParamParameters(context, pname, static_cast<GLint>(param))) |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4283 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4284 | return; |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4285 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4286 | |
| 4287 | gl::Texture *texture = context->getTargetTexture(target); |
| 4288 | |
| 4289 | if (!texture) |
| 4290 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4291 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4292 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4293 | } |
| 4294 | |
| 4295 | switch (pname) |
| 4296 | { |
| 4297 | case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = gl::uiround<GLenum>(param); break; |
| 4298 | case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = gl::uiround<GLenum>(param); break; |
| 4299 | case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = gl::uiround<GLenum>(param); break; |
| 4300 | case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = gl::uiround<GLenum>(param); break; |
| 4301 | case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = gl::uiround<GLenum>(param); break; |
| 4302 | case GL_TEXTURE_USAGE_ANGLE: texture->setUsage(gl::uiround<GLenum>(param)); break; |
| 4303 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min(param, context->getExtensions().maxTextureAnisotropy); break; |
| 4304 | case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = gl::uiround<GLenum>(param); break; |
| 4305 | case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = gl::uiround<GLenum>(param); break; |
| 4306 | case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = gl::uiround<GLenum>(param); break; |
| 4307 | case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = gl::uiround<GLenum>(param); break; |
| 4308 | case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = gl::uiround<GLenum>(param); break; |
| 4309 | case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = gl::uiround<GLenum>(param); break; |
| 4310 | case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = gl::iround<GLint>(param); break; |
| 4311 | case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = gl::iround<GLint>(param); break; |
| 4312 | case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = param; break; |
| 4313 | case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = param; break; |
| 4314 | default: UNREACHABLE(); break; |
| 4315 | } |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4316 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4317 | } |
| 4318 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4319 | void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4320 | { |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4321 | glTexParameterf(target, pname, (GLfloat)*params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4322 | } |
| 4323 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4324 | void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4325 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4326 | 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] | 4327 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4328 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4329 | if (context) |
| 4330 | { |
| 4331 | if (!ValidateTexParamParameters(context, pname, param)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4332 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4333 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4334 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4335 | |
| 4336 | gl::Texture *texture = context->getTargetTexture(target); |
| 4337 | |
| 4338 | if (!texture) |
| 4339 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4340 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4341 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4342 | } |
| 4343 | |
| 4344 | switch (pname) |
| 4345 | { |
| 4346 | case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = (GLenum)param; break; |
| 4347 | case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = (GLenum)param; break; |
| 4348 | case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = (GLenum)param; break; |
| 4349 | case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = (GLenum)param; break; |
| 4350 | case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = (GLenum)param; break; |
| 4351 | case GL_TEXTURE_USAGE_ANGLE: texture->setUsage((GLenum)param); break; |
| 4352 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min((float)param, context->getExtensions().maxTextureAnisotropy); break; |
| 4353 | case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = (GLenum)param; break; |
| 4354 | case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = (GLenum)param; break; |
| 4355 | case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = (GLenum)param; break; |
| 4356 | case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = (GLenum)param; break; |
| 4357 | case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = (GLenum)param; break; |
| 4358 | case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = (GLenum)param; break; |
| 4359 | case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = param; break; |
| 4360 | case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = param; break; |
| 4361 | case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = (GLfloat)param; break; |
| 4362 | case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = (GLfloat)param; break; |
| 4363 | default: UNREACHABLE(); break; |
| 4364 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4365 | } |
| 4366 | } |
| 4367 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4368 | void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4369 | { |
| 4370 | glTexParameteri(target, pname, *params); |
| 4371 | } |
| 4372 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4373 | 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] | 4374 | { |
| 4375 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 4376 | target, levels, internalformat, width, height); |
| 4377 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4378 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4379 | if (context) |
| 4380 | { |
| 4381 | if (!context->getExtensions().textureStorage) |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4382 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4383 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4384 | return; |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4385 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4386 | |
| 4387 | if (context->getClientVersion() < 3 && |
| 4388 | !ValidateES2TexStorageParameters(context, target, levels, internalformat, width, height)) |
| 4389 | { |
| 4390 | return; |
| 4391 | } |
| 4392 | |
| 4393 | if (context->getClientVersion() >= 3 && |
| 4394 | !ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1)) |
| 4395 | { |
| 4396 | return; |
| 4397 | } |
| 4398 | |
| 4399 | switch (target) |
| 4400 | { |
| 4401 | case GL_TEXTURE_2D: |
| 4402 | { |
| 4403 | gl::Texture2D *texture2d = context->getTexture2D(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 4404 | gl::Error error = texture2d->storage(levels, internalformat, width, height); |
| 4405 | if (error.isError()) |
| 4406 | { |
| 4407 | context->recordError(error); |
| 4408 | return; |
| 4409 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4410 | } |
| 4411 | break; |
| 4412 | |
| 4413 | case GL_TEXTURE_CUBE_MAP: |
| 4414 | { |
| 4415 | gl::TextureCubeMap *textureCube = context->getTextureCubeMap(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 4416 | gl::Error error = textureCube->storage(levels, internalformat, width); |
| 4417 | if (error.isError()) |
| 4418 | { |
| 4419 | context->recordError(error); |
| 4420 | return; |
| 4421 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4422 | } |
| 4423 | break; |
| 4424 | |
| 4425 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4426 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4427 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4428 | } |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4429 | } |
| 4430 | } |
| 4431 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4432 | 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] | 4433 | GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4434 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4435 | 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] | 4436 | "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] | 4437 | "const GLvoid* pixels = 0x%0.8p)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4438 | target, level, xoffset, yoffset, width, height, format, type, pixels); |
| 4439 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4440 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4441 | if (context) |
| 4442 | { |
| 4443 | if (context->getClientVersion() < 3 && |
| 4444 | !ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true, |
| 4445 | xoffset, yoffset, width, height, 0, format, type, pixels)) |
daniel@transgaming.com | 00c7596 | 2010-03-11 20:36:15 +0000 | [diff] [blame] | 4446 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4447 | return; |
daniel@transgaming.com | 00c7596 | 2010-03-11 20:36:15 +0000 | [diff] [blame] | 4448 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4449 | |
| 4450 | if (context->getClientVersion() >= 3 && |
| 4451 | !ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true, |
| 4452 | xoffset, yoffset, 0, width, height, 1, 0, format, type, pixels)) |
| 4453 | { |
| 4454 | return; |
| 4455 | } |
| 4456 | |
| 4457 | // Zero sized uploads are valid but no-ops |
| 4458 | if (width == 0 || height == 0) |
| 4459 | { |
| 4460 | return; |
| 4461 | } |
| 4462 | |
| 4463 | switch (target) |
| 4464 | { |
| 4465 | case GL_TEXTURE_2D: |
| 4466 | { |
| 4467 | gl::Texture2D *texture = context->getTexture2D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 4468 | gl::Error error = texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels); |
| 4469 | if (error.isError()) |
| 4470 | { |
| 4471 | context->recordError(error); |
| 4472 | return; |
| 4473 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4474 | } |
| 4475 | break; |
| 4476 | |
| 4477 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 4478 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 4479 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 4480 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 4481 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 4482 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 4483 | { |
| 4484 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 4485 | gl::Error error = texture->subImage(target, level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels); |
| 4486 | if (error.isError()) |
| 4487 | { |
| 4488 | context->recordError(error); |
| 4489 | return; |
| 4490 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4491 | } |
| 4492 | break; |
| 4493 | |
| 4494 | default: |
| 4495 | UNREACHABLE(); |
| 4496 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4497 | } |
| 4498 | } |
| 4499 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4500 | void GL_APIENTRY glUniform1f(GLint location, GLfloat x) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4501 | { |
| 4502 | glUniform1fv(location, 1, &x); |
| 4503 | } |
| 4504 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4505 | void GL_APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4506 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4507 | 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] | 4508 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4509 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4510 | if (context) |
| 4511 | { |
| 4512 | if (!ValidateUniform(context, GL_FLOAT, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4513 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4514 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4515 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4516 | |
| 4517 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4518 | programBinary->setUniform1fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4519 | } |
| 4520 | } |
| 4521 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4522 | void GL_APIENTRY glUniform1i(GLint location, GLint x) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4523 | { |
| 4524 | glUniform1iv(location, 1, &x); |
| 4525 | } |
| 4526 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4527 | void GL_APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4528 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4529 | 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] | 4530 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4531 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4532 | if (context) |
| 4533 | { |
| 4534 | if (!ValidateUniform(context, GL_INT, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4535 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4536 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4537 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4538 | |
| 4539 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4540 | programBinary->setUniform1iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4541 | } |
| 4542 | } |
| 4543 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4544 | void GL_APIENTRY glUniform2f(GLint location, GLfloat x, GLfloat y) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4545 | { |
| 4546 | GLfloat xy[2] = {x, y}; |
| 4547 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4548 | glUniform2fv(location, 1, xy); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4549 | } |
| 4550 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4551 | void GL_APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4552 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4553 | 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] | 4554 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4555 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4556 | if (context) |
| 4557 | { |
| 4558 | if (!ValidateUniform(context, GL_FLOAT_VEC2, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4559 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4560 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4561 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4562 | |
| 4563 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4564 | programBinary->setUniform2fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4565 | } |
| 4566 | } |
| 4567 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4568 | void GL_APIENTRY glUniform2i(GLint location, GLint x, GLint y) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4569 | { |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4570 | GLint xy[2] = {x, y}; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4571 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4572 | glUniform2iv(location, 1, xy); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4573 | } |
| 4574 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4575 | void GL_APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4576 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4577 | 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] | 4578 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4579 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4580 | if (context) |
| 4581 | { |
| 4582 | if (!ValidateUniform(context, GL_INT_VEC2, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4583 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4584 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4585 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4586 | |
| 4587 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4588 | programBinary->setUniform2iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4589 | } |
| 4590 | } |
| 4591 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4592 | 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] | 4593 | { |
| 4594 | GLfloat xyz[3] = {x, y, z}; |
| 4595 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4596 | glUniform3fv(location, 1, xyz); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4597 | } |
| 4598 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4599 | void GL_APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4600 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4601 | 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] | 4602 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4603 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4604 | if (context) |
| 4605 | { |
| 4606 | if (!ValidateUniform(context, GL_FLOAT_VEC3, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4607 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4608 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4609 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4610 | |
| 4611 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4612 | programBinary->setUniform3fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4613 | } |
| 4614 | } |
| 4615 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4616 | 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] | 4617 | { |
| 4618 | GLint xyz[3] = {x, y, z}; |
| 4619 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4620 | glUniform3iv(location, 1, xyz); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4621 | } |
| 4622 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4623 | void GL_APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4624 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4625 | 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] | 4626 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4627 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4628 | if (context) |
| 4629 | { |
| 4630 | if (!ValidateUniform(context, GL_INT_VEC3, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4631 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4632 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4633 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4634 | |
| 4635 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4636 | programBinary->setUniform3iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4637 | } |
| 4638 | } |
| 4639 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4640 | 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] | 4641 | { |
| 4642 | GLfloat xyzw[4] = {x, y, z, w}; |
| 4643 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4644 | glUniform4fv(location, 1, xyzw); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4645 | } |
| 4646 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4647 | void GL_APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4648 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4649 | 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] | 4650 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4651 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4652 | if (context) |
| 4653 | { |
| 4654 | if (!ValidateUniform(context, GL_FLOAT_VEC4, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4655 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4656 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4657 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4658 | |
| 4659 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4660 | programBinary->setUniform4fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4661 | } |
| 4662 | } |
| 4663 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4664 | 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] | 4665 | { |
| 4666 | GLint xyzw[4] = {x, y, z, w}; |
| 4667 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4668 | glUniform4iv(location, 1, xyzw); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4669 | } |
| 4670 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4671 | void GL_APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4672 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4673 | 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] | 4674 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4675 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4676 | if (context) |
| 4677 | { |
| 4678 | if (!ValidateUniform(context, GL_INT_VEC4, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4679 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4680 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4681 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4682 | |
| 4683 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4684 | programBinary->setUniform4iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4685 | } |
| 4686 | } |
| 4687 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4688 | 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] | 4689 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4690 | 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] | 4691 | location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4692 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4693 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4694 | if (context) |
| 4695 | { |
| 4696 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4697 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4698 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4699 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4700 | |
| 4701 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4702 | programBinary->setUniformMatrix2fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4703 | } |
| 4704 | } |
| 4705 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4706 | 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] | 4707 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4708 | 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] | 4709 | location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4710 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4711 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4712 | if (context) |
| 4713 | { |
| 4714 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4715 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4716 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4717 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4718 | |
| 4719 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4720 | programBinary->setUniformMatrix3fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4721 | } |
| 4722 | } |
| 4723 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4724 | 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] | 4725 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4726 | 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] | 4727 | location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4728 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4729 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4730 | if (context) |
| 4731 | { |
| 4732 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4733 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4734 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4735 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4736 | |
| 4737 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4738 | programBinary->setUniformMatrix4fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4739 | } |
| 4740 | } |
| 4741 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4742 | void GL_APIENTRY glUseProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4743 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4744 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4745 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4746 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4747 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4748 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4749 | gl::Program *programObject = context->getProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4750 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4751 | if (!programObject && program != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4752 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4753 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4754 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4755 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4756 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4757 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4758 | else |
| 4759 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4760 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4761 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4762 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4763 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4764 | |
| 4765 | if (program != 0 && !programObject->isLinked()) |
| 4766 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4767 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4768 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4769 | } |
| 4770 | |
| 4771 | context->useProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4772 | } |
| 4773 | } |
| 4774 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4775 | void GL_APIENTRY glValidateProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4776 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4777 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4778 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4779 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4780 | if (context) |
| 4781 | { |
| 4782 | gl::Program *programObject = context->getProgram(program); |
| 4783 | |
| 4784 | if (!programObject) |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4785 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4786 | if (context->getShader(program)) |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4787 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4788 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4789 | return; |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4790 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4791 | else |
| 4792 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4793 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4794 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4795 | } |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4796 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4797 | |
Brandon Jones | 43a53e2 | 2014-08-28 16:23:22 -0700 | [diff] [blame] | 4798 | programObject->validate(context->getCaps()); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4799 | } |
| 4800 | } |
| 4801 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4802 | void GL_APIENTRY glVertexAttrib1f(GLuint index, GLfloat x) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4803 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4804 | EVENT("(GLuint index = %d, GLfloat x = %f)", index, x); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4805 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4806 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4807 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4808 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4809 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4810 | { |
| 4811 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4812 | return; |
| 4813 | } |
| 4814 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4815 | GLfloat vals[4] = { x, 0, 0, 1 }; |
| 4816 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4817 | } |
| 4818 | } |
| 4819 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4820 | void GL_APIENTRY glVertexAttrib1fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4821 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4822 | 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] | 4823 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4824 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4825 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4826 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4827 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4828 | { |
| 4829 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4830 | return; |
| 4831 | } |
| 4832 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4833 | GLfloat vals[4] = { values[0], 0, 0, 1 }; |
| 4834 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4835 | } |
| 4836 | } |
| 4837 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4838 | void GL_APIENTRY glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4839 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4840 | 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] | 4841 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4842 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4843 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4844 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4845 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4846 | { |
| 4847 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4848 | return; |
| 4849 | } |
| 4850 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4851 | GLfloat vals[4] = { x, y, 0, 1 }; |
| 4852 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4853 | } |
| 4854 | } |
| 4855 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4856 | void GL_APIENTRY glVertexAttrib2fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4857 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4858 | 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] | 4859 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4860 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4861 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4862 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4863 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4864 | { |
| 4865 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4866 | return; |
| 4867 | } |
| 4868 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4869 | GLfloat vals[4] = { values[0], values[1], 0, 1 }; |
| 4870 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4871 | } |
| 4872 | } |
| 4873 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4874 | 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] | 4875 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4876 | 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] | 4877 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4878 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4879 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4880 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4881 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4882 | { |
| 4883 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4884 | return; |
| 4885 | } |
| 4886 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4887 | GLfloat vals[4] = { x, y, z, 1 }; |
| 4888 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4889 | } |
| 4890 | } |
| 4891 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4892 | void GL_APIENTRY glVertexAttrib3fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4893 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4894 | 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] | 4895 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4896 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4897 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4898 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4899 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4900 | { |
| 4901 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4902 | return; |
| 4903 | } |
| 4904 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4905 | GLfloat vals[4] = { values[0], values[1], values[2], 1 }; |
| 4906 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4907 | } |
| 4908 | } |
| 4909 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4910 | 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] | 4911 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4912 | 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] | 4913 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4914 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4915 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4916 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4917 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4918 | { |
| 4919 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4920 | return; |
| 4921 | } |
| 4922 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4923 | GLfloat vals[4] = { x, y, z, w }; |
| 4924 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4925 | } |
| 4926 | } |
| 4927 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4928 | void GL_APIENTRY glVertexAttrib4fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4929 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4930 | 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] | 4931 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4932 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4933 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4934 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4935 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4936 | { |
| 4937 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4938 | return; |
| 4939 | } |
| 4940 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4941 | context->getState().setVertexAttribf(index, values); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4942 | } |
| 4943 | } |
| 4944 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4945 | void GL_APIENTRY glVertexAttribDivisorANGLE(GLuint index, GLuint divisor) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4946 | { |
| 4947 | EVENT("(GLuint index = %d, GLuint divisor = %d)", index, divisor); |
| 4948 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4949 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4950 | if (context) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4951 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4952 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4953 | { |
| 4954 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4955 | return; |
| 4956 | } |
| 4957 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4958 | context->setVertexAttribDivisor(index, divisor); |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4959 | } |
| 4960 | } |
| 4961 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4962 | 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] | 4963 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4964 | 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] | 4965 | "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] | 4966 | index, size, type, normalized, stride, ptr); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4967 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4968 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4969 | if (context) |
| 4970 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4971 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4972 | { |
| 4973 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4974 | return; |
| 4975 | } |
| 4976 | |
| 4977 | if (size < 1 || size > 4) |
| 4978 | { |
| 4979 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4980 | return; |
| 4981 | } |
| 4982 | |
| 4983 | switch (type) |
| 4984 | { |
| 4985 | case GL_BYTE: |
| 4986 | case GL_UNSIGNED_BYTE: |
| 4987 | case GL_SHORT: |
| 4988 | case GL_UNSIGNED_SHORT: |
| 4989 | case GL_FIXED: |
| 4990 | case GL_FLOAT: |
| 4991 | break; |
| 4992 | |
| 4993 | case GL_HALF_FLOAT: |
| 4994 | case GL_INT: |
| 4995 | case GL_UNSIGNED_INT: |
| 4996 | case GL_INT_2_10_10_10_REV: |
| 4997 | case GL_UNSIGNED_INT_2_10_10_10_REV: |
| 4998 | if (context->getClientVersion() < 3) |
| 4999 | { |
| 5000 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5001 | return; |
| 5002 | } |
| 5003 | break; |
| 5004 | |
| 5005 | default: |
| 5006 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5007 | return; |
| 5008 | } |
| 5009 | |
| 5010 | if (stride < 0) |
| 5011 | { |
| 5012 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5013 | return; |
| 5014 | } |
| 5015 | |
| 5016 | if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4) |
| 5017 | { |
| 5018 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5019 | return; |
| 5020 | } |
| 5021 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5022 | // [OpenGL ES 3.0.2] Section 2.8 page 24: |
| 5023 | // An INVALID_OPERATION error is generated when a non-zero vertex array object |
| 5024 | // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point, |
| 5025 | // and the pointer argument is not NULL. |
| 5026 | 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] | 5027 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5028 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5029 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 1ab57be | 2013-04-13 03:38:39 +0000 | [diff] [blame] | 5030 | } |
| 5031 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5032 | context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type, |
| 5033 | normalized == GL_TRUE, false, stride, ptr); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 5034 | } |
| 5035 | } |
| 5036 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5037 | 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] | 5038 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 5039 | 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] | 5040 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5041 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5042 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 5043 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5044 | if (width < 0 || height < 0) |
| 5045 | { |
| 5046 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5047 | return; |
| 5048 | } |
| 5049 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5050 | context->getState().setViewportParams(x, y, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 5051 | } |
| 5052 | } |
| 5053 | |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5054 | // OpenGL ES 3.0 functions |
| 5055 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5056 | void GL_APIENTRY glReadBuffer(GLenum mode) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5057 | { |
| 5058 | EVENT("(GLenum mode = 0x%X)", mode); |
| 5059 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5060 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5061 | if (context) |
| 5062 | { |
| 5063 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5064 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5065 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5066 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5067 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5068 | |
| 5069 | // glReadBuffer |
| 5070 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5071 | } |
| 5072 | } |
| 5073 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5074 | 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] | 5075 | { |
| 5076 | EVENT("(GLenum mode = 0x%X, GLuint start = %u, GLuint end = %u, GLsizei count = %d, GLenum type = 0x%X, " |
| 5077 | "const GLvoid* indices = 0x%0.8p)", mode, start, end, count, type, indices); |
| 5078 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5079 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5080 | if (context) |
| 5081 | { |
| 5082 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5083 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5084 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5085 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5086 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5087 | |
| 5088 | // glDrawRangeElements |
| 5089 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5090 | } |
| 5091 | } |
| 5092 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5093 | 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] | 5094 | { |
| 5095 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, " |
| 5096 | "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLenum format = 0x%X, " |
| 5097 | "GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", |
| 5098 | target, level, internalformat, width, height, depth, border, format, type, pixels); |
| 5099 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5100 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5101 | if (context) |
| 5102 | { |
| 5103 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5104 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5105 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5106 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5107 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5108 | |
| 5109 | // validateES3TexImageFormat sets the error code if there is an error |
| 5110 | if (!ValidateES3TexImageParameters(context, target, level, internalformat, false, false, |
| 5111 | 0, 0, 0, width, height, depth, border, format, type, pixels)) |
| 5112 | { |
| 5113 | return; |
| 5114 | } |
| 5115 | |
| 5116 | switch(target) |
| 5117 | { |
| 5118 | case GL_TEXTURE_3D: |
| 5119 | { |
| 5120 | gl::Texture3D *texture = context->getTexture3D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5121 | gl::Error error = texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 5122 | if (error.isError()) |
| 5123 | { |
| 5124 | context->recordError(error); |
| 5125 | return; |
| 5126 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5127 | } |
| 5128 | break; |
| 5129 | |
| 5130 | case GL_TEXTURE_2D_ARRAY: |
| 5131 | { |
| 5132 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5133 | gl::Error error = texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 5134 | if (error.isError()) |
| 5135 | { |
| 5136 | context->recordError(error); |
| 5137 | return; |
| 5138 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5139 | } |
| 5140 | break; |
| 5141 | |
| 5142 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5143 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5144 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5145 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5146 | } |
| 5147 | } |
| 5148 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5149 | 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] | 5150 | { |
| 5151 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5152 | "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, " |
| 5153 | "GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", |
| 5154 | target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); |
| 5155 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5156 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5157 | if (context) |
| 5158 | { |
| 5159 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5160 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5161 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5162 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5163 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5164 | |
| 5165 | // validateES3TexImageFormat sets the error code if there is an error |
| 5166 | if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true, |
| 5167 | xoffset, yoffset, zoffset, width, height, depth, 0, |
| 5168 | format, type, pixels)) |
| 5169 | { |
| 5170 | return; |
| 5171 | } |
| 5172 | |
| 5173 | // Zero sized uploads are valid but no-ops |
| 5174 | if (width == 0 || height == 0 || depth == 0) |
| 5175 | { |
| 5176 | return; |
| 5177 | } |
| 5178 | |
| 5179 | switch(target) |
| 5180 | { |
| 5181 | case GL_TEXTURE_3D: |
| 5182 | { |
| 5183 | gl::Texture3D *texture = context->getTexture3D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5184 | gl::Error error = texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels); |
| 5185 | if (error.isError()) |
| 5186 | { |
| 5187 | context->recordError(error); |
| 5188 | return; |
| 5189 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5190 | } |
| 5191 | break; |
| 5192 | |
| 5193 | case GL_TEXTURE_2D_ARRAY: |
| 5194 | { |
| 5195 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5196 | gl::Error error = texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels); |
| 5197 | if (error.isError()) |
| 5198 | { |
| 5199 | context->recordError(error); |
| 5200 | return; |
| 5201 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5202 | } |
| 5203 | break; |
| 5204 | |
| 5205 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5206 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5207 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5208 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5209 | } |
| 5210 | } |
| 5211 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5212 | void GL_APIENTRY 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] | 5213 | { |
| 5214 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5215 | "GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", |
| 5216 | target, level, xoffset, yoffset, zoffset, x, y, width, height); |
| 5217 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5218 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5219 | if (context) |
| 5220 | { |
| 5221 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5222 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5223 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5224 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5225 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5226 | |
| 5227 | if (!ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true, xoffset, yoffset, zoffset, |
| 5228 | x, y, width, height, 0)) |
| 5229 | { |
| 5230 | return; |
| 5231 | } |
| 5232 | |
| 5233 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 5234 | gl::Texture *texture = NULL; |
| 5235 | switch (target) |
| 5236 | { |
| 5237 | case GL_TEXTURE_3D: |
| 5238 | texture = context->getTexture3D(); |
| 5239 | break; |
| 5240 | |
| 5241 | case GL_TEXTURE_2D_ARRAY: |
| 5242 | texture = context->getTexture2DArray(); |
| 5243 | break; |
| 5244 | |
| 5245 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5246 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5247 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5248 | } |
| 5249 | |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 5250 | gl::Error error = texture->copySubImage(target, level, xoffset, yoffset, zoffset, x, y, width, height, framebuffer); |
| 5251 | if (error.isError()) |
| 5252 | { |
| 5253 | context->recordError(error); |
| 5254 | return; |
| 5255 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5256 | } |
| 5257 | } |
| 5258 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5259 | 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] | 5260 | { |
Geoff Lang | eef52cc | 2013-10-16 15:07:39 -0400 | [diff] [blame] | 5261 | 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] | 5262 | "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLsizei imageSize = %d, " |
| 5263 | "const GLvoid* data = 0x%0.8p)", |
| 5264 | target, level, internalformat, width, height, depth, border, imageSize, data); |
| 5265 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5266 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5267 | if (context) |
| 5268 | { |
| 5269 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5270 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5271 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5272 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5273 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5274 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 5275 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat); |
| 5276 | 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] | 5277 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5278 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5279 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5280 | } |
| 5281 | |
| 5282 | // validateES3TexImageFormat sets the error code if there is an error |
| 5283 | if (!ValidateES3TexImageParameters(context, target, level, internalformat, true, false, |
| 5284 | 0, 0, 0, width, height, depth, border, GL_NONE, GL_NONE, data)) |
| 5285 | { |
| 5286 | return; |
| 5287 | } |
| 5288 | |
| 5289 | switch(target) |
| 5290 | { |
| 5291 | case GL_TEXTURE_3D: |
| 5292 | { |
| 5293 | gl::Texture3D *texture = context->getTexture3D(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 5294 | 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] | 5295 | if (error.isError()) |
| 5296 | { |
| 5297 | context->recordError(error); |
| 5298 | return; |
| 5299 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5300 | } |
| 5301 | break; |
| 5302 | |
| 5303 | case GL_TEXTURE_2D_ARRAY: |
| 5304 | { |
| 5305 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 5306 | 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] | 5307 | if (error.isError()) |
| 5308 | { |
| 5309 | context->recordError(error); |
| 5310 | return; |
| 5311 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5312 | } |
| 5313 | break; |
| 5314 | |
| 5315 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5316 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5317 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5318 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5319 | } |
| 5320 | } |
| 5321 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5322 | 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] | 5323 | { |
| 5324 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5325 | "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, " |
| 5326 | "GLenum format = 0x%X, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
| 5327 | target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); |
| 5328 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5329 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5330 | if (context) |
| 5331 | { |
| 5332 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5333 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5334 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5335 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5336 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5337 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 5338 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format); |
| 5339 | 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] | 5340 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5341 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5342 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5343 | } |
| 5344 | |
| 5345 | if (!data) |
| 5346 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5347 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5348 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5349 | } |
| 5350 | |
| 5351 | // validateES3TexImageFormat sets the error code if there is an error |
| 5352 | if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true, |
| 5353 | 0, 0, 0, width, height, depth, 0, GL_NONE, GL_NONE, data)) |
| 5354 | { |
| 5355 | return; |
| 5356 | } |
| 5357 | |
| 5358 | // Zero sized uploads are valid but no-ops |
| 5359 | if (width == 0 || height == 0) |
| 5360 | { |
| 5361 | return; |
| 5362 | } |
| 5363 | |
| 5364 | switch(target) |
| 5365 | { |
| 5366 | case GL_TEXTURE_3D: |
| 5367 | { |
| 5368 | gl::Texture3D *texture = context->getTexture3D(); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5369 | gl::Error error = texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 5370 | format, imageSize, context->getState().getUnpackState(), data); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5371 | if (error.isError()) |
| 5372 | { |
| 5373 | context->recordError(error); |
| 5374 | return; |
| 5375 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5376 | } |
| 5377 | break; |
| 5378 | |
| 5379 | case GL_TEXTURE_2D_ARRAY: |
| 5380 | { |
| 5381 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5382 | gl::Error error = texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame] | 5383 | format, imageSize, context->getState().getUnpackState(), data); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5384 | if (error.isError()) |
| 5385 | { |
| 5386 | context->recordError(error); |
| 5387 | return; |
| 5388 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5389 | } |
| 5390 | break; |
| 5391 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5392 | default: |
| 5393 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5394 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5395 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5396 | } |
| 5397 | } |
| 5398 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5399 | void GL_APIENTRY glGenQueries(GLsizei n, GLuint* ids) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5400 | { |
| 5401 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 5402 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5403 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5404 | if (context) |
| 5405 | { |
| 5406 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5407 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5408 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5409 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5410 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5411 | |
| 5412 | if (n < 0) |
| 5413 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5414 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5415 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5416 | } |
| 5417 | |
| 5418 | for (GLsizei i = 0; i < n; i++) |
| 5419 | { |
| 5420 | ids[i] = context->createQuery(); |
| 5421 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5422 | } |
| 5423 | } |
| 5424 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5425 | 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] | 5426 | { |
| 5427 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 5428 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5429 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5430 | if (context) |
| 5431 | { |
| 5432 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5433 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5434 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5435 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5436 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5437 | |
| 5438 | if (n < 0) |
| 5439 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5440 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5441 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5442 | } |
| 5443 | |
| 5444 | for (GLsizei i = 0; i < n; i++) |
| 5445 | { |
| 5446 | context->deleteQuery(ids[i]); |
| 5447 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5448 | } |
| 5449 | } |
| 5450 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5451 | GLboolean GL_APIENTRY glIsQuery(GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5452 | { |
| 5453 | EVENT("(GLuint id = %u)", id); |
| 5454 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5455 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5456 | if (context) |
| 5457 | { |
| 5458 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5459 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5460 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5461 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5462 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5463 | |
| 5464 | 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] | 5465 | } |
| 5466 | |
| 5467 | return GL_FALSE; |
| 5468 | } |
| 5469 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5470 | void GL_APIENTRY glBeginQuery(GLenum target, GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5471 | { |
| 5472 | EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id); |
| 5473 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5474 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5475 | if (context) |
| 5476 | { |
| 5477 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5478 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5479 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5480 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5481 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5482 | |
| 5483 | if (!ValidateBeginQuery(context, target, id)) |
| 5484 | { |
| 5485 | return; |
| 5486 | } |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5487 | |
| 5488 | gl::Error error = context->beginQuery(target, id); |
| 5489 | if (error.isError()) |
| 5490 | { |
| 5491 | context->recordError(error); |
| 5492 | return; |
| 5493 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5494 | } |
| 5495 | } |
| 5496 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5497 | void GL_APIENTRY glEndQuery(GLenum target) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5498 | { |
| 5499 | EVENT("(GLenum target = 0x%X)", target); |
| 5500 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5501 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5502 | if (context) |
| 5503 | { |
| 5504 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5505 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5506 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5507 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5508 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5509 | |
| 5510 | if (!ValidateEndQuery(context, target)) |
| 5511 | { |
| 5512 | return; |
| 5513 | } |
| 5514 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5515 | gl::Error error = context->endQuery(target); |
| 5516 | if (error.isError()) |
| 5517 | { |
| 5518 | context->recordError(error); |
| 5519 | return; |
| 5520 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5521 | } |
| 5522 | } |
| 5523 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5524 | 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] | 5525 | { |
| 5526 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params); |
| 5527 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5528 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5529 | if (context) |
| 5530 | { |
| 5531 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5532 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5533 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5534 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5535 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5536 | |
| 5537 | if (!ValidQueryType(context, target)) |
| 5538 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5539 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5540 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5541 | } |
| 5542 | |
| 5543 | switch (pname) |
| 5544 | { |
| 5545 | case GL_CURRENT_QUERY: |
| 5546 | params[0] = static_cast<GLint>(context->getState().getActiveQueryId(target)); |
| 5547 | break; |
| 5548 | |
| 5549 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5550 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5551 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5552 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5553 | } |
| 5554 | } |
| 5555 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5556 | 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] | 5557 | { |
| 5558 | EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", id, pname, params); |
| 5559 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5560 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5561 | if (context) |
| 5562 | { |
| 5563 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5564 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5565 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5566 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5567 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5568 | |
| 5569 | gl::Query *queryObject = context->getQuery(id, false, GL_NONE); |
| 5570 | |
| 5571 | if (!queryObject) |
| 5572 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5573 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5574 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5575 | } |
| 5576 | |
| 5577 | if (context->getState().getActiveQueryId(queryObject->getType()) == id) |
| 5578 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5579 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5580 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5581 | } |
| 5582 | |
| 5583 | switch(pname) |
| 5584 | { |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5585 | case GL_QUERY_RESULT_EXT: |
| 5586 | { |
| 5587 | gl::Error error = queryObject->getResult(params); |
| 5588 | if (error.isError()) |
| 5589 | { |
| 5590 | context->recordError(error); |
| 5591 | return; |
| 5592 | } |
| 5593 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5594 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5595 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5596 | case GL_QUERY_RESULT_AVAILABLE_EXT: |
| 5597 | { |
| 5598 | gl::Error error = queryObject->isResultAvailable(params); |
| 5599 | if (error.isError()) |
| 5600 | { |
| 5601 | context->recordError(error); |
| 5602 | return; |
| 5603 | } |
| 5604 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5605 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5606 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5607 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5608 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5609 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5610 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5611 | } |
| 5612 | } |
| 5613 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5614 | GLboolean GL_APIENTRY glUnmapBuffer(GLenum target) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5615 | { |
| 5616 | EVENT("(GLenum target = 0x%X)", target); |
| 5617 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5618 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5619 | if (context) |
| 5620 | { |
| 5621 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5622 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5623 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5624 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5625 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5626 | |
| 5627 | return glUnmapBufferOES(target); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5628 | } |
| 5629 | |
| 5630 | return GL_FALSE; |
| 5631 | } |
| 5632 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5633 | 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] | 5634 | { |
| 5635 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params); |
| 5636 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5637 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5638 | if (context) |
| 5639 | { |
| 5640 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5641 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5642 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5643 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5644 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5645 | |
| 5646 | glGetBufferPointervOES(target, pname, params); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5647 | } |
| 5648 | } |
| 5649 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5650 | 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] | 5651 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5652 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5653 | if (context) |
| 5654 | { |
| 5655 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5656 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5657 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5658 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 7948c5f | 2013-04-13 03:38:58 +0000 | [diff] [blame] | 5659 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5660 | |
| 5661 | glDrawBuffersEXT(n, bufs); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5662 | } |
| 5663 | } |
| 5664 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5665 | 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] | 5666 | { |
| 5667 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5668 | location, count, transpose, value); |
| 5669 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5670 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5671 | if (context) |
| 5672 | { |
| 5673 | 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] | 5674 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5675 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5676 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5677 | |
| 5678 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5679 | programBinary->setUniformMatrix2x3fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5680 | } |
| 5681 | } |
| 5682 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5683 | 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] | 5684 | { |
| 5685 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5686 | location, count, transpose, value); |
| 5687 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5688 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5689 | if (context) |
| 5690 | { |
| 5691 | 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] | 5692 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5693 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5694 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5695 | |
| 5696 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5697 | programBinary->setUniformMatrix3x2fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5698 | } |
| 5699 | } |
| 5700 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5701 | 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] | 5702 | { |
| 5703 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5704 | location, count, transpose, value); |
| 5705 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5706 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5707 | if (context) |
| 5708 | { |
| 5709 | 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] | 5710 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5711 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5712 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5713 | |
| 5714 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5715 | programBinary->setUniformMatrix2x4fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5716 | } |
| 5717 | } |
| 5718 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5719 | 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] | 5720 | { |
| 5721 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5722 | location, count, transpose, value); |
| 5723 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5724 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5725 | if (context) |
| 5726 | { |
| 5727 | 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] | 5728 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5729 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5730 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5731 | |
| 5732 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5733 | programBinary->setUniformMatrix4x2fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5734 | } |
| 5735 | } |
| 5736 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5737 | 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] | 5738 | { |
| 5739 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5740 | location, count, transpose, value); |
| 5741 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5742 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5743 | if (context) |
| 5744 | { |
| 5745 | 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] | 5746 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5747 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5748 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5749 | |
| 5750 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5751 | programBinary->setUniformMatrix3x4fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5752 | } |
| 5753 | } |
| 5754 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5755 | 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] | 5756 | { |
| 5757 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5758 | location, count, transpose, value); |
| 5759 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5760 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5761 | if (context) |
| 5762 | { |
| 5763 | 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] | 5764 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5765 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5766 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5767 | |
| 5768 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5769 | programBinary->setUniformMatrix4x3fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5770 | } |
| 5771 | } |
| 5772 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5773 | 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] | 5774 | { |
| 5775 | EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, GLint dstX0 = %d, " |
| 5776 | "GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, GLbitfield mask = 0x%X, GLenum filter = 0x%X)", |
| 5777 | srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 5778 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5779 | gl::Context *context = gl::getNonLostContext(); |
| 5780 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5781 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5782 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5783 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5784 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5785 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5786 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5787 | |
| 5788 | if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, |
| 5789 | dstX0, dstY0, dstX1, dstY1, mask, filter, |
| 5790 | false)) |
| 5791 | { |
| 5792 | return; |
| 5793 | } |
| 5794 | |
Geoff Lang | 6483915 | 2014-08-26 16:23:25 -0400 | [diff] [blame] | 5795 | gl::Error error = context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, |
| 5796 | mask, filter); |
| 5797 | if (error.isError()) |
| 5798 | { |
| 5799 | context->recordError(error); |
| 5800 | return; |
| 5801 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5802 | } |
| 5803 | } |
| 5804 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5805 | 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] | 5806 | { |
| 5807 | EVENT("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 5808 | target, samples, internalformat, width, height); |
| 5809 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5810 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5811 | if (context) |
| 5812 | { |
| 5813 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5814 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5815 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5816 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5817 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5818 | |
| 5819 | if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat, |
| 5820 | width, height, false)) |
| 5821 | { |
| 5822 | return; |
| 5823 | } |
| 5824 | |
Shannon Woods | e2632d2 | 2014-10-17 13:08:51 -0400 | [diff] [blame^] | 5825 | gl::Renderbuffer *renderbuffer = context->getState().getCurrentRenderbuffer(); |
| 5826 | renderbuffer->setStorage(width, height, internalformat, samples); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5827 | } |
| 5828 | } |
| 5829 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5830 | 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] | 5831 | { |
| 5832 | EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d, GLint layer = %d)", |
| 5833 | target, attachment, texture, level, layer); |
| 5834 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5835 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5836 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5837 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5838 | if (!ValidateFramebufferTextureLayer(context, target, attachment, texture, |
| 5839 | level, layer)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5840 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5841 | return; |
| 5842 | } |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5843 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5844 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 5845 | ASSERT(framebuffer); |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5846 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5847 | gl::Texture *textureObject = context->getTexture(texture); |
| 5848 | GLenum textarget = textureObject ? textureObject->getTarget() : GL_NONE; |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5849 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5850 | if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT) |
| 5851 | { |
| 5852 | const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT); |
| 5853 | framebuffer->setColorbuffer(colorAttachment, textarget, texture, level, layer); |
| 5854 | } |
| 5855 | else |
| 5856 | { |
| 5857 | switch (attachment) |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5858 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5859 | case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level, layer); break; |
| 5860 | case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level, layer); break; |
| 5861 | case GL_DEPTH_STENCIL_ATTACHMENT: framebuffer->setDepthStencilBuffer(textarget, texture, level, layer); break; |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5862 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5863 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5864 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5865 | } |
| 5866 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5867 | 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] | 5868 | { |
| 5869 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)", |
| 5870 | target, offset, length, access); |
| 5871 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5872 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5873 | if (context) |
| 5874 | { |
| 5875 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5876 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5877 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5878 | return NULL; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5879 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5880 | |
| 5881 | return glMapBufferRangeEXT(target, offset, length, access); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5882 | } |
| 5883 | |
| 5884 | return NULL; |
| 5885 | } |
| 5886 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5887 | 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] | 5888 | { |
| 5889 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length); |
| 5890 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5891 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5892 | if (context) |
| 5893 | { |
| 5894 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5895 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5896 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5897 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5898 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5899 | |
| 5900 | glFlushMappedBufferRangeEXT(target, offset, length); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5901 | } |
| 5902 | } |
| 5903 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5904 | void GL_APIENTRY glBindVertexArray(GLuint array) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5905 | { |
| 5906 | EVENT("(GLuint array = %u)", array); |
| 5907 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5908 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5909 | if (context) |
| 5910 | { |
| 5911 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5912 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5913 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5914 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5915 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5916 | |
| 5917 | gl::VertexArray *vao = context->getVertexArray(array); |
| 5918 | |
| 5919 | if (!vao) |
| 5920 | { |
| 5921 | // The default VAO should always exist |
| 5922 | ASSERT(array != 0); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5923 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5924 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5925 | } |
| 5926 | |
| 5927 | context->bindVertexArray(array); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5928 | } |
| 5929 | } |
| 5930 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5931 | 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] | 5932 | { |
| 5933 | EVENT("(GLsizei n = %d, const GLuint* arrays = 0x%0.8p)", n, arrays); |
| 5934 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5935 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5936 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5937 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5938 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5939 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5940 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5941 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5942 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5943 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5944 | if (n < 0) |
| 5945 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5946 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5947 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5948 | } |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5949 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5950 | for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) |
| 5951 | { |
| 5952 | if (arrays[arrayIndex] != 0) |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5953 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5954 | context->deleteVertexArray(arrays[arrayIndex]); |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5955 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5956 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5957 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5958 | } |
| 5959 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5960 | void GL_APIENTRY glGenVertexArrays(GLsizei n, GLuint* arrays) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5961 | { |
| 5962 | EVENT("(GLsizei n = %d, GLuint* arrays = 0x%0.8p)", n, arrays); |
| 5963 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5964 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5965 | if (context) |
| 5966 | { |
| 5967 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5968 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5969 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5970 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5971 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5972 | |
| 5973 | if (n < 0) |
| 5974 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5975 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5976 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5977 | } |
| 5978 | |
| 5979 | for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) |
| 5980 | { |
| 5981 | arrays[arrayIndex] = context->createVertexArray(); |
| 5982 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5983 | } |
| 5984 | } |
| 5985 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5986 | GLboolean GL_APIENTRY glIsVertexArray(GLuint array) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5987 | { |
| 5988 | EVENT("(GLuint array = %u)", array); |
| 5989 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5990 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5991 | if (context) |
| 5992 | { |
| 5993 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5994 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5995 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5996 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5997 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5998 | |
| 5999 | if (array == 0) |
| 6000 | { |
| 6001 | return GL_FALSE; |
| 6002 | } |
| 6003 | |
| 6004 | gl::VertexArray *vao = context->getVertexArray(array); |
| 6005 | |
| 6006 | return (vao != NULL ? GL_TRUE : GL_FALSE); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6007 | } |
| 6008 | |
| 6009 | return GL_FALSE; |
| 6010 | } |
| 6011 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6012 | 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] | 6013 | { |
| 6014 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint* data = 0x%0.8p)", |
| 6015 | target, index, data); |
| 6016 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6017 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6018 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6019 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6020 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6021 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6022 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6023 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6024 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6025 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6026 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6027 | switch (target) |
| 6028 | { |
| 6029 | case GL_TRANSFORM_FEEDBACK_BUFFER_START: |
| 6030 | case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: |
| 6031 | case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6032 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
| 6033 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6034 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6035 | return; |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6036 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6037 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6038 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6039 | case GL_UNIFORM_BUFFER_START: |
| 6040 | case GL_UNIFORM_BUFFER_SIZE: |
| 6041 | case GL_UNIFORM_BUFFER_BINDING: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6042 | if (index >= caps.maxCombinedUniformBlocks) |
| 6043 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6044 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6045 | return; |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6046 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6047 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6048 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6049 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6050 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6051 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6052 | } |
| 6053 | |
| 6054 | if (!(context->getIndexedIntegerv(target, index, data))) |
| 6055 | { |
| 6056 | GLenum nativeType; |
| 6057 | unsigned int numParams = 0; |
| 6058 | if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams)) |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6059 | { |
| 6060 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6061 | return; |
| 6062 | } |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6063 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6064 | if (numParams == 0) |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6065 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6066 | 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] | 6067 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6068 | |
| 6069 | if (nativeType == GL_INT_64_ANGLEX) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6070 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6071 | GLint64 minIntValue = static_cast<GLint64>(std::numeric_limits<int>::min()); |
| 6072 | GLint64 maxIntValue = static_cast<GLint64>(std::numeric_limits<int>::max()); |
| 6073 | GLint64 *int64Params = new GLint64[numParams]; |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6074 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6075 | context->getIndexedInteger64v(target, index, int64Params); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6076 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6077 | for (unsigned int i = 0; i < numParams; ++i) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6078 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6079 | GLint64 clampedValue = std::max(std::min(int64Params[i], maxIntValue), minIntValue); |
| 6080 | data[i] = static_cast<GLint>(clampedValue); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6081 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6082 | |
| 6083 | delete [] int64Params; |
| 6084 | } |
| 6085 | else |
| 6086 | { |
| 6087 | UNREACHABLE(); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6088 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6089 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6090 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6091 | } |
| 6092 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6093 | void GL_APIENTRY glBeginTransformFeedback(GLenum primitiveMode) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6094 | { |
| 6095 | EVENT("(GLenum primitiveMode = 0x%X)", primitiveMode); |
| 6096 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6097 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6098 | if (context) |
| 6099 | { |
| 6100 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6101 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6102 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6103 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6104 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6105 | |
| 6106 | switch (primitiveMode) |
| 6107 | { |
| 6108 | case GL_TRIANGLES: |
| 6109 | case GL_LINES: |
| 6110 | case GL_POINTS: |
| 6111 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6112 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6113 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6114 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6115 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6116 | } |
| 6117 | |
| 6118 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 6119 | ASSERT(transformFeedback != NULL); |
| 6120 | |
| 6121 | if (transformFeedback->isStarted()) |
| 6122 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6123 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6124 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6125 | } |
| 6126 | |
| 6127 | if (transformFeedback->isPaused()) |
| 6128 | { |
| 6129 | transformFeedback->resume(); |
| 6130 | } |
| 6131 | else |
| 6132 | { |
| 6133 | transformFeedback->start(primitiveMode); |
| 6134 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6135 | } |
| 6136 | } |
| 6137 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6138 | void GL_APIENTRY glEndTransformFeedback(void) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6139 | { |
| 6140 | EVENT("(void)"); |
| 6141 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6142 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6143 | if (context) |
| 6144 | { |
| 6145 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6146 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6147 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6148 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6149 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6150 | |
| 6151 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 6152 | ASSERT(transformFeedback != NULL); |
| 6153 | |
| 6154 | if (!transformFeedback->isStarted()) |
| 6155 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6156 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6157 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6158 | } |
| 6159 | |
| 6160 | transformFeedback->stop(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6161 | } |
| 6162 | } |
| 6163 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6164 | 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] | 6165 | { |
| 6166 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u, GLintptr offset = %d, GLsizeiptr size = %d)", |
| 6167 | target, index, buffer, offset, size); |
| 6168 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6169 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6170 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6171 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6172 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6173 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6174 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6175 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6176 | } |
| 6177 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6178 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6179 | switch (target) |
| 6180 | { |
| 6181 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6182 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6183 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6184 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6185 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6186 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6187 | break; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6188 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6189 | case GL_UNIFORM_BUFFER: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6190 | if (index >= caps.maxUniformBufferBindings) |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6191 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6192 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6193 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6194 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6195 | break; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6196 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6197 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6198 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6199 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6200 | } |
| 6201 | |
| 6202 | if (buffer != 0 && size <= 0) |
| 6203 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6204 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6205 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6206 | } |
| 6207 | |
| 6208 | switch (target) |
| 6209 | { |
| 6210 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 6211 | |
| 6212 | // size and offset must be a multiple of 4 |
| 6213 | 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] | 6214 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6215 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6216 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6217 | } |
| 6218 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6219 | context->bindIndexedTransformFeedbackBuffer(buffer, index, offset, size); |
| 6220 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 6221 | break; |
| 6222 | |
| 6223 | case GL_UNIFORM_BUFFER: |
| 6224 | |
| 6225 | // 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] | 6226 | if (buffer != 0 && (offset % caps.uniformBufferOffsetAlignment) != 0) |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6227 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6228 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6229 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6230 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6231 | |
| 6232 | context->bindIndexedUniformBuffer(buffer, index, offset, size); |
| 6233 | context->bindGenericUniformBuffer(buffer); |
| 6234 | break; |
| 6235 | |
| 6236 | default: |
| 6237 | UNREACHABLE(); |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6238 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6239 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6240 | } |
| 6241 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6242 | 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] | 6243 | { |
| 6244 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u)", |
| 6245 | target, index, buffer); |
| 6246 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6247 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6248 | if (context) |
| 6249 | { |
| 6250 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6251 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6252 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6253 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6254 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6255 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6256 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6257 | switch (target) |
| 6258 | { |
| 6259 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6260 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6261 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6262 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6263 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6264 | } |
| 6265 | break; |
| 6266 | |
| 6267 | case GL_UNIFORM_BUFFER: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6268 | if (index >= caps.maxUniformBufferBindings) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6269 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6270 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6271 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6272 | } |
| 6273 | break; |
| 6274 | |
| 6275 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6276 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6277 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6278 | } |
| 6279 | |
| 6280 | switch (target) |
| 6281 | { |
| 6282 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 6283 | context->bindIndexedTransformFeedbackBuffer(buffer, index, 0, 0); |
| 6284 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 6285 | break; |
| 6286 | |
| 6287 | case GL_UNIFORM_BUFFER: |
| 6288 | context->bindIndexedUniformBuffer(buffer, index, 0, 0); |
| 6289 | context->bindGenericUniformBuffer(buffer); |
| 6290 | break; |
| 6291 | |
| 6292 | default: |
| 6293 | UNREACHABLE(); |
| 6294 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6295 | } |
| 6296 | } |
| 6297 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6298 | 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] | 6299 | { |
| 6300 | EVENT("(GLuint program = %u, GLsizei count = %d, const GLchar* const* varyings = 0x%0.8p, GLenum bufferMode = 0x%X)", |
| 6301 | program, count, varyings, bufferMode); |
| 6302 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6303 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6304 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6305 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6306 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6307 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6308 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6309 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6310 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6311 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6312 | if (count < 0) |
| 6313 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6314 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6315 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6316 | } |
| 6317 | |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6318 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6319 | switch (bufferMode) |
| 6320 | { |
| 6321 | case GL_INTERLEAVED_ATTRIBS: |
| 6322 | break; |
| 6323 | case GL_SEPARATE_ATTRIBS: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6324 | if (static_cast<GLuint>(count) > caps.maxTransformFeedbackSeparateAttributes) |
Geoff Lang | 48dcae7 | 2014-02-05 16:28:24 -0500 | [diff] [blame] | 6325 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6326 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6327 | return; |
Geoff Lang | 48dcae7 | 2014-02-05 16:28:24 -0500 | [diff] [blame] | 6328 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6329 | break; |
| 6330 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6331 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6332 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6333 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6334 | |
| 6335 | if (!gl::ValidProgram(context, program)) |
| 6336 | { |
| 6337 | return; |
| 6338 | } |
| 6339 | |
| 6340 | gl::Program *programObject = context->getProgram(program); |
| 6341 | ASSERT(programObject); |
| 6342 | |
| 6343 | programObject->setTransformFeedbackVaryings(count, varyings, bufferMode); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6344 | } |
| 6345 | } |
| 6346 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6347 | 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] | 6348 | { |
| 6349 | EVENT("(GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, " |
| 6350 | "GLsizei* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)", |
| 6351 | program, index, bufSize, length, size, type, name); |
| 6352 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6353 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6354 | if (context) |
| 6355 | { |
| 6356 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6357 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6358 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6359 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6360 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6361 | |
| 6362 | if (bufSize < 0) |
| 6363 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6364 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6365 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6366 | } |
| 6367 | |
| 6368 | if (!gl::ValidProgram(context, program)) |
| 6369 | { |
| 6370 | return; |
| 6371 | } |
| 6372 | |
| 6373 | gl::Program *programObject = context->getProgram(program); |
| 6374 | ASSERT(programObject); |
| 6375 | |
| 6376 | if (index >= static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount())) |
| 6377 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6378 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6379 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6380 | } |
| 6381 | |
| 6382 | programObject->getTransformFeedbackVarying(index, bufSize, length, size, type, name); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6383 | } |
| 6384 | } |
| 6385 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6386 | 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] | 6387 | { |
| 6388 | EVENT("(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid* pointer = 0x%0.8p)", |
| 6389 | index, size, type, stride, pointer); |
| 6390 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6391 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6392 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6393 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6394 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6395 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6396 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6397 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6398 | } |
| 6399 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6400 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6401 | { |
| 6402 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6403 | return; |
| 6404 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6405 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6406 | if (size < 1 || size > 4) |
| 6407 | { |
| 6408 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6409 | return; |
| 6410 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6411 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6412 | switch (type) |
| 6413 | { |
| 6414 | case GL_BYTE: |
| 6415 | case GL_UNSIGNED_BYTE: |
| 6416 | case GL_SHORT: |
| 6417 | case GL_UNSIGNED_SHORT: |
| 6418 | case GL_INT: |
| 6419 | case GL_UNSIGNED_INT: |
| 6420 | case GL_INT_2_10_10_10_REV: |
| 6421 | case GL_UNSIGNED_INT_2_10_10_10_REV: |
| 6422 | break; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6423 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6424 | default: |
| 6425 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6426 | return; |
| 6427 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6428 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6429 | if (stride < 0) |
| 6430 | { |
| 6431 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6432 | return; |
| 6433 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6434 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6435 | if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4) |
| 6436 | { |
| 6437 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6438 | return; |
| 6439 | } |
| 6440 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6441 | // [OpenGL ES 3.0.2] Section 2.8 page 24: |
| 6442 | // An INVALID_OPERATION error is generated when a non-zero vertex array object |
| 6443 | // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point, |
| 6444 | // and the pointer argument is not NULL. |
| 6445 | 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] | 6446 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6447 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6448 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 1ab57be | 2013-04-13 03:38:39 +0000 | [diff] [blame] | 6449 | } |
| 6450 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6451 | context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type, false, true, |
| 6452 | stride, pointer); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6453 | } |
| 6454 | } |
| 6455 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6456 | 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] | 6457 | { |
| 6458 | EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 6459 | index, pname, params); |
| 6460 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6461 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6462 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6463 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6464 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6465 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6466 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6467 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6468 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6469 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6470 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6471 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6472 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6473 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6474 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6475 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6476 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6477 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6478 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6479 | { |
| 6480 | return; |
| 6481 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6482 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6483 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 6484 | { |
| 6485 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 6486 | for (int i = 0; i < 4; ++i) |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6487 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6488 | params[i] = currentValueData.IntValues[i]; |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6489 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6490 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6491 | else |
| 6492 | { |
| 6493 | *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname); |
| 6494 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6495 | } |
| 6496 | } |
| 6497 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6498 | 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] | 6499 | { |
| 6500 | EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLuint* params = 0x%0.8p)", |
| 6501 | index, pname, params); |
| 6502 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6503 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6504 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6505 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6506 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6507 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6508 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6509 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6510 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6511 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6512 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6513 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6514 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6515 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6516 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6517 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6518 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6519 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6520 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6521 | { |
| 6522 | return; |
| 6523 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6524 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6525 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 6526 | { |
| 6527 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 6528 | for (int i = 0; i < 4; ++i) |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6529 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6530 | params[i] = currentValueData.UnsignedIntValues[i]; |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6531 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6532 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6533 | else |
| 6534 | { |
| 6535 | *params = gl::QuerySingleVertexAttributeParameter<GLuint>(attribState, pname); |
| 6536 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6537 | } |
| 6538 | } |
| 6539 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6540 | 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] | 6541 | { |
| 6542 | EVENT("(GLuint index = %u, GLint x = %d, GLint y = %d, GLint z = %d, GLint w = %d)", |
| 6543 | index, x, y, z, w); |
| 6544 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6545 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6546 | if (context) |
| 6547 | { |
| 6548 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6549 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6550 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6551 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6552 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6553 | |
| 6554 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6555 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6556 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6557 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6558 | } |
| 6559 | |
| 6560 | GLint vals[4] = { x, y, z, w }; |
| 6561 | context->getState().setVertexAttribi(index, vals); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6562 | } |
| 6563 | } |
| 6564 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6565 | 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] | 6566 | { |
| 6567 | EVENT("(GLuint index = %u, GLuint x = %u, GLuint y = %u, GLuint z = %u, GLuint w = %u)", |
| 6568 | index, x, y, z, w); |
| 6569 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6570 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6571 | if (context) |
| 6572 | { |
| 6573 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6574 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6575 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6576 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6577 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6578 | |
| 6579 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6580 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6581 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6582 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6583 | } |
| 6584 | |
| 6585 | GLuint vals[4] = { x, y, z, w }; |
| 6586 | context->getState().setVertexAttribu(index, vals); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6587 | } |
| 6588 | } |
| 6589 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6590 | 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] | 6591 | { |
| 6592 | EVENT("(GLuint index = %u, const GLint* v = 0x%0.8p)", index, v); |
| 6593 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6594 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6595 | if (context) |
| 6596 | { |
| 6597 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6598 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6599 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6600 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6601 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6602 | |
| 6603 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6604 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6605 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6606 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6607 | } |
| 6608 | |
| 6609 | context->getState().setVertexAttribi(index, v); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6610 | } |
| 6611 | } |
| 6612 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6613 | 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] | 6614 | { |
| 6615 | EVENT("(GLuint index = %u, const GLuint* v = 0x%0.8p)", index, v); |
| 6616 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6617 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6618 | if (context) |
| 6619 | { |
| 6620 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6621 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6622 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6623 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6624 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6625 | |
| 6626 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6627 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6628 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6629 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6630 | } |
| 6631 | |
| 6632 | context->getState().setVertexAttribu(index, v); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6633 | } |
| 6634 | } |
| 6635 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6636 | 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] | 6637 | { |
| 6638 | EVENT("(GLuint program = %u, GLint location = %d, GLuint* params = 0x%0.8p)", |
| 6639 | program, location, params); |
| 6640 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6641 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6642 | if (context) |
| 6643 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 6644 | if (!ValidateGetUniformuiv(context, program, location, params)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6645 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 6646 | return; |
shannon.woods%transgaming.com@gtempaccount.com | e229012 | 2013-04-13 03:41:07 +0000 | [diff] [blame] | 6647 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6648 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 6649 | gl::Program *programObject = context->getProgram(program); |
| 6650 | ASSERT(programObject); |
| 6651 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 6652 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6653 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 6654 | programBinary->getUniformuiv(location, params); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6655 | } |
| 6656 | } |
| 6657 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6658 | 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] | 6659 | { |
| 6660 | EVENT("(GLuint program = %u, const GLchar *name = 0x%0.8p)", |
| 6661 | program, name); |
| 6662 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6663 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6664 | if (context) |
| 6665 | { |
| 6666 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6667 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6668 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6669 | return -1; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6670 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6671 | |
| 6672 | if (program == 0) |
| 6673 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6674 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6675 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6676 | } |
| 6677 | |
| 6678 | gl::Program *programObject = context->getProgram(program); |
| 6679 | |
| 6680 | if (!programObject || !programObject->isLinked()) |
| 6681 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6682 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6683 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6684 | } |
| 6685 | |
| 6686 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 6687 | if (!programBinary) |
| 6688 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6689 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6690 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6691 | } |
| 6692 | |
| 6693 | return programBinary->getFragDataLocation(name); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6694 | } |
| 6695 | |
| 6696 | return 0; |
| 6697 | } |
| 6698 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6699 | void GL_APIENTRY glUniform1ui(GLint location, GLuint v0) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6700 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6701 | glUniform1uiv(location, 1, &v0); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6702 | } |
| 6703 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6704 | 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] | 6705 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6706 | const GLuint xy[] = { v0, v1 }; |
| 6707 | glUniform2uiv(location, 1, xy); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6708 | } |
| 6709 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6710 | 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] | 6711 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6712 | const GLuint xyz[] = { v0, v1, v2 }; |
| 6713 | glUniform3uiv(location, 1, xyz); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6714 | } |
| 6715 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6716 | 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] | 6717 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6718 | const GLuint xyzw[] = { v0, v1, v2, v3 }; |
| 6719 | glUniform4uiv(location, 1, xyzw); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6720 | } |
| 6721 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6722 | 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] | 6723 | { |
| 6724 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6725 | location, count, value); |
| 6726 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6727 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6728 | if (context) |
| 6729 | { |
| 6730 | if (!ValidateUniform(context, GL_UNSIGNED_INT, location, count)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6731 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6732 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6733 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6734 | |
| 6735 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6736 | programBinary->setUniform1uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6737 | } |
| 6738 | } |
| 6739 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6740 | 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] | 6741 | { |
| 6742 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6743 | location, count, value); |
| 6744 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6745 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6746 | if (context) |
| 6747 | { |
| 6748 | 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] | 6749 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6750 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6751 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6752 | |
| 6753 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6754 | programBinary->setUniform2uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6755 | } |
| 6756 | } |
| 6757 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6758 | 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] | 6759 | { |
| 6760 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value)", |
| 6761 | location, count, value); |
| 6762 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6763 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6764 | if (context) |
| 6765 | { |
| 6766 | 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] | 6767 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6768 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6769 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6770 | |
| 6771 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6772 | programBinary->setUniform3uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6773 | } |
| 6774 | } |
| 6775 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6776 | 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] | 6777 | { |
| 6778 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6779 | location, count, value); |
| 6780 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6781 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6782 | if (context) |
| 6783 | { |
| 6784 | 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] | 6785 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6786 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6787 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6788 | |
| 6789 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6790 | programBinary->setUniform4uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6791 | } |
| 6792 | } |
| 6793 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6794 | 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] | 6795 | { |
| 6796 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint* value = 0x%0.8p)", |
| 6797 | buffer, drawbuffer, value); |
| 6798 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6799 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6800 | if (context) |
| 6801 | { |
| 6802 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6803 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6804 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6805 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6806 | |
| 6807 | switch (buffer) |
| 6808 | { |
| 6809 | case GL_COLOR: |
| 6810 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6811 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6812 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6813 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6814 | } |
| 6815 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6816 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6817 | case GL_STENCIL: |
| 6818 | if (drawbuffer != 0) |
| 6819 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6820 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6821 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6822 | } |
| 6823 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6824 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6825 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6826 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6827 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6828 | } |
| 6829 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6830 | gl::Error error = context->clearBufferiv(buffer, drawbuffer, value); |
| 6831 | if (error.isError()) |
| 6832 | { |
| 6833 | context->recordError(error); |
| 6834 | return; |
| 6835 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6836 | } |
| 6837 | } |
| 6838 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6839 | 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] | 6840 | { |
| 6841 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint* value = 0x%0.8p)", |
| 6842 | buffer, drawbuffer, value); |
| 6843 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6844 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6845 | if (context) |
| 6846 | { |
| 6847 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6848 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6849 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6850 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6851 | |
| 6852 | switch (buffer) |
| 6853 | { |
| 6854 | case GL_COLOR: |
| 6855 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6856 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6857 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6858 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6859 | } |
| 6860 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6861 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6862 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6863 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6864 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6865 | } |
| 6866 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6867 | gl::Error error = context->clearBufferuiv(buffer, drawbuffer, value); |
| 6868 | if (error.isError()) |
| 6869 | { |
| 6870 | context->recordError(error); |
| 6871 | return; |
| 6872 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6873 | } |
| 6874 | } |
| 6875 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6876 | 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] | 6877 | { |
| 6878 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat* value = 0x%0.8p)", |
| 6879 | buffer, drawbuffer, value); |
| 6880 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6881 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6882 | if (context) |
| 6883 | { |
| 6884 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6885 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6886 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6887 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6888 | |
| 6889 | switch (buffer) |
| 6890 | { |
| 6891 | case GL_COLOR: |
| 6892 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6893 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6894 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6895 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6896 | } |
| 6897 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6898 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6899 | case GL_DEPTH: |
| 6900 | if (drawbuffer != 0) |
| 6901 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6902 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6903 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6904 | } |
| 6905 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6906 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6907 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6908 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6909 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6910 | } |
| 6911 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6912 | gl::Error error = context->clearBufferfv(buffer, drawbuffer, value); |
| 6913 | if (error.isError()) |
| 6914 | { |
| 6915 | context->recordError(error); |
| 6916 | return; |
| 6917 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6918 | } |
| 6919 | } |
| 6920 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6921 | 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] | 6922 | { |
| 6923 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth, GLint stencil = %d)", |
| 6924 | buffer, drawbuffer, depth, stencil); |
| 6925 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6926 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6927 | if (context) |
| 6928 | { |
| 6929 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6930 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6931 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6932 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6933 | |
| 6934 | switch (buffer) |
| 6935 | { |
| 6936 | case GL_DEPTH_STENCIL: |
| 6937 | if (drawbuffer != 0) |
| 6938 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6939 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6940 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6941 | } |
| 6942 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6943 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6944 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6945 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6946 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6947 | } |
| 6948 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6949 | gl::Error error = context->clearBufferfi(buffer, drawbuffer, depth, stencil); |
| 6950 | if (error.isError()) |
| 6951 | { |
| 6952 | context->recordError(error); |
| 6953 | return; |
| 6954 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6955 | } |
| 6956 | } |
| 6957 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6958 | 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] | 6959 | { |
| 6960 | EVENT("(GLenum name = 0x%X, GLuint index = %u)", name, index); |
| 6961 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6962 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6963 | if (context) |
| 6964 | { |
| 6965 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6966 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6967 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6968 | return NULL; |
shannonwoods@chromium.org | 302df74 | 2013-05-30 00:05:54 +0000 | [diff] [blame] | 6969 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6970 | |
| 6971 | if (name != GL_EXTENSIONS) |
| 6972 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6973 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6974 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6975 | } |
| 6976 | |
| 6977 | if (index >= context->getExtensionStringCount()) |
| 6978 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6979 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6980 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6981 | } |
| 6982 | |
| 6983 | 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] | 6984 | } |
| 6985 | |
| 6986 | return NULL; |
| 6987 | } |
| 6988 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6989 | 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] | 6990 | { |
| 6991 | EVENT("(GLenum readTarget = 0x%X, GLenum writeTarget = 0x%X, GLintptr readOffset = %d, GLintptr writeOffset = %d, GLsizeiptr size = %d)", |
| 6992 | readTarget, writeTarget, readOffset, writeOffset, size); |
| 6993 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6994 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6995 | if (context) |
| 6996 | { |
| 6997 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6998 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6999 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7000 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 296c3f2 | 2013-04-13 03:39:39 +0000 | [diff] [blame] | 7001 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7002 | |
Jamie Madill | 24e8319 | 2014-10-20 11:00:53 -0400 | [diff] [blame] | 7003 | if (!gl::ValidBufferTarget(context, readTarget) || !gl::ValidBufferTarget(context, writeTarget)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7004 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7005 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7006 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7007 | } |
| 7008 | |
| 7009 | gl::Buffer *readBuffer = context->getState().getTargetBuffer(readTarget); |
| 7010 | gl::Buffer *writeBuffer = context->getState().getTargetBuffer(writeTarget); |
| 7011 | |
| 7012 | if (!readBuffer || !writeBuffer) |
| 7013 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7014 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7015 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7016 | } |
| 7017 | |
Jamie Madill | cfaaf72 | 2014-07-31 10:47:54 -0400 | [diff] [blame] | 7018 | // Verify that readBuffer and writeBuffer are not currently mapped |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7019 | if (readBuffer->isMapped() || writeBuffer->isMapped()) |
| 7020 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7021 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7022 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7023 | } |
| 7024 | |
| 7025 | if (readOffset < 0 || writeOffset < 0 || size < 0 || |
| 7026 | static_cast<unsigned int>(readOffset + size) > readBuffer->getSize() || |
| 7027 | static_cast<unsigned int>(writeOffset + size) > writeBuffer->getSize()) |
| 7028 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7029 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7030 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7031 | } |
| 7032 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7033 | if (readBuffer == writeBuffer && std::abs(readOffset - writeOffset) < size) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7034 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7035 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7036 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7037 | } |
| 7038 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7039 | // if size is zero, the copy is a successful no-op |
| 7040 | if (size > 0) |
| 7041 | { |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 7042 | gl::Error error = writeBuffer->copyBufferSubData(readBuffer, readOffset, writeOffset, size); |
| 7043 | if (error.isError()) |
| 7044 | { |
| 7045 | context->recordError(error); |
| 7046 | return; |
| 7047 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7048 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7049 | } |
| 7050 | } |
| 7051 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7052 | 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] | 7053 | { |
| 7054 | EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLchar* const* uniformNames = 0x%0.8p, GLuint* uniformIndices = 0x%0.8p)", |
| 7055 | program, uniformCount, uniformNames, uniformIndices); |
| 7056 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7057 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7058 | if (context) |
| 7059 | { |
| 7060 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7061 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7062 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7063 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7064 | } |
| 7065 | |
| 7066 | if (uniformCount < 0) |
| 7067 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7068 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7069 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7070 | } |
| 7071 | |
| 7072 | gl::Program *programObject = context->getProgram(program); |
| 7073 | |
| 7074 | if (!programObject) |
| 7075 | { |
| 7076 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7077 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7078 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7079 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7080 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7081 | else |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7082 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7083 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7084 | return; |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7085 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7086 | } |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7087 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7088 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7089 | if (!programObject->isLinked() || !programBinary) |
| 7090 | { |
| 7091 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7092 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7093 | uniformIndices[uniformId] = GL_INVALID_INDEX; |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7094 | } |
| 7095 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7096 | else |
| 7097 | { |
| 7098 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 7099 | { |
| 7100 | uniformIndices[uniformId] = programBinary->getUniformIndex(uniformNames[uniformId]); |
| 7101 | } |
| 7102 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7103 | } |
| 7104 | } |
| 7105 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7106 | 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] | 7107 | { |
| 7108 | EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLuint* uniformIndices = 0x%0.8p, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 7109 | program, uniformCount, uniformIndices, pname, params); |
| 7110 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7111 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7112 | if (context) |
| 7113 | { |
| 7114 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7115 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7116 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7117 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7118 | } |
| 7119 | |
| 7120 | if (uniformCount < 0) |
| 7121 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7122 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7123 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7124 | } |
| 7125 | |
| 7126 | gl::Program *programObject = context->getProgram(program); |
| 7127 | |
| 7128 | if (!programObject) |
| 7129 | { |
| 7130 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7131 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7132 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7133 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7134 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7135 | else |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 7136 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7137 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7138 | return; |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 7139 | } |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 7140 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7141 | |
| 7142 | switch (pname) |
| 7143 | { |
| 7144 | case GL_UNIFORM_TYPE: |
| 7145 | case GL_UNIFORM_SIZE: |
| 7146 | case GL_UNIFORM_NAME_LENGTH: |
| 7147 | case GL_UNIFORM_BLOCK_INDEX: |
| 7148 | case GL_UNIFORM_OFFSET: |
| 7149 | case GL_UNIFORM_ARRAY_STRIDE: |
| 7150 | case GL_UNIFORM_MATRIX_STRIDE: |
| 7151 | case GL_UNIFORM_IS_ROW_MAJOR: |
| 7152 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7153 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7154 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7155 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7156 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7157 | } |
| 7158 | |
| 7159 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7160 | |
| 7161 | if (!programBinary && uniformCount > 0) |
| 7162 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7163 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7164 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7165 | } |
| 7166 | |
| 7167 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 7168 | { |
| 7169 | const GLuint index = uniformIndices[uniformId]; |
| 7170 | |
| 7171 | if (index >= (GLuint)programBinary->getActiveUniformCount()) |
| 7172 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7173 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7174 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7175 | } |
| 7176 | } |
| 7177 | |
| 7178 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 7179 | { |
| 7180 | const GLuint index = uniformIndices[uniformId]; |
| 7181 | params[uniformId] = programBinary->getActiveUniformi(index, pname); |
| 7182 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7183 | } |
| 7184 | } |
| 7185 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7186 | 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] | 7187 | { |
| 7188 | EVENT("(GLuint program = %u, const GLchar* uniformBlockName = 0x%0.8p)", program, uniformBlockName); |
| 7189 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7190 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7191 | if (context) |
| 7192 | { |
| 7193 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7194 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7195 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7196 | return GL_INVALID_INDEX; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7197 | } |
| 7198 | |
| 7199 | gl::Program *programObject = context->getProgram(program); |
| 7200 | |
| 7201 | if (!programObject) |
| 7202 | { |
| 7203 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7204 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7205 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7206 | return GL_INVALID_INDEX; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7207 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7208 | else |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 7209 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7210 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7211 | return GL_INVALID_INDEX; |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 7212 | } |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 7213 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7214 | |
| 7215 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7216 | if (!programBinary) |
| 7217 | { |
| 7218 | return GL_INVALID_INDEX; |
| 7219 | } |
| 7220 | |
| 7221 | return programBinary->getUniformBlockIndex(uniformBlockName); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7222 | } |
| 7223 | |
| 7224 | return 0; |
| 7225 | } |
| 7226 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7227 | 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] | 7228 | { |
| 7229 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 7230 | program, uniformBlockIndex, pname, params); |
| 7231 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7232 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7233 | if (context) |
| 7234 | { |
| 7235 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7236 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7237 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7238 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7239 | } |
| 7240 | gl::Program *programObject = context->getProgram(program); |
| 7241 | |
| 7242 | if (!programObject) |
| 7243 | { |
| 7244 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7245 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7246 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7247 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7248 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7249 | else |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 7250 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7251 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7252 | return; |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 7253 | } |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 7254 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7255 | |
| 7256 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7257 | |
| 7258 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 7259 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7260 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7261 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7262 | } |
| 7263 | |
| 7264 | switch (pname) |
| 7265 | { |
| 7266 | case GL_UNIFORM_BLOCK_BINDING: |
| 7267 | *params = static_cast<GLint>(programObject->getUniformBlockBinding(uniformBlockIndex)); |
| 7268 | break; |
| 7269 | |
| 7270 | case GL_UNIFORM_BLOCK_DATA_SIZE: |
| 7271 | case GL_UNIFORM_BLOCK_NAME_LENGTH: |
| 7272 | case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS: |
| 7273 | case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: |
| 7274 | case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: |
| 7275 | case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: |
| 7276 | programBinary->getActiveUniformBlockiv(uniformBlockIndex, pname, params); |
| 7277 | break; |
| 7278 | |
| 7279 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7280 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7281 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7282 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7283 | } |
| 7284 | } |
| 7285 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7286 | 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] | 7287 | { |
| 7288 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLchar* uniformBlockName = 0x%0.8p)", |
| 7289 | program, uniformBlockIndex, bufSize, length, uniformBlockName); |
| 7290 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7291 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7292 | if (context) |
| 7293 | { |
| 7294 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7295 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7296 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7297 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7298 | } |
| 7299 | |
| 7300 | gl::Program *programObject = context->getProgram(program); |
| 7301 | |
| 7302 | if (!programObject) |
| 7303 | { |
| 7304 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7305 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7306 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7307 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7308 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7309 | else |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 7310 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7311 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7312 | return; |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 7313 | } |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 7314 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7315 | |
| 7316 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7317 | |
| 7318 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 7319 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7320 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7321 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7322 | } |
| 7323 | |
| 7324 | programBinary->getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7325 | } |
| 7326 | } |
| 7327 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7328 | 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] | 7329 | { |
| 7330 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLuint uniformBlockBinding = %u)", |
| 7331 | program, uniformBlockIndex, uniformBlockBinding); |
| 7332 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7333 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7334 | if (context) |
| 7335 | { |
| 7336 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7337 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7338 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7339 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7340 | } |
| 7341 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7342 | if (uniformBlockBinding >= context->getCaps().maxUniformBufferBindings) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7343 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7344 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7345 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7346 | } |
| 7347 | |
| 7348 | gl::Program *programObject = context->getProgram(program); |
| 7349 | |
| 7350 | if (!programObject) |
| 7351 | { |
| 7352 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7353 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7354 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7355 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7356 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7357 | else |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 7358 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7359 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7360 | return; |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 7361 | } |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 7362 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7363 | |
| 7364 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7365 | |
| 7366 | // if never linked, there won't be any uniform blocks |
| 7367 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 7368 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7369 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7370 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7371 | } |
| 7372 | |
| 7373 | programObject->bindUniformBlock(uniformBlockIndex, uniformBlockBinding); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7374 | } |
| 7375 | } |
| 7376 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7377 | 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] | 7378 | { |
| 7379 | EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei instanceCount = %d)", |
| 7380 | mode, first, count, instanceCount); |
| 7381 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7382 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7383 | if (context) |
| 7384 | { |
| 7385 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7386 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7387 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7388 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7389 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7390 | |
| 7391 | // glDrawArraysInstanced |
| 7392 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7393 | } |
| 7394 | } |
| 7395 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7396 | 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] | 7397 | { |
| 7398 | EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei instanceCount = %d)", |
| 7399 | mode, count, type, indices, instanceCount); |
| 7400 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7401 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7402 | if (context) |
| 7403 | { |
| 7404 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7405 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7406 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7407 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7408 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7409 | |
| 7410 | // glDrawElementsInstanced |
| 7411 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7412 | } |
| 7413 | } |
| 7414 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7415 | GLsync GL_APIENTRY glFenceSync(GLenum condition, GLbitfield flags) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7416 | { |
| 7417 | EVENT("(GLenum condition = 0x%X, GLbitfield flags = 0x%X)", condition, flags); |
| 7418 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7419 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7420 | if (context) |
| 7421 | { |
| 7422 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7423 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7424 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7425 | return 0; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7426 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7427 | |
| 7428 | if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) |
| 7429 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7430 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7431 | return 0; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7432 | } |
| 7433 | |
| 7434 | if (flags != 0) |
| 7435 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7436 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7437 | return 0; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7438 | } |
| 7439 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7440 | GLsync fenceSync = context->createFenceSync(); |
| 7441 | |
| 7442 | gl::FenceSync *fenceSyncObject = context->getFenceSync(fenceSync); |
| 7443 | gl::Error error = fenceSyncObject->set(condition); |
| 7444 | if (error.isError()) |
| 7445 | { |
| 7446 | context->deleteFenceSync(fenceSync); |
| 7447 | context->recordError(error); |
| 7448 | return NULL; |
| 7449 | } |
| 7450 | |
| 7451 | return fenceSync; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7452 | } |
| 7453 | |
| 7454 | return NULL; |
| 7455 | } |
| 7456 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7457 | GLboolean GL_APIENTRY glIsSync(GLsync sync) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7458 | { |
| 7459 | EVENT("(GLsync sync = 0x%0.8p)", sync); |
| 7460 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7461 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7462 | if (context) |
| 7463 | { |
| 7464 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7465 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7466 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7467 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7468 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7469 | |
| 7470 | return (context->getFenceSync(sync) != NULL); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7471 | } |
| 7472 | |
| 7473 | return GL_FALSE; |
| 7474 | } |
| 7475 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7476 | void GL_APIENTRY glDeleteSync(GLsync sync) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7477 | { |
| 7478 | EVENT("(GLsync sync = 0x%0.8p)", sync); |
| 7479 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7480 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7481 | if (context) |
| 7482 | { |
| 7483 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7484 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7485 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7486 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7487 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7488 | |
| 7489 | if (sync != static_cast<GLsync>(0) && !context->getFenceSync(sync)) |
| 7490 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7491 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7492 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7493 | } |
| 7494 | |
| 7495 | context->deleteFenceSync(sync); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7496 | } |
| 7497 | } |
| 7498 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7499 | 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] | 7500 | { |
| 7501 | EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", |
| 7502 | sync, flags, timeout); |
| 7503 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7504 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7505 | if (context) |
| 7506 | { |
| 7507 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7508 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7509 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7510 | return GL_WAIT_FAILED; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7511 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7512 | |
| 7513 | if ((flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0) |
| 7514 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7515 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7516 | return GL_WAIT_FAILED; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7517 | } |
| 7518 | |
| 7519 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7520 | |
| 7521 | if (!fenceSync) |
| 7522 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7523 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7524 | return GL_WAIT_FAILED; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7525 | } |
| 7526 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7527 | GLenum result = GL_WAIT_FAILED; |
| 7528 | gl::Error error = fenceSync->clientWait(flags, timeout, &result); |
| 7529 | if (error.isError()) |
| 7530 | { |
| 7531 | context->recordError(error); |
| 7532 | return GL_WAIT_FAILED; |
| 7533 | } |
| 7534 | |
| 7535 | return result; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7536 | } |
| 7537 | |
| 7538 | return GL_FALSE; |
| 7539 | } |
| 7540 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7541 | 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] | 7542 | { |
| 7543 | EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", |
| 7544 | sync, flags, timeout); |
| 7545 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7546 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7547 | if (context) |
| 7548 | { |
| 7549 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7550 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7551 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7552 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7553 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7554 | |
| 7555 | if (flags != 0) |
| 7556 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7557 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7558 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7559 | } |
| 7560 | |
| 7561 | if (timeout != GL_TIMEOUT_IGNORED) |
| 7562 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7563 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7564 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7565 | } |
| 7566 | |
| 7567 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7568 | |
| 7569 | if (!fenceSync) |
| 7570 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7571 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7572 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7573 | } |
| 7574 | |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 7575 | gl::Error error = fenceSync->serverWait(flags, timeout); |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7576 | if (error.isError()) |
| 7577 | { |
| 7578 | context->recordError(error); |
| 7579 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7580 | } |
| 7581 | } |
| 7582 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7583 | void GL_APIENTRY glGetInteger64v(GLenum pname, GLint64* params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7584 | { |
| 7585 | EVENT("(GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", |
| 7586 | pname, params); |
| 7587 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7588 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7589 | if (context) |
| 7590 | { |
| 7591 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7592 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7593 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7594 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7595 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7596 | |
| 7597 | GLenum nativeType; |
| 7598 | unsigned int numParams = 0; |
| 7599 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
| 7600 | { |
| 7601 | return; |
| 7602 | } |
| 7603 | |
| 7604 | if (nativeType == GL_INT_64_ANGLEX) |
| 7605 | { |
| 7606 | context->getInteger64v(pname, params); |
| 7607 | } |
| 7608 | else |
| 7609 | { |
| 7610 | CastStateValues(context, nativeType, pname, numParams, params); |
| 7611 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7612 | } |
| 7613 | } |
| 7614 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7615 | 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] | 7616 | { |
| 7617 | EVENT("(GLsync sync = 0x%0.8p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLint* values = 0x%0.8p)", |
| 7618 | sync, pname, bufSize, length, values); |
| 7619 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7620 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7621 | if (context) |
| 7622 | { |
| 7623 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7624 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7625 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7626 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7627 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7628 | |
| 7629 | if (bufSize < 0) |
| 7630 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7631 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7632 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7633 | } |
| 7634 | |
| 7635 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7636 | |
| 7637 | if (!fenceSync) |
| 7638 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7639 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7640 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7641 | } |
| 7642 | |
| 7643 | switch (pname) |
| 7644 | { |
| 7645 | 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] | 7646 | case GL_SYNC_CONDITION: values[0] = static_cast<GLint>(fenceSync->getCondition()); break; |
| 7647 | case GL_SYNC_FLAGS: values[0] = 0; break; |
| 7648 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7649 | case GL_SYNC_STATUS: |
| 7650 | { |
| 7651 | gl::Error error = fenceSync->getStatus(values); |
| 7652 | if (error.isError()) |
| 7653 | { |
| 7654 | context->recordError(error); |
| 7655 | return; |
| 7656 | } |
| 7657 | break; |
| 7658 | } |
| 7659 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7660 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7661 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7662 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7663 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7664 | } |
| 7665 | } |
| 7666 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7667 | 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] | 7668 | { |
| 7669 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint64* data = 0x%0.8p)", |
| 7670 | target, index, data); |
| 7671 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7672 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7673 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7674 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7675 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7676 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7677 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7678 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7679 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7680 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7681 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7682 | switch (target) |
| 7683 | { |
| 7684 | case GL_TRANSFORM_FEEDBACK_BUFFER_START: |
| 7685 | case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: |
| 7686 | case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 7687 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
| 7688 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7689 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7690 | return; |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 7691 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7692 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7693 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7694 | case GL_UNIFORM_BUFFER_START: |
| 7695 | case GL_UNIFORM_BUFFER_SIZE: |
| 7696 | case GL_UNIFORM_BUFFER_BINDING: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7697 | if (index >= caps.maxUniformBufferBindings) |
| 7698 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7699 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7700 | return; |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7701 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7702 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7703 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7704 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7705 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7706 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7707 | } |
| 7708 | |
| 7709 | if (!(context->getIndexedInteger64v(target, index, data))) |
| 7710 | { |
| 7711 | GLenum nativeType; |
| 7712 | unsigned int numParams = 0; |
| 7713 | if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams)) |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7714 | { |
| 7715 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7716 | return; |
| 7717 | } |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7718 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7719 | if (numParams == 0) |
| 7720 | return; // it is known that pname is valid, but there are no parameters to return |
| 7721 | |
| 7722 | if (nativeType == GL_INT) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7723 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7724 | GLint *intParams = new GLint[numParams]; |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7725 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7726 | context->getIndexedIntegerv(target, index, intParams); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7727 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7728 | for (unsigned int i = 0; i < numParams; ++i) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7729 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7730 | data[i] = static_cast<GLint64>(intParams[i]); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7731 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7732 | |
| 7733 | delete [] intParams; |
| 7734 | } |
| 7735 | else |
| 7736 | { |
| 7737 | UNREACHABLE(); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7738 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7739 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7740 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7741 | } |
| 7742 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7743 | 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] | 7744 | { |
| 7745 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", |
| 7746 | target, pname, params); |
| 7747 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7748 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7749 | if (context) |
| 7750 | { |
| 7751 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7752 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7753 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7754 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7755 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7756 | |
| 7757 | if (!gl::ValidBufferTarget(context, target)) |
| 7758 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7759 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7760 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7761 | } |
| 7762 | |
| 7763 | if (!gl::ValidBufferParameter(context, pname)) |
| 7764 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7765 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7766 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7767 | } |
| 7768 | |
| 7769 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 7770 | |
| 7771 | if (!buffer) |
| 7772 | { |
| 7773 | // 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] | 7774 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7775 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7776 | } |
| 7777 | |
| 7778 | switch (pname) |
| 7779 | { |
| 7780 | case GL_BUFFER_USAGE: |
| 7781 | *params = static_cast<GLint64>(buffer->getUsage()); |
| 7782 | break; |
| 7783 | case GL_BUFFER_SIZE: |
| 7784 | *params = buffer->getSize(); |
| 7785 | break; |
| 7786 | case GL_BUFFER_ACCESS_FLAGS: |
| 7787 | *params = static_cast<GLint64>(buffer->getAccessFlags()); |
| 7788 | break; |
| 7789 | case GL_BUFFER_MAPPED: |
| 7790 | *params = static_cast<GLint64>(buffer->isMapped()); |
| 7791 | break; |
| 7792 | case GL_BUFFER_MAP_OFFSET: |
| 7793 | *params = buffer->getMapOffset(); |
| 7794 | break; |
| 7795 | case GL_BUFFER_MAP_LENGTH: |
| 7796 | *params = buffer->getMapLength(); |
| 7797 | break; |
| 7798 | default: UNREACHABLE(); break; |
| 7799 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7800 | } |
| 7801 | } |
| 7802 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7803 | void GL_APIENTRY glGenSamplers(GLsizei count, GLuint* samplers) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7804 | { |
| 7805 | EVENT("(GLsizei count = %d, GLuint* samplers = 0x%0.8p)", count, samplers); |
| 7806 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7807 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7808 | if (context) |
| 7809 | { |
| 7810 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7811 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7812 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7813 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7814 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7815 | |
| 7816 | if (count < 0) |
| 7817 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7818 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7819 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7820 | } |
| 7821 | |
| 7822 | for (int i = 0; i < count; i++) |
| 7823 | { |
| 7824 | samplers[i] = context->createSampler(); |
| 7825 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7826 | } |
| 7827 | } |
| 7828 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7829 | 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] | 7830 | { |
| 7831 | EVENT("(GLsizei count = %d, const GLuint* samplers = 0x%0.8p)", count, samplers); |
| 7832 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7833 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7834 | if (context) |
| 7835 | { |
| 7836 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7837 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7838 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7839 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7840 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7841 | |
| 7842 | if (count < 0) |
| 7843 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7844 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7845 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7846 | } |
| 7847 | |
| 7848 | for (int i = 0; i < count; i++) |
| 7849 | { |
| 7850 | context->deleteSampler(samplers[i]); |
| 7851 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7852 | } |
| 7853 | } |
| 7854 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7855 | GLboolean GL_APIENTRY glIsSampler(GLuint sampler) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7856 | { |
| 7857 | EVENT("(GLuint sampler = %u)", sampler); |
| 7858 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7859 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7860 | if (context) |
| 7861 | { |
| 7862 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7863 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7864 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7865 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7866 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7867 | |
| 7868 | return context->isSampler(sampler); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7869 | } |
| 7870 | |
| 7871 | return GL_FALSE; |
| 7872 | } |
| 7873 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7874 | void GL_APIENTRY glBindSampler(GLuint unit, GLuint sampler) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7875 | { |
| 7876 | EVENT("(GLuint unit = %u, GLuint sampler = %u)", unit, sampler); |
| 7877 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7878 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7879 | if (context) |
| 7880 | { |
| 7881 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7882 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7883 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7884 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7885 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7886 | |
| 7887 | if (sampler != 0 && !context->isSampler(sampler)) |
| 7888 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7889 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7890 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7891 | } |
| 7892 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7893 | if (unit >= context->getCaps().maxCombinedTextureImageUnits) |
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 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7896 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7897 | } |
| 7898 | |
| 7899 | context->bindSampler(unit, sampler); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7900 | } |
| 7901 | } |
| 7902 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7903 | 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] | 7904 | { |
| 7905 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint param = %d)", sampler, pname, param); |
| 7906 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7907 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7908 | if (context) |
| 7909 | { |
| 7910 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7911 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7912 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7913 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7914 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7915 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7916 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7917 | { |
| 7918 | return; |
| 7919 | } |
| 7920 | |
| 7921 | if (!gl::ValidateTexParamParameters(context, pname, param)) |
| 7922 | { |
| 7923 | return; |
| 7924 | } |
| 7925 | |
| 7926 | if (!context->isSampler(sampler)) |
| 7927 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7928 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7929 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7930 | } |
| 7931 | |
| 7932 | context->samplerParameteri(sampler, pname, param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7933 | } |
| 7934 | } |
| 7935 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7936 | 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] | 7937 | { |
Jamie Madill | f6cc8cc | 2013-07-03 12:44:15 -0400 | [diff] [blame] | 7938 | glSamplerParameteri(sampler, pname, *param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7939 | } |
| 7940 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7941 | 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] | 7942 | { |
| 7943 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat param = %g)", sampler, pname, param); |
| 7944 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7945 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7946 | if (context) |
| 7947 | { |
| 7948 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7949 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7950 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7951 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7952 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7953 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7954 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7955 | { |
| 7956 | return; |
| 7957 | } |
| 7958 | |
| 7959 | if (!gl::ValidateTexParamParameters(context, pname, static_cast<GLint>(param))) |
| 7960 | { |
| 7961 | return; |
| 7962 | } |
| 7963 | |
| 7964 | if (!context->isSampler(sampler)) |
| 7965 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7966 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7967 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7968 | } |
| 7969 | |
| 7970 | context->samplerParameterf(sampler, pname, param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7971 | } |
| 7972 | } |
| 7973 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7974 | 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] | 7975 | { |
Jamie Madill | f6cc8cc | 2013-07-03 12:44:15 -0400 | [diff] [blame] | 7976 | glSamplerParameterf(sampler, pname, *param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7977 | } |
| 7978 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7979 | 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] | 7980 | { |
| 7981 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", sampler, pname, params); |
| 7982 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7983 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7984 | if (context) |
| 7985 | { |
| 7986 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7987 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7988 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7989 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7990 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7991 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7992 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7993 | { |
| 7994 | return; |
| 7995 | } |
| 7996 | |
| 7997 | if (!context->isSampler(sampler)) |
| 7998 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7999 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8000 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8001 | } |
| 8002 | |
| 8003 | *params = context->getSamplerParameteri(sampler, pname); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8004 | } |
| 8005 | } |
| 8006 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8007 | 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] | 8008 | { |
| 8009 | EVENT("(GLuint sample = %ur, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", sampler, pname, params); |
| 8010 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8011 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8012 | if (context) |
| 8013 | { |
| 8014 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8015 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8016 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8017 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8018 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8019 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8020 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8021 | { |
| 8022 | return; |
| 8023 | } |
| 8024 | |
| 8025 | if (!context->isSampler(sampler)) |
| 8026 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8027 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8028 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8029 | } |
| 8030 | |
| 8031 | *params = context->getSamplerParameterf(sampler, pname); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8032 | } |
| 8033 | } |
| 8034 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8035 | void GL_APIENTRY glVertexAttribDivisor(GLuint index, GLuint divisor) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8036 | { |
| 8037 | EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor); |
| 8038 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8039 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8040 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8041 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8042 | if (context->getClientVersion() < 3) |
| 8043 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8044 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8045 | return; |
| 8046 | } |
| 8047 | |
| 8048 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 8049 | { |
| 8050 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8051 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8052 | } |
| 8053 | |
| 8054 | context->setVertexAttribDivisor(index, divisor); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8055 | } |
| 8056 | } |
| 8057 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8058 | void GL_APIENTRY glBindTransformFeedback(GLenum target, GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8059 | { |
| 8060 | EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id); |
| 8061 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8062 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8063 | if (context) |
| 8064 | { |
| 8065 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8066 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8067 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8068 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8069 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8070 | |
| 8071 | switch (target) |
| 8072 | { |
| 8073 | case GL_TRANSFORM_FEEDBACK: |
| 8074 | { |
| 8075 | // Cannot bind a transform feedback object if the current one is started and not paused (3.0.2 pg 85 section 2.14.1) |
| 8076 | gl::TransformFeedback *curTransformFeedback = context->getState().getCurrentTransformFeedback(); |
| 8077 | if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused()) |
| 8078 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8079 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8080 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8081 | } |
| 8082 | |
| 8083 | // Cannot bind a transform feedback object that does not exist (3.0.2 pg 85 section 2.14.1) |
| 8084 | if (context->getTransformFeedback(id) == NULL) |
| 8085 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8086 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8087 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8088 | } |
| 8089 | |
| 8090 | context->bindTransformFeedback(id); |
| 8091 | } |
| 8092 | break; |
| 8093 | |
| 8094 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8095 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8096 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8097 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8098 | } |
| 8099 | } |
| 8100 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8101 | 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] | 8102 | { |
| 8103 | EVENT("(GLsizei n = %d, const GLuint* ids = 0x%0.8p)", n, ids); |
| 8104 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8105 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8106 | if (context) |
| 8107 | { |
| 8108 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8109 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8110 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8111 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8112 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8113 | |
| 8114 | for (int i = 0; i < n; i++) |
| 8115 | { |
| 8116 | context->deleteTransformFeedback(ids[i]); |
| 8117 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8118 | } |
| 8119 | } |
| 8120 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8121 | void GL_APIENTRY glGenTransformFeedbacks(GLsizei n, GLuint* ids) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8122 | { |
| 8123 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 8124 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8125 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8126 | if (context) |
| 8127 | { |
| 8128 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8129 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8130 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8131 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8132 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8133 | |
| 8134 | for (int i = 0; i < n; i++) |
| 8135 | { |
| 8136 | ids[i] = context->createTransformFeedback(); |
| 8137 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8138 | } |
| 8139 | } |
| 8140 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8141 | GLboolean GL_APIENTRY glIsTransformFeedback(GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8142 | { |
| 8143 | EVENT("(GLuint id = %u)", id); |
| 8144 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8145 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8146 | if (context) |
| 8147 | { |
| 8148 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8149 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8150 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8151 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8152 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8153 | |
| 8154 | 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] | 8155 | } |
| 8156 | |
| 8157 | return GL_FALSE; |
| 8158 | } |
| 8159 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8160 | void GL_APIENTRY glPauseTransformFeedback(void) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8161 | { |
| 8162 | EVENT("(void)"); |
| 8163 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8164 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8165 | if (context) |
| 8166 | { |
| 8167 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8168 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8169 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8170 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8171 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8172 | |
| 8173 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 8174 | ASSERT(transformFeedback != NULL); |
| 8175 | |
| 8176 | // Current transform feedback must be started and not paused in order to pause (3.0.2 pg 86) |
| 8177 | if (!transformFeedback->isStarted() || transformFeedback->isPaused()) |
| 8178 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8179 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8180 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8181 | } |
| 8182 | |
| 8183 | transformFeedback->pause(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8184 | } |
| 8185 | } |
| 8186 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8187 | void GL_APIENTRY glResumeTransformFeedback(void) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8188 | { |
| 8189 | EVENT("(void)"); |
| 8190 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8191 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8192 | if (context) |
| 8193 | { |
| 8194 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8195 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8196 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8197 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8198 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8199 | |
| 8200 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 8201 | ASSERT(transformFeedback != NULL); |
| 8202 | |
| 8203 | // Current transform feedback must be started and paused in order to resume (3.0.2 pg 86) |
| 8204 | if (!transformFeedback->isStarted() || !transformFeedback->isPaused()) |
| 8205 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8206 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8207 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8208 | } |
| 8209 | |
| 8210 | transformFeedback->resume(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8211 | } |
| 8212 | } |
| 8213 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8214 | 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] | 8215 | { |
| 8216 | EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLenum* binaryFormat = 0x%0.8p, GLvoid* binary = 0x%0.8p)", |
| 8217 | program, bufSize, length, binaryFormat, binary); |
| 8218 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8219 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8220 | if (context) |
| 8221 | { |
| 8222 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8223 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8224 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8225 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8226 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8227 | |
| 8228 | // glGetProgramBinary |
| 8229 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8230 | } |
| 8231 | } |
| 8232 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8233 | 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] | 8234 | { |
| 8235 | EVENT("(GLuint program = %u, GLenum binaryFormat = 0x%X, const GLvoid* binary = 0x%0.8p, GLsizei length = %d)", |
| 8236 | program, binaryFormat, binary, length); |
| 8237 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8238 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8239 | if (context) |
| 8240 | { |
| 8241 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8242 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8243 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8244 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8245 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8246 | |
| 8247 | // glProgramBinary |
| 8248 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8249 | } |
| 8250 | } |
| 8251 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8252 | 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] | 8253 | { |
| 8254 | EVENT("(GLuint program = %u, GLenum pname = 0x%X, GLint value = %d)", |
| 8255 | program, pname, value); |
| 8256 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8257 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8258 | if (context) |
| 8259 | { |
| 8260 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8261 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8262 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8263 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8264 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8265 | |
| 8266 | // glProgramParameteri |
| 8267 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8268 | } |
| 8269 | } |
| 8270 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8271 | 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] | 8272 | { |
| 8273 | EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p)", |
| 8274 | target, numAttachments, attachments); |
| 8275 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8276 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8277 | if (context) |
| 8278 | { |
| 8279 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8280 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8281 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8282 | return; |
shannonwoods@chromium.org | d63ef89 | 2013-05-30 00:10:56 +0000 | [diff] [blame] | 8283 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8284 | |
| 8285 | if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments)) |
| 8286 | { |
| 8287 | return; |
| 8288 | } |
| 8289 | |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8290 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 8291 | if (framebuffer && framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE) |
| 8292 | { |
Geoff Lang | 64f23f6 | 2014-09-10 14:40:12 -0400 | [diff] [blame] | 8293 | gl::Error error = framebuffer->invalidate(context->getCaps(), numAttachments, attachments); |
| 8294 | if (error.isError()) |
| 8295 | { |
| 8296 | context->recordError(error); |
| 8297 | return; |
| 8298 | } |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8299 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8300 | } |
| 8301 | } |
| 8302 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8303 | 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] | 8304 | { |
| 8305 | EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p, GLint x = %d, " |
| 8306 | "GLint y = %d, GLsizei width = %d, GLsizei height = %d)", |
| 8307 | target, numAttachments, attachments, x, y, width, height); |
| 8308 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8309 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8310 | if (context) |
| 8311 | { |
| 8312 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8313 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8314 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8315 | return; |
shannonwoods@chromium.org | d63ef89 | 2013-05-30 00:10:56 +0000 | [diff] [blame] | 8316 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8317 | |
| 8318 | if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments)) |
| 8319 | { |
| 8320 | return; |
| 8321 | } |
| 8322 | |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8323 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 8324 | if (framebuffer && framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE) |
| 8325 | { |
Geoff Lang | 64f23f6 | 2014-09-10 14:40:12 -0400 | [diff] [blame] | 8326 | gl::Error error = framebuffer->invalidateSub(numAttachments, attachments, x, y, width, height); |
| 8327 | if (error.isError()) |
| 8328 | { |
| 8329 | context->recordError(error); |
| 8330 | return; |
| 8331 | } |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8332 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8333 | } |
| 8334 | } |
| 8335 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8336 | 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] | 8337 | { |
| 8338 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 8339 | target, levels, internalformat, width, height); |
| 8340 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8341 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8342 | if (context) |
| 8343 | { |
| 8344 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8345 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8346 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8347 | return; |
shannonwoods@chromium.org | 8757c06 | 2013-05-30 00:14:24 +0000 | [diff] [blame] | 8348 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8349 | |
| 8350 | if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1)) |
| 8351 | { |
| 8352 | return; |
| 8353 | } |
| 8354 | |
| 8355 | switch (target) |
| 8356 | { |
| 8357 | case GL_TEXTURE_2D: |
| 8358 | { |
| 8359 | gl::Texture2D *texture2d = context->getTexture2D(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8360 | gl::Error error = texture2d->storage(levels, internalformat, width, height); |
| 8361 | if (error.isError()) |
| 8362 | { |
| 8363 | context->recordError(error); |
| 8364 | return; |
| 8365 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8366 | } |
| 8367 | break; |
| 8368 | |
| 8369 | case GL_TEXTURE_CUBE_MAP: |
| 8370 | { |
| 8371 | gl::TextureCubeMap *textureCube = context->getTextureCubeMap(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8372 | gl::Error error = textureCube->storage(levels, internalformat, width); |
| 8373 | if (error.isError()) |
| 8374 | { |
| 8375 | context->recordError(error); |
| 8376 | return; |
| 8377 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8378 | } |
| 8379 | break; |
| 8380 | |
| 8381 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8382 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8383 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8384 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8385 | } |
| 8386 | } |
| 8387 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8388 | 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] | 8389 | { |
| 8390 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " |
| 8391 | "GLsizei height = %d, GLsizei depth = %d)", |
| 8392 | target, levels, internalformat, width, height, depth); |
| 8393 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8394 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8395 | if (context) |
| 8396 | { |
| 8397 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8398 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8399 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8400 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 14eb55e | 2013-04-13 03:35:06 +0000 | [diff] [blame] | 8401 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8402 | |
| 8403 | if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, depth)) |
| 8404 | { |
| 8405 | return; |
| 8406 | } |
| 8407 | |
| 8408 | switch (target) |
| 8409 | { |
| 8410 | case GL_TEXTURE_3D: |
| 8411 | { |
| 8412 | gl::Texture3D *texture3d = context->getTexture3D(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8413 | gl::Error error = texture3d->storage(levels, internalformat, width, height, depth); |
| 8414 | if (error.isError()) |
| 8415 | { |
| 8416 | context->recordError(error); |
| 8417 | return; |
| 8418 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8419 | } |
| 8420 | break; |
| 8421 | |
| 8422 | case GL_TEXTURE_2D_ARRAY: |
| 8423 | { |
| 8424 | gl::Texture2DArray *texture2darray = context->getTexture2DArray(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8425 | gl::Error error = texture2darray->storage(levels, internalformat, width, height, depth); |
| 8426 | if (error.isError()) |
| 8427 | { |
| 8428 | context->recordError(error); |
| 8429 | return; |
| 8430 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8431 | } |
| 8432 | break; |
| 8433 | |
| 8434 | default: |
| 8435 | UNREACHABLE(); |
| 8436 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8437 | } |
| 8438 | } |
| 8439 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8440 | 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] | 8441 | { |
| 8442 | EVENT("(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, " |
| 8443 | "GLint* params = 0x%0.8p)", |
| 8444 | target, internalformat, pname, bufSize, params); |
| 8445 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8446 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8447 | if (context) |
| 8448 | { |
| 8449 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8450 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8451 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8452 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8453 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8454 | |
| 8455 | const gl::TextureCaps &formatCaps = context->getTextureCaps().get(internalformat); |
| 8456 | if (!formatCaps.renderable) |
| 8457 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8458 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8459 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8460 | } |
| 8461 | |
| 8462 | if (target != GL_RENDERBUFFER) |
| 8463 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8464 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8465 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8466 | } |
| 8467 | |
| 8468 | if (bufSize < 0) |
| 8469 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8470 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8471 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8472 | } |
| 8473 | |
| 8474 | switch (pname) |
| 8475 | { |
| 8476 | case GL_NUM_SAMPLE_COUNTS: |
| 8477 | if (bufSize != 0) |
Geoff Lang | 5f4c463 | 2014-07-03 13:46:52 -0400 | [diff] [blame] | 8478 | { |
| 8479 | *params = formatCaps.sampleCounts.size(); |
| 8480 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8481 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8482 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8483 | case GL_SAMPLES: |
Geoff Lang | 5f4c463 | 2014-07-03 13:46:52 -0400 | [diff] [blame] | 8484 | 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] | 8485 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8486 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8487 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8488 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8489 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8490 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8491 | } |
| 8492 | } |
| 8493 | |
| 8494 | // Extension functions |
| 8495 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8496 | 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] | 8497 | GLbitfield mask, GLenum filter) |
| 8498 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 8499 | 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] | 8500 | "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, " |
| 8501 | "GLbitfield mask = 0x%X, GLenum filter = 0x%X)", |
| 8502 | srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 8503 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8504 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8505 | if (context) |
| 8506 | { |
| 8507 | if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, |
| 8508 | dstX0, dstY0, dstX1, dstY1, mask, filter, |
| 8509 | true)) |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8510 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8511 | return; |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8512 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8513 | |
Geoff Lang | 6483915 | 2014-08-26 16:23:25 -0400 | [diff] [blame] | 8514 | gl::Error error = context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, |
| 8515 | mask, filter); |
| 8516 | if (error.isError()) |
| 8517 | { |
| 8518 | context->recordError(error); |
| 8519 | return; |
| 8520 | } |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8521 | } |
| 8522 | } |
| 8523 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8524 | 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] | 8525 | GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8526 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 8527 | 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] | 8528 | "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] | 8529 | "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] | 8530 | target, level, internalformat, width, height, depth, border, format, type, pixels); |
| 8531 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8532 | UNIMPLEMENTED(); // FIXME |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8533 | } |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8534 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8535 | void GL_APIENTRY glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8536 | GLenum *binaryFormat, void *binary) |
| 8537 | { |
apatrick@chromium.org | 90080e3 | 2012-07-09 22:15:33 +0000 | [diff] [blame] | 8538 | 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] | 8539 | program, bufSize, length, binaryFormat, binary); |
| 8540 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8541 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8542 | if (context) |
| 8543 | { |
| 8544 | gl::Program *programObject = context->getProgram(program); |
| 8545 | |
| 8546 | if (!programObject || !programObject->isLinked()) |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8547 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8548 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8549 | return; |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8550 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8551 | |
| 8552 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 8553 | |
| 8554 | if (!programBinary) |
| 8555 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8556 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8557 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8558 | } |
| 8559 | |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 8560 | gl::Error error = programBinary->save(binaryFormat, binary, bufSize, length); |
| 8561 | if (error.isError()) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8562 | { |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 8563 | context->recordError(error); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8564 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8565 | } |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8566 | } |
| 8567 | } |
| 8568 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8569 | void GL_APIENTRY glProgramBinaryOES(GLuint program, GLenum binaryFormat, |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8570 | const void *binary, GLint length) |
| 8571 | { |
| 8572 | EVENT("(GLenum program = 0x%X, binaryFormat = 0x%x, binary = 0x%0.8p, length = %d)", |
| 8573 | program, binaryFormat, binary, length); |
| 8574 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8575 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8576 | if (context) |
| 8577 | { |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 8578 | const std::vector<GLenum> &programBinaryFormats = context->getCaps().programBinaryFormats; |
| 8579 | if (std::find(programBinaryFormats.begin(), programBinaryFormats.end(), binaryFormat) == programBinaryFormats.end()) |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8580 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8581 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8582 | return; |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8583 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8584 | |
| 8585 | gl::Program *programObject = context->getProgram(program); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8586 | if (!programObject) |
| 8587 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8588 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8589 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8590 | } |
| 8591 | |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 8592 | gl::Error error = context->setProgramBinary(program, binaryFormat, binary, length); |
| 8593 | if (error.isError()) |
| 8594 | { |
| 8595 | context->recordError(error); |
| 8596 | return; |
| 8597 | } |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8598 | } |
| 8599 | } |
| 8600 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8601 | 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] | 8602 | { |
| 8603 | EVENT("(GLenum n = %d, bufs = 0x%0.8p)", n, bufs); |
| 8604 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8605 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8606 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8607 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8608 | 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] | 8609 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8610 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8611 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8612 | } |
| 8613 | |
| 8614 | if (context->getState().getDrawFramebuffer()->id() == 0) |
| 8615 | { |
| 8616 | if (n != 1) |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8617 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8618 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8619 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8620 | } |
| 8621 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8622 | 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] | 8623 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8624 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8625 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 2fa73c5 | 2013-04-13 03:37:20 +0000 | [diff] [blame] | 8626 | } |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8627 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8628 | else |
| 8629 | { |
| 8630 | for (int colorAttachment = 0; colorAttachment < n; colorAttachment++) |
| 8631 | { |
| 8632 | const GLenum attachment = GL_COLOR_ATTACHMENT0_EXT + colorAttachment; |
| 8633 | if (bufs[colorAttachment] != GL_NONE && bufs[colorAttachment] != attachment) |
| 8634 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8635 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8636 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8637 | } |
| 8638 | } |
| 8639 | } |
| 8640 | |
| 8641 | gl::Framebuffer *framebuffer = context->getState().getDrawFramebuffer(); |
| 8642 | |
| 8643 | for (unsigned int colorAttachment = 0; colorAttachment < static_cast<unsigned int>(n); colorAttachment++) |
| 8644 | { |
| 8645 | framebuffer->setDrawBufferState(colorAttachment, bufs[colorAttachment]); |
| 8646 | } |
| 8647 | |
| 8648 | for (unsigned int colorAttachment = n; colorAttachment < context->getCaps().maxDrawBuffers; colorAttachment++) |
| 8649 | { |
| 8650 | framebuffer->setDrawBufferState(colorAttachment, GL_NONE); |
| 8651 | } |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8652 | } |
| 8653 | } |
| 8654 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8655 | void GL_APIENTRY glGetBufferPointervOES(GLenum target, GLenum pname, void** params) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8656 | { |
| 8657 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params); |
| 8658 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8659 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8660 | if (context) |
| 8661 | { |
| 8662 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8663 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8664 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8665 | return; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8666 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8667 | |
| 8668 | if (pname != GL_BUFFER_MAP_POINTER) |
| 8669 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8670 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8671 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8672 | } |
| 8673 | |
| 8674 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8675 | |
| 8676 | if (!buffer || !buffer->isMapped()) |
| 8677 | { |
| 8678 | *params = NULL; |
| 8679 | } |
| 8680 | else |
| 8681 | { |
| 8682 | *params = buffer->getMapPointer(); |
| 8683 | } |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8684 | } |
| 8685 | } |
| 8686 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8687 | void * GL_APIENTRY glMapBufferOES(GLenum target, GLenum access) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8688 | { |
| 8689 | EVENT("(GLenum target = 0x%X, GLbitfield access = 0x%X)", target, access); |
| 8690 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8691 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8692 | if (context) |
| 8693 | { |
| 8694 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8695 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8696 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8697 | return NULL; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8698 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8699 | |
| 8700 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8701 | |
| 8702 | if (buffer == NULL) |
| 8703 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8704 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8705 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8706 | } |
| 8707 | |
| 8708 | if (access != GL_WRITE_ONLY_OES) |
| 8709 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8710 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8711 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8712 | } |
| 8713 | |
| 8714 | if (buffer->isMapped()) |
| 8715 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8716 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8717 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8718 | } |
| 8719 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 8720 | gl::Error error = buffer->mapRange(0, buffer->getSize(), GL_MAP_WRITE_BIT); |
| 8721 | if (error.isError()) |
| 8722 | { |
| 8723 | context->recordError(error); |
| 8724 | return NULL; |
| 8725 | } |
| 8726 | |
| 8727 | return buffer->getMapPointer(); |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8728 | } |
| 8729 | |
| 8730 | return NULL; |
| 8731 | } |
| 8732 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8733 | GLboolean GL_APIENTRY glUnmapBufferOES(GLenum target) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8734 | { |
| 8735 | EVENT("(GLenum target = 0x%X)", target); |
| 8736 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8737 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8738 | if (context) |
| 8739 | { |
| 8740 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8741 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8742 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8743 | return GL_FALSE; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8744 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8745 | |
| 8746 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8747 | |
| 8748 | if (buffer == NULL || !buffer->isMapped()) |
| 8749 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8750 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8751 | return GL_FALSE; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8752 | } |
| 8753 | |
| 8754 | // TODO: detect if we had corruption. if so, throw an error and return false. |
| 8755 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 8756 | gl::Error error = buffer->unmap(); |
| 8757 | if (error.isError()) |
| 8758 | { |
| 8759 | context->recordError(error); |
| 8760 | return GL_FALSE; |
| 8761 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8762 | |
| 8763 | return GL_TRUE; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8764 | } |
| 8765 | |
| 8766 | return GL_FALSE; |
| 8767 | } |
| 8768 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8769 | void* GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8770 | { |
| 8771 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)", |
| 8772 | target, offset, length, access); |
| 8773 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8774 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8775 | if (context) |
| 8776 | { |
| 8777 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8778 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8779 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8780 | return NULL; |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8781 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8782 | |
| 8783 | if (offset < 0 || length < 0) |
| 8784 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8785 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8786 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8787 | } |
| 8788 | |
| 8789 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8790 | |
| 8791 | if (buffer == NULL) |
| 8792 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8793 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8794 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8795 | } |
| 8796 | |
| 8797 | // Check for buffer overflow |
| 8798 | size_t offsetSize = static_cast<size_t>(offset); |
| 8799 | size_t lengthSize = static_cast<size_t>(length); |
| 8800 | |
| 8801 | if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) || |
| 8802 | offsetSize + lengthSize > static_cast<size_t>(buffer->getSize())) |
| 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 | // Check for invalid bits in the mask |
| 8809 | GLbitfield allAccessBits = GL_MAP_READ_BIT | |
| 8810 | GL_MAP_WRITE_BIT | |
| 8811 | GL_MAP_INVALIDATE_RANGE_BIT | |
| 8812 | GL_MAP_INVALIDATE_BUFFER_BIT | |
| 8813 | GL_MAP_FLUSH_EXPLICIT_BIT | |
| 8814 | GL_MAP_UNSYNCHRONIZED_BIT; |
| 8815 | |
| 8816 | if (access & ~(allAccessBits)) |
| 8817 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8818 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8819 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8820 | } |
| 8821 | |
| 8822 | if (length == 0 || buffer->isMapped()) |
| 8823 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8824 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8825 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8826 | } |
| 8827 | |
| 8828 | // Check for invalid bit combinations |
| 8829 | if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0) |
| 8830 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8831 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8832 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8833 | } |
| 8834 | |
| 8835 | GLbitfield writeOnlyBits = GL_MAP_INVALIDATE_RANGE_BIT | |
| 8836 | GL_MAP_INVALIDATE_BUFFER_BIT | |
| 8837 | GL_MAP_UNSYNCHRONIZED_BIT; |
| 8838 | |
| 8839 | if ((access & GL_MAP_READ_BIT) != 0 && (access & writeOnlyBits) != 0) |
| 8840 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8841 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8842 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8843 | } |
| 8844 | |
| 8845 | if ((access & GL_MAP_WRITE_BIT) == 0 && (access & GL_MAP_FLUSH_EXPLICIT_BIT) != 0) |
| 8846 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8847 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8848 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8849 | } |
| 8850 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 8851 | gl::Error error = buffer->mapRange(offset, length, access); |
| 8852 | if (error.isError()) |
| 8853 | { |
| 8854 | context->recordError(error); |
| 8855 | return NULL; |
| 8856 | } |
| 8857 | |
| 8858 | return buffer->getMapPointer(); |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8859 | } |
| 8860 | |
| 8861 | return NULL; |
| 8862 | } |
| 8863 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8864 | void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8865 | { |
| 8866 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length); |
| 8867 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8868 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8869 | if (context) |
| 8870 | { |
| 8871 | if (offset < 0 || length < 0) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8872 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8873 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8874 | return; |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8875 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8876 | |
| 8877 | if (!gl::ValidBufferTarget(context, target)) |
| 8878 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8879 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8880 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8881 | } |
| 8882 | |
| 8883 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8884 | |
| 8885 | if (buffer == NULL) |
| 8886 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8887 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8888 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8889 | } |
| 8890 | |
| 8891 | if (!buffer->isMapped() || (buffer->getAccessFlags() & GL_MAP_FLUSH_EXPLICIT_BIT) == 0) |
| 8892 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8893 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8894 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8895 | } |
| 8896 | |
| 8897 | // Check for buffer overflow |
| 8898 | size_t offsetSize = static_cast<size_t>(offset); |
| 8899 | size_t lengthSize = static_cast<size_t>(length); |
| 8900 | |
| 8901 | if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) || |
| 8902 | offsetSize + lengthSize > static_cast<size_t>(buffer->getMapLength())) |
| 8903 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8904 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8905 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8906 | } |
| 8907 | |
| 8908 | // We do not currently support a non-trivial implementation of FlushMappedBufferRange |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8909 | } |
| 8910 | } |
| 8911 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8912 | __eglMustCastToProperFunctionPointerType EGLAPIENTRY glGetProcAddress(const char *procname) |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8913 | { |
| 8914 | struct Extension |
| 8915 | { |
| 8916 | const char *name; |
| 8917 | __eglMustCastToProperFunctionPointerType address; |
| 8918 | }; |
| 8919 | |
| 8920 | static const Extension glExtensions[] = |
| 8921 | { |
| 8922 | {"glTexImage3DOES", (__eglMustCastToProperFunctionPointerType)glTexImage3DOES}, |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 8923 | {"glBlitFramebufferANGLE", (__eglMustCastToProperFunctionPointerType)glBlitFramebufferANGLE}, |
daniel@transgaming.com | 1fe96c9 | 2011-01-14 15:08:44 +0000 | [diff] [blame] | 8924 | {"glRenderbufferStorageMultisampleANGLE", (__eglMustCastToProperFunctionPointerType)glRenderbufferStorageMultisampleANGLE}, |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 8925 | {"glDeleteFencesNV", (__eglMustCastToProperFunctionPointerType)glDeleteFencesNV}, |
| 8926 | {"glGenFencesNV", (__eglMustCastToProperFunctionPointerType)glGenFencesNV}, |
| 8927 | {"glIsFenceNV", (__eglMustCastToProperFunctionPointerType)glIsFenceNV}, |
| 8928 | {"glTestFenceNV", (__eglMustCastToProperFunctionPointerType)glTestFenceNV}, |
| 8929 | {"glGetFenceivNV", (__eglMustCastToProperFunctionPointerType)glGetFenceivNV}, |
| 8930 | {"glFinishFenceNV", (__eglMustCastToProperFunctionPointerType)glFinishFenceNV}, |
| 8931 | {"glSetFenceNV", (__eglMustCastToProperFunctionPointerType)glSetFenceNV}, |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 8932 | {"glGetTranslatedShaderSourceANGLE", (__eglMustCastToProperFunctionPointerType)glGetTranslatedShaderSourceANGLE}, |
daniel@transgaming.com | 0bd1f2f | 2011-11-11 04:19:03 +0000 | [diff] [blame] | 8933 | {"glTexStorage2DEXT", (__eglMustCastToProperFunctionPointerType)glTexStorage2DEXT}, |
daniel@transgaming.com | 709ed11 | 2011-11-12 03:18:10 +0000 | [diff] [blame] | 8934 | {"glGetGraphicsResetStatusEXT", (__eglMustCastToProperFunctionPointerType)glGetGraphicsResetStatusEXT}, |
| 8935 | {"glReadnPixelsEXT", (__eglMustCastToProperFunctionPointerType)glReadnPixelsEXT}, |
| 8936 | {"glGetnUniformfvEXT", (__eglMustCastToProperFunctionPointerType)glGetnUniformfvEXT}, |
| 8937 | {"glGetnUniformivEXT", (__eglMustCastToProperFunctionPointerType)glGetnUniformivEXT}, |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 8938 | {"glGenQueriesEXT", (__eglMustCastToProperFunctionPointerType)glGenQueriesEXT}, |
| 8939 | {"glDeleteQueriesEXT", (__eglMustCastToProperFunctionPointerType)glDeleteQueriesEXT}, |
| 8940 | {"glIsQueryEXT", (__eglMustCastToProperFunctionPointerType)glIsQueryEXT}, |
| 8941 | {"glBeginQueryEXT", (__eglMustCastToProperFunctionPointerType)glBeginQueryEXT}, |
| 8942 | {"glEndQueryEXT", (__eglMustCastToProperFunctionPointerType)glEndQueryEXT}, |
| 8943 | {"glGetQueryivEXT", (__eglMustCastToProperFunctionPointerType)glGetQueryivEXT}, |
| 8944 | {"glGetQueryObjectuivEXT", (__eglMustCastToProperFunctionPointerType)glGetQueryObjectuivEXT}, |
shannon.woods%transgaming.com@gtempaccount.com | 77d9472 | 2013-04-13 03:34:22 +0000 | [diff] [blame] | 8945 | {"glDrawBuffersEXT", (__eglMustCastToProperFunctionPointerType)glDrawBuffersEXT}, |
daniel@transgaming.com | dce02fd | 2012-01-27 15:39:51 +0000 | [diff] [blame] | 8946 | {"glVertexAttribDivisorANGLE", (__eglMustCastToProperFunctionPointerType)glVertexAttribDivisorANGLE}, |
| 8947 | {"glDrawArraysInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawArraysInstancedANGLE}, |
| 8948 | {"glDrawElementsInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawElementsInstancedANGLE}, |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8949 | {"glGetProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glGetProgramBinaryOES}, |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8950 | {"glProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glProgramBinaryOES}, |
| 8951 | {"glGetBufferPointervOES", (__eglMustCastToProperFunctionPointerType)glGetBufferPointervOES}, |
| 8952 | {"glMapBufferOES", (__eglMustCastToProperFunctionPointerType)glMapBufferOES}, |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8953 | {"glUnmapBufferOES", (__eglMustCastToProperFunctionPointerType)glUnmapBufferOES}, |
| 8954 | {"glMapBufferRangeEXT", (__eglMustCastToProperFunctionPointerType)glMapBufferRangeEXT}, |
| 8955 | {"glFlushMappedBufferRangeEXT", (__eglMustCastToProperFunctionPointerType)glFlushMappedBufferRangeEXT}, }; |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8956 | |
shannon.woods@transgaming.com | d438fd4 | 2013-02-28 23:17:45 +0000 | [diff] [blame] | 8957 | for (unsigned int ext = 0; ext < ArraySize(glExtensions); ext++) |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8958 | { |
| 8959 | if (strcmp(procname, glExtensions[ext].name) == 0) |
| 8960 | { |
| 8961 | return (__eglMustCastToProperFunctionPointerType)glExtensions[ext].address; |
| 8962 | } |
| 8963 | } |
| 8964 | |
| 8965 | return NULL; |
| 8966 | } |
| 8967 | |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 8968 | // Non-public functions used by EGL |
| 8969 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8970 | bool EGLAPIENTRY glBindTexImage(egl::Surface *surface) |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8971 | { |
| 8972 | EVENT("(egl::Surface* surface = 0x%0.8p)", |
| 8973 | surface); |
| 8974 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8975 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8976 | if (context) |
| 8977 | { |
| 8978 | gl::Texture2D *textureObject = context->getTexture2D(); |
| 8979 | ASSERT(textureObject != NULL); |
| 8980 | |
| 8981 | if (textureObject->isImmutable()) |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8982 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8983 | return false; |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8984 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8985 | |
| 8986 | textureObject->bindTexImage(surface); |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8987 | } |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 8988 | |
| 8989 | return true; |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8990 | } |
| 8991 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8992 | } |