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 | |
| 1769 | texture->generateMipmaps(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1770 | } |
| 1771 | } |
| 1772 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1773 | void GL_APIENTRY glGenFencesNV(GLsizei n, GLuint* fences) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1774 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1775 | EVENT("(GLsizei n = %d, GLuint* fences = 0x%0.8p)", n, fences); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1776 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1777 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1778 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1779 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1780 | if (n < 0) |
| 1781 | { |
| 1782 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1783 | return; |
| 1784 | } |
| 1785 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1786 | for (int i = 0; i < n; i++) |
| 1787 | { |
| 1788 | fences[i] = context->createFenceNV(); |
| 1789 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1790 | } |
| 1791 | } |
| 1792 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1793 | void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1794 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1795 | EVENT("(GLsizei n = %d, GLuint* framebuffers = 0x%0.8p)", n, framebuffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1796 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1797 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1798 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1799 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1800 | if (n < 0) |
| 1801 | { |
| 1802 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1803 | return; |
| 1804 | } |
| 1805 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1806 | for (int i = 0; i < n; i++) |
| 1807 | { |
| 1808 | framebuffers[i] = context->createFramebuffer(); |
| 1809 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1810 | } |
| 1811 | } |
| 1812 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1813 | void GL_APIENTRY glGenQueriesEXT(GLsizei n, GLuint* ids) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1814 | { |
| 1815 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 1816 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1817 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1818 | if (context) |
| 1819 | { |
| 1820 | if (n < 0) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1821 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1822 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1823 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1824 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1825 | |
| 1826 | for (GLsizei i = 0; i < n; i++) |
| 1827 | { |
| 1828 | ids[i] = context->createQuery(); |
| 1829 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1830 | } |
| 1831 | } |
| 1832 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1833 | void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1834 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1835 | EVENT("(GLsizei n = %d, GLuint* renderbuffers = 0x%0.8p)", n, renderbuffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1836 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1837 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1838 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1839 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1840 | if (n < 0) |
| 1841 | { |
| 1842 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1843 | return; |
| 1844 | } |
| 1845 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1846 | for (int i = 0; i < n; i++) |
| 1847 | { |
| 1848 | renderbuffers[i] = context->createRenderbuffer(); |
| 1849 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1850 | } |
| 1851 | } |
| 1852 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1853 | void GL_APIENTRY glGenTextures(GLsizei n, GLuint* textures) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1854 | { |
Jamie Madill | 1fc7e2c | 2014-01-21 16:47:10 -0500 | [diff] [blame] | 1855 | EVENT("(GLsizei n = %d, GLuint* textures = 0x%0.8p)", n, textures); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1856 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1857 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1858 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1859 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1860 | if (n < 0) |
| 1861 | { |
| 1862 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1863 | return; |
| 1864 | } |
| 1865 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1866 | for (int i = 0; i < n; i++) |
| 1867 | { |
| 1868 | textures[i] = context->createTexture(); |
| 1869 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1870 | } |
| 1871 | } |
| 1872 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1873 | 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] | 1874 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1875 | 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] | 1876 | "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] | 1877 | program, index, bufsize, length, size, type, name); |
| 1878 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1879 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1880 | if (context) |
| 1881 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1882 | if (bufsize < 0) |
| 1883 | { |
| 1884 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1885 | return; |
| 1886 | } |
| 1887 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1888 | gl::Program *programObject = context->getProgram(program); |
| 1889 | |
| 1890 | if (!programObject) |
| 1891 | { |
| 1892 | if (context->getShader(program)) |
| 1893 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1894 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1895 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1896 | } |
| 1897 | else |
| 1898 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1899 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1900 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1901 | } |
| 1902 | } |
| 1903 | |
| 1904 | if (index >= (GLuint)programObject->getActiveAttributeCount()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1905 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1906 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1907 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1908 | } |
| 1909 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1910 | programObject->getActiveAttribute(index, bufsize, length, size, type, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1911 | } |
| 1912 | } |
| 1913 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1914 | 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] | 1915 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1916 | EVENT("(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, " |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 1917 | "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] | 1918 | program, index, bufsize, length, size, type, name); |
| 1919 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1920 | |
| 1921 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1922 | if (context) |
| 1923 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1924 | if (bufsize < 0) |
| 1925 | { |
| 1926 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1927 | return; |
| 1928 | } |
| 1929 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1930 | gl::Program *programObject = context->getProgram(program); |
| 1931 | |
| 1932 | if (!programObject) |
| 1933 | { |
| 1934 | if (context->getShader(program)) |
| 1935 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1936 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1937 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1938 | } |
| 1939 | else |
| 1940 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1941 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1942 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1943 | } |
| 1944 | } |
| 1945 | |
| 1946 | if (index >= (GLuint)programObject->getActiveUniformCount()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1947 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1948 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1949 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1950 | } |
| 1951 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1952 | programObject->getActiveUniform(index, bufsize, length, size, type, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1953 | } |
| 1954 | } |
| 1955 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1956 | 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] | 1957 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1958 | 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] | 1959 | program, maxcount, count, shaders); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1960 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1961 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1962 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1963 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1964 | if (maxcount < 0) |
| 1965 | { |
| 1966 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1967 | return; |
| 1968 | } |
| 1969 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1970 | gl::Program *programObject = context->getProgram(program); |
| 1971 | |
| 1972 | if (!programObject) |
| 1973 | { |
| 1974 | if (context->getShader(program)) |
| 1975 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1976 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1977 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1978 | } |
| 1979 | else |
| 1980 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1981 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1982 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1983 | } |
| 1984 | } |
| 1985 | |
| 1986 | return programObject->getAttachedShaders(maxcount, count, shaders); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1987 | } |
| 1988 | } |
| 1989 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 1990 | GLint GL_APIENTRY glGetAttribLocation(GLuint program, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1991 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1992 | EVENT("(GLuint program = %d, const GLchar* name = %s)", program, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1993 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1994 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1995 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1996 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1997 | gl::Program *programObject = context->getProgram(program); |
| 1998 | |
| 1999 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2000 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2001 | if (context->getShader(program)) |
daniel@transgaming.com | cf4aa87 | 2010-04-13 03:26:27 +0000 | [diff] [blame] | 2002 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2003 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2004 | return -1; |
daniel@transgaming.com | cf4aa87 | 2010-04-13 03:26:27 +0000 | [diff] [blame] | 2005 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2006 | else |
| 2007 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2008 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2009 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2010 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2011 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2012 | |
| 2013 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 2014 | if (!programObject->isLinked() || !programBinary) |
| 2015 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2016 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2017 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2018 | } |
| 2019 | |
| 2020 | return programBinary->getAttributeLocation(name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2021 | } |
| 2022 | |
| 2023 | return -1; |
| 2024 | } |
| 2025 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2026 | void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2027 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2028 | 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] | 2029 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2030 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2031 | if (context) |
| 2032 | { |
| 2033 | GLenum nativeType; |
| 2034 | unsigned int numParams = 0; |
| 2035 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2036 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2037 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2038 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2039 | |
| 2040 | if (nativeType == GL_BOOL) |
| 2041 | { |
| 2042 | context->getBooleanv(pname, params); |
| 2043 | } |
| 2044 | else |
| 2045 | { |
| 2046 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2047 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2048 | } |
| 2049 | } |
| 2050 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2051 | void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2052 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2053 | 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] | 2054 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2055 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2056 | if (context) |
| 2057 | { |
| 2058 | if (!gl::ValidBufferTarget(context, target)) |
daniel@transgaming.com | aa0ccbd | 2010-04-15 20:45:05 +0000 | [diff] [blame] | 2059 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2060 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2061 | return; |
daniel@transgaming.com | aa0ccbd | 2010-04-15 20:45:05 +0000 | [diff] [blame] | 2062 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2063 | |
| 2064 | if (!gl::ValidBufferParameter(context, pname)) |
| 2065 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2066 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2067 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2068 | } |
| 2069 | |
| 2070 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 2071 | |
| 2072 | if (!buffer) |
| 2073 | { |
| 2074 | // 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] | 2075 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2076 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2077 | } |
| 2078 | |
| 2079 | switch (pname) |
| 2080 | { |
| 2081 | case GL_BUFFER_USAGE: |
| 2082 | *params = static_cast<GLint>(buffer->getUsage()); |
| 2083 | break; |
| 2084 | case GL_BUFFER_SIZE: |
| 2085 | *params = gl::clampCast<GLint>(buffer->getSize()); |
| 2086 | break; |
| 2087 | case GL_BUFFER_ACCESS_FLAGS: |
| 2088 | *params = buffer->getAccessFlags(); |
| 2089 | break; |
| 2090 | case GL_BUFFER_MAPPED: |
| 2091 | *params = static_cast<GLint>(buffer->isMapped()); |
| 2092 | break; |
| 2093 | case GL_BUFFER_MAP_OFFSET: |
| 2094 | *params = gl::clampCast<GLint>(buffer->getMapOffset()); |
| 2095 | break; |
| 2096 | case GL_BUFFER_MAP_LENGTH: |
| 2097 | *params = gl::clampCast<GLint>(buffer->getMapLength()); |
| 2098 | break; |
| 2099 | default: UNREACHABLE(); break; |
| 2100 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2101 | } |
| 2102 | } |
| 2103 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2104 | GLenum GL_APIENTRY glGetError(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2105 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2106 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2107 | |
| 2108 | gl::Context *context = gl::getContext(); |
| 2109 | |
| 2110 | if (context) |
| 2111 | { |
daniel@transgaming.com | 82b2891 | 2011-12-12 21:01:35 +0000 | [diff] [blame] | 2112 | return context->getError(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2113 | } |
| 2114 | |
| 2115 | return GL_NO_ERROR; |
| 2116 | } |
| 2117 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2118 | void GL_APIENTRY glGetFenceivNV(GLuint fence, GLenum pname, GLint *params) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2119 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2120 | 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] | 2121 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2122 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2123 | if (context) |
| 2124 | { |
| 2125 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 2126 | |
| 2127 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2128 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2129 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2130 | return; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2131 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2132 | |
| 2133 | if (fenceObject->isFence() != GL_TRUE) |
| 2134 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2135 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2136 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2137 | } |
| 2138 | |
| 2139 | switch (pname) |
| 2140 | { |
| 2141 | case GL_FENCE_STATUS_NV: |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 2142 | { |
| 2143 | // GL_NV_fence spec: |
| 2144 | // Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV |
| 2145 | // or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence. |
| 2146 | GLboolean status = GL_TRUE; |
| 2147 | if (fenceObject->getStatus() != GL_TRUE) |
| 2148 | { |
| 2149 | gl::Error error = fenceObject->testFence(&status); |
| 2150 | if (error.isError()) |
| 2151 | { |
| 2152 | context->recordError(error); |
| 2153 | return; |
| 2154 | } |
| 2155 | } |
| 2156 | *params = status; |
| 2157 | break; |
| 2158 | } |
| 2159 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2160 | case GL_FENCE_CONDITION_NV: |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 2161 | { |
| 2162 | *params = fenceObject->getCondition(); |
| 2163 | break; |
| 2164 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2165 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2166 | default: |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 2167 | { |
| 2168 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2169 | return; |
| 2170 | } |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 2171 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2172 | } |
| 2173 | } |
| 2174 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2175 | void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2176 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2177 | 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] | 2178 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2179 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2180 | if (context) |
| 2181 | { |
| 2182 | GLenum nativeType; |
| 2183 | unsigned int numParams = 0; |
| 2184 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 32e58cd | 2010-03-24 09:44:10 +0000 | [diff] [blame] | 2185 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2186 | return; |
daniel@transgaming.com | 32e58cd | 2010-03-24 09:44:10 +0000 | [diff] [blame] | 2187 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2188 | |
| 2189 | if (nativeType == GL_FLOAT) |
| 2190 | { |
| 2191 | context->getFloatv(pname, params); |
| 2192 | } |
| 2193 | else |
| 2194 | { |
| 2195 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2196 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2197 | } |
| 2198 | } |
| 2199 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2200 | 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] | 2201 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2202 | 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] | 2203 | target, attachment, pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2204 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2205 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2206 | if (context) |
| 2207 | { |
| 2208 | if (!gl::ValidFramebufferTarget(target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2209 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2210 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2211 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2212 | } |
| 2213 | |
| 2214 | int clientVersion = context->getClientVersion(); |
| 2215 | |
| 2216 | switch (pname) |
| 2217 | { |
| 2218 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2219 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2220 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| 2221 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| 2222 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2223 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2224 | case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: |
| 2225 | if (clientVersion < 3 && !context->getExtensions().sRGB) |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2226 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2227 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2228 | return; |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2229 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2230 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2231 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2232 | case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: |
| 2233 | case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: |
| 2234 | case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: |
| 2235 | case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: |
| 2236 | case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: |
| 2237 | case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: |
| 2238 | case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: |
| 2239 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: |
| 2240 | if (clientVersion < 3) |
| 2241 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2242 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2243 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2244 | } |
| 2245 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2246 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2247 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2248 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2249 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2250 | } |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2251 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2252 | // Determine if the attachment is a valid enum |
| 2253 | switch (attachment) |
| 2254 | { |
| 2255 | case GL_BACK: |
| 2256 | case GL_FRONT: |
| 2257 | case GL_DEPTH: |
| 2258 | case GL_STENCIL: |
| 2259 | case GL_DEPTH_STENCIL_ATTACHMENT: |
| 2260 | if (clientVersion < 3) |
| 2261 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2262 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2263 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2264 | } |
| 2265 | break; |
| 2266 | |
| 2267 | case GL_DEPTH_ATTACHMENT: |
| 2268 | case GL_STENCIL_ATTACHMENT: |
| 2269 | break; |
| 2270 | |
| 2271 | default: |
| 2272 | if (attachment < GL_COLOR_ATTACHMENT0_EXT || |
| 2273 | (attachment - GL_COLOR_ATTACHMENT0_EXT) >= context->getCaps().maxColorAttachments) |
| 2274 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2275 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2276 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2277 | } |
| 2278 | break; |
| 2279 | } |
| 2280 | |
| 2281 | GLuint framebufferHandle = context->getState().getTargetFramebuffer(target)->id(); |
| 2282 | gl::Framebuffer *framebuffer = context->getFramebuffer(framebufferHandle); |
| 2283 | |
| 2284 | if (framebufferHandle == 0) |
| 2285 | { |
| 2286 | if (clientVersion < 3) |
| 2287 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2288 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2289 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2290 | } |
| 2291 | |
| 2292 | switch (attachment) |
| 2293 | { |
| 2294 | case GL_BACK: |
| 2295 | case GL_DEPTH: |
| 2296 | case GL_STENCIL: |
| 2297 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2298 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2299 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2300 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2301 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2302 | } |
| 2303 | } |
| 2304 | else |
| 2305 | { |
| 2306 | if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT) |
| 2307 | { |
| 2308 | // Valid attachment query |
| 2309 | } |
| 2310 | else |
| 2311 | { |
| 2312 | switch (attachment) |
| 2313 | { |
| 2314 | case GL_DEPTH_ATTACHMENT: |
| 2315 | case GL_STENCIL_ATTACHMENT: |
| 2316 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2317 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2318 | case GL_DEPTH_STENCIL_ATTACHMENT: |
| 2319 | if (framebuffer->hasValidDepthStencil()) |
| 2320 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2321 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2322 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2323 | } |
| 2324 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2325 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2326 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2327 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2328 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2329 | } |
| 2330 | } |
| 2331 | } |
| 2332 | |
| 2333 | GLenum attachmentType = GL_NONE; |
| 2334 | GLuint attachmentHandle = 0; |
| 2335 | GLuint attachmentLevel = 0; |
| 2336 | GLuint attachmentLayer = 0; |
| 2337 | |
| 2338 | const gl::FramebufferAttachment *attachmentObject = framebuffer->getAttachment(attachment); |
| 2339 | |
| 2340 | if (attachmentObject) |
| 2341 | { |
| 2342 | attachmentType = attachmentObject->type(); |
| 2343 | attachmentHandle = attachmentObject->id(); |
| 2344 | attachmentLevel = attachmentObject->mipLevel(); |
| 2345 | attachmentLayer = attachmentObject->layer(); |
| 2346 | } |
| 2347 | |
| 2348 | GLenum attachmentObjectType; // Type category |
| 2349 | if (framebufferHandle == 0) |
| 2350 | { |
| 2351 | attachmentObjectType = GL_FRAMEBUFFER_DEFAULT; |
| 2352 | } |
| 2353 | else if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER) |
| 2354 | { |
| 2355 | attachmentObjectType = attachmentType; |
| 2356 | } |
| 2357 | else if (gl::ValidTexture2DDestinationTarget(context, attachmentType)) |
| 2358 | { |
| 2359 | attachmentObjectType = GL_TEXTURE; |
| 2360 | } |
| 2361 | else |
| 2362 | { |
| 2363 | UNREACHABLE(); |
| 2364 | return; |
| 2365 | } |
| 2366 | |
| 2367 | if (attachmentObjectType == GL_NONE) |
| 2368 | { |
| 2369 | // ES 2.0.25 spec pg 127 states that if the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE |
| 2370 | // is NONE, then querying any other pname will generate INVALID_ENUM. |
| 2371 | |
| 2372 | // ES 3.0.2 spec pg 235 states that if the attachment type is none, |
| 2373 | // GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero and be an |
| 2374 | // INVALID_OPERATION for all other pnames |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 2375 | |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2376 | switch (pname) |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2377 | { |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2378 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2379 | *params = attachmentObjectType; |
| 2380 | break; |
| 2381 | |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2382 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
Geoff Lang | 05b0502 | 2014-06-11 15:31:45 -0400 | [diff] [blame] | 2383 | if (clientVersion < 3) |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2384 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2385 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2386 | return; |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2387 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2388 | *params = 0; |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2389 | break; |
| 2390 | |
| 2391 | default: |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 2392 | if (clientVersion < 3) |
shannon.woods%transgaming.com@gtempaccount.com | 89ae113 | 2013-04-13 03:28:43 +0000 | [diff] [blame] | 2393 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2394 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2395 | return; |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2396 | } |
| 2397 | else |
| 2398 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2399 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2400 | return; |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2401 | } |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2402 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2403 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2404 | else |
| 2405 | { |
| 2406 | ASSERT(attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE || |
| 2407 | attachmentObjectType == GL_FRAMEBUFFER_DEFAULT); |
| 2408 | ASSERT(attachmentObject != NULL); |
| 2409 | |
| 2410 | switch (pname) |
| 2411 | { |
| 2412 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2413 | *params = attachmentObjectType; |
| 2414 | break; |
| 2415 | |
| 2416 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2417 | if (attachmentObjectType != GL_RENDERBUFFER && attachmentObjectType != GL_TEXTURE) |
| 2418 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2419 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2420 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2421 | } |
| 2422 | *params = attachmentHandle; |
| 2423 | break; |
| 2424 | |
| 2425 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| 2426 | if (attachmentObjectType != GL_TEXTURE) |
| 2427 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2428 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2429 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2430 | } |
| 2431 | *params = attachmentLevel; |
| 2432 | break; |
| 2433 | |
| 2434 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| 2435 | if (attachmentObjectType != GL_TEXTURE) |
| 2436 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2437 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2438 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2439 | } |
| 2440 | *params = gl::IsCubemapTextureTarget(attachmentType) ? attachmentType : 0; |
| 2441 | break; |
| 2442 | |
| 2443 | case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: |
| 2444 | *params = attachmentObject->getRedSize(); |
| 2445 | break; |
| 2446 | |
| 2447 | case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: |
| 2448 | *params = attachmentObject->getGreenSize(); |
| 2449 | break; |
| 2450 | |
| 2451 | case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: |
| 2452 | *params = attachmentObject->getBlueSize(); |
| 2453 | break; |
| 2454 | |
| 2455 | case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: |
| 2456 | *params = attachmentObject->getAlphaSize(); |
| 2457 | break; |
| 2458 | |
| 2459 | case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: |
| 2460 | *params = attachmentObject->getDepthSize(); |
| 2461 | break; |
| 2462 | |
| 2463 | case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: |
| 2464 | *params = attachmentObject->getStencilSize(); |
| 2465 | break; |
| 2466 | |
| 2467 | case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: |
Jamie Madill | ee85d1b | 2014-09-17 10:35:23 -0400 | [diff] [blame] | 2468 | if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2469 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2470 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2471 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2472 | } |
| 2473 | *params = attachmentObject->getComponentType(); |
| 2474 | break; |
| 2475 | |
| 2476 | case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: |
| 2477 | *params = attachmentObject->getColorEncoding(); |
| 2478 | break; |
| 2479 | |
| 2480 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: |
| 2481 | if (attachmentObjectType != GL_TEXTURE) |
| 2482 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2483 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2484 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2485 | } |
| 2486 | *params = attachmentLayer; |
| 2487 | break; |
| 2488 | |
| 2489 | default: |
| 2490 | UNREACHABLE(); |
| 2491 | break; |
| 2492 | } |
| 2493 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2494 | } |
| 2495 | } |
| 2496 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2497 | GLenum GL_APIENTRY glGetGraphicsResetStatusEXT(void) |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2498 | { |
| 2499 | EVENT("()"); |
| 2500 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2501 | gl::Context *context = gl::getContext(); |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2502 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2503 | if (context) |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2504 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2505 | return context->getResetStatus(); |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2506 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2507 | |
| 2508 | return GL_NO_ERROR; |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2509 | } |
| 2510 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2511 | void GL_APIENTRY glGetIntegerv(GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2512 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2513 | 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] | 2514 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2515 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2516 | if (context) |
| 2517 | { |
| 2518 | GLenum nativeType; |
| 2519 | unsigned int numParams = 0; |
| 2520 | |
| 2521 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2522 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2523 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2524 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2525 | |
| 2526 | if (nativeType == GL_INT) |
| 2527 | { |
| 2528 | context->getIntegerv(pname, params); |
| 2529 | } |
| 2530 | else |
| 2531 | { |
| 2532 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2533 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2534 | } |
| 2535 | } |
| 2536 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2537 | void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2538 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2539 | 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] | 2540 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2541 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2542 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2543 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2544 | gl::Program *programObject = context->getProgram(program); |
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 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2547 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2548 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2549 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2550 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2551 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2552 | if (context->getClientVersion() < 3) |
| 2553 | { |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2554 | switch (pname) |
| 2555 | { |
shannonwoods@chromium.org | e684b58 | 2013-05-30 00:07:42 +0000 | [diff] [blame] | 2556 | case GL_ACTIVE_UNIFORM_BLOCKS: |
shannonwoods@chromium.org | e684b58 | 2013-05-30 00:07:42 +0000 | [diff] [blame] | 2557 | case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2558 | case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2559 | case GL_TRANSFORM_FEEDBACK_VARYINGS: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2560 | case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2561 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2562 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2563 | } |
| 2564 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2565 | |
| 2566 | switch (pname) |
| 2567 | { |
| 2568 | case GL_DELETE_STATUS: |
| 2569 | *params = programObject->isFlaggedForDeletion(); |
| 2570 | return; |
| 2571 | case GL_LINK_STATUS: |
| 2572 | *params = programObject->isLinked(); |
| 2573 | return; |
| 2574 | case GL_VALIDATE_STATUS: |
| 2575 | *params = programObject->isValidated(); |
| 2576 | return; |
| 2577 | case GL_INFO_LOG_LENGTH: |
| 2578 | *params = programObject->getInfoLogLength(); |
| 2579 | return; |
| 2580 | case GL_ATTACHED_SHADERS: |
| 2581 | *params = programObject->getAttachedShadersCount(); |
| 2582 | return; |
| 2583 | case GL_ACTIVE_ATTRIBUTES: |
| 2584 | *params = programObject->getActiveAttributeCount(); |
| 2585 | return; |
| 2586 | case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH: |
| 2587 | *params = programObject->getActiveAttributeMaxLength(); |
| 2588 | return; |
| 2589 | case GL_ACTIVE_UNIFORMS: |
| 2590 | *params = programObject->getActiveUniformCount(); |
| 2591 | return; |
| 2592 | case GL_ACTIVE_UNIFORM_MAX_LENGTH: |
| 2593 | *params = programObject->getActiveUniformMaxLength(); |
| 2594 | return; |
| 2595 | case GL_PROGRAM_BINARY_LENGTH_OES: |
| 2596 | *params = programObject->getProgramBinaryLength(); |
| 2597 | return; |
| 2598 | case GL_ACTIVE_UNIFORM_BLOCKS: |
| 2599 | *params = programObject->getActiveUniformBlockCount(); |
| 2600 | return; |
| 2601 | case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: |
| 2602 | *params = programObject->getActiveUniformBlockMaxLength(); |
| 2603 | break; |
| 2604 | case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: |
| 2605 | *params = programObject->getTransformFeedbackBufferMode(); |
| 2606 | break; |
| 2607 | case GL_TRANSFORM_FEEDBACK_VARYINGS: |
| 2608 | *params = programObject->getTransformFeedbackVaryingCount(); |
| 2609 | break; |
| 2610 | case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: |
| 2611 | *params = programObject->getTransformFeedbackVaryingMaxLength(); |
| 2612 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2613 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2614 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2615 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2616 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2617 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2618 | } |
| 2619 | } |
| 2620 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2621 | 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] | 2622 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2623 | 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] | 2624 | program, bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2625 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2626 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2627 | if (context) |
| 2628 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2629 | if (bufsize < 0) |
| 2630 | { |
| 2631 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2632 | return; |
| 2633 | } |
| 2634 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2635 | gl::Program *programObject = context->getProgram(program); |
| 2636 | |
| 2637 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2638 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2639 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2640 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2641 | } |
| 2642 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2643 | programObject->getInfoLog(bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2644 | } |
| 2645 | } |
| 2646 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2647 | void GL_APIENTRY glGetQueryivEXT(GLenum target, GLenum pname, GLint *params) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2648 | { |
| 2649 | EVENT("GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname, params); |
| 2650 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2651 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2652 | if (context) |
| 2653 | { |
| 2654 | if (!ValidQueryType(context, target)) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2655 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2656 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2657 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2658 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2659 | |
| 2660 | switch (pname) |
| 2661 | { |
| 2662 | case GL_CURRENT_QUERY_EXT: |
| 2663 | params[0] = context->getState().getActiveQueryId(target); |
| 2664 | break; |
| 2665 | |
| 2666 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2667 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2668 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2669 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2670 | } |
| 2671 | } |
| 2672 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2673 | void GL_APIENTRY glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2674 | { |
| 2675 | EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)", id, pname, params); |
| 2676 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2677 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2678 | if (context) |
| 2679 | { |
| 2680 | gl::Query *queryObject = context->getQuery(id, false, GL_NONE); |
| 2681 | |
| 2682 | if (!queryObject) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2683 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2684 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2685 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2686 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2687 | |
| 2688 | if (context->getState().getActiveQueryId(queryObject->getType()) == id) |
| 2689 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2690 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2691 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2692 | } |
| 2693 | |
| 2694 | switch(pname) |
| 2695 | { |
| 2696 | case GL_QUERY_RESULT_EXT: |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2697 | { |
| 2698 | gl::Error error = queryObject->getResult(params); |
| 2699 | if (error.isError()) |
| 2700 | { |
| 2701 | context->recordError(error); |
| 2702 | return; |
| 2703 | } |
| 2704 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2705 | break; |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2706 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2707 | case GL_QUERY_RESULT_AVAILABLE_EXT: |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2708 | { |
| 2709 | gl::Error error = queryObject->isResultAvailable(params); |
| 2710 | if (error.isError()) |
| 2711 | { |
| 2712 | context->recordError(error); |
| 2713 | return; |
| 2714 | } |
| 2715 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2716 | break; |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 2717 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2718 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2719 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2720 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2721 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2722 | } |
| 2723 | } |
| 2724 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2725 | void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2726 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2727 | 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] | 2728 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2729 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2730 | if (context) |
| 2731 | { |
| 2732 | if (target != GL_RENDERBUFFER) |
daniel@transgaming.com | 4901fca | 2010-04-20 18:52:41 +0000 | [diff] [blame] | 2733 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2734 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2735 | return; |
daniel@transgaming.com | 4901fca | 2010-04-20 18:52:41 +0000 | [diff] [blame] | 2736 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2737 | |
| 2738 | if (context->getState().getRenderbufferId() == 0) |
| 2739 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2740 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2741 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2742 | } |
| 2743 | |
| 2744 | gl::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getState().getRenderbufferId()); |
| 2745 | |
| 2746 | switch (pname) |
| 2747 | { |
| 2748 | case GL_RENDERBUFFER_WIDTH: *params = renderbuffer->getWidth(); break; |
| 2749 | case GL_RENDERBUFFER_HEIGHT: *params = renderbuffer->getHeight(); break; |
| 2750 | case GL_RENDERBUFFER_INTERNAL_FORMAT: *params = renderbuffer->getInternalFormat(); break; |
| 2751 | case GL_RENDERBUFFER_RED_SIZE: *params = renderbuffer->getRedSize(); break; |
| 2752 | case GL_RENDERBUFFER_GREEN_SIZE: *params = renderbuffer->getGreenSize(); break; |
| 2753 | case GL_RENDERBUFFER_BLUE_SIZE: *params = renderbuffer->getBlueSize(); break; |
| 2754 | case GL_RENDERBUFFER_ALPHA_SIZE: *params = renderbuffer->getAlphaSize(); break; |
| 2755 | case GL_RENDERBUFFER_DEPTH_SIZE: *params = renderbuffer->getDepthSize(); break; |
| 2756 | case GL_RENDERBUFFER_STENCIL_SIZE: *params = renderbuffer->getStencilSize(); break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2757 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2758 | case GL_RENDERBUFFER_SAMPLES_ANGLE: |
| 2759 | if (!context->getExtensions().framebufferMultisample) |
| 2760 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2761 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2762 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2763 | } |
| 2764 | *params = renderbuffer->getSamples(); |
| 2765 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2766 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2767 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2768 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2769 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2770 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2771 | } |
| 2772 | } |
| 2773 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2774 | void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2775 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2776 | 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] | 2777 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2778 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2779 | if (context) |
| 2780 | { |
| 2781 | gl::Shader *shaderObject = context->getShader(shader); |
| 2782 | |
| 2783 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2784 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2785 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2786 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2787 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2788 | |
| 2789 | switch (pname) |
| 2790 | { |
| 2791 | case GL_SHADER_TYPE: |
| 2792 | *params = shaderObject->getType(); |
| 2793 | return; |
| 2794 | case GL_DELETE_STATUS: |
| 2795 | *params = shaderObject->isFlaggedForDeletion(); |
| 2796 | return; |
| 2797 | case GL_COMPILE_STATUS: |
| 2798 | *params = shaderObject->isCompiled() ? GL_TRUE : GL_FALSE; |
| 2799 | return; |
| 2800 | case GL_INFO_LOG_LENGTH: |
| 2801 | *params = shaderObject->getInfoLogLength(); |
| 2802 | return; |
| 2803 | case GL_SHADER_SOURCE_LENGTH: |
| 2804 | *params = shaderObject->getSourceLength(); |
| 2805 | return; |
| 2806 | case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: |
| 2807 | *params = shaderObject->getTranslatedSourceLength(); |
| 2808 | return; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2809 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2810 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2811 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2812 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2813 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2814 | } |
| 2815 | } |
| 2816 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2817 | 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] | 2818 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2819 | 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] | 2820 | shader, bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2821 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2822 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2823 | if (context) |
| 2824 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2825 | if (bufsize < 0) |
| 2826 | { |
| 2827 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2828 | return; |
| 2829 | } |
| 2830 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2831 | gl::Shader *shaderObject = context->getShader(shader); |
| 2832 | |
| 2833 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2834 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2835 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2836 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2837 | } |
| 2838 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2839 | shaderObject->getInfoLog(bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2840 | } |
| 2841 | } |
| 2842 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2843 | void GL_APIENTRY glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2844 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2845 | EVENT("(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] | 2846 | shadertype, precisiontype, range, precision); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2847 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2848 | gl::Context *context = gl::getNonLostContext(); |
| 2849 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2850 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2851 | switch (shadertype) |
| 2852 | { |
| 2853 | case GL_VERTEX_SHADER: |
| 2854 | case GL_FRAGMENT_SHADER: |
| 2855 | break; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2856 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2857 | default: |
| 2858 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2859 | return; |
| 2860 | } |
| 2861 | |
| 2862 | switch (precisiontype) |
| 2863 | { |
| 2864 | case GL_LOW_FLOAT: |
| 2865 | case GL_MEDIUM_FLOAT: |
| 2866 | case GL_HIGH_FLOAT: |
| 2867 | // Assume IEEE 754 precision |
| 2868 | range[0] = 127; |
| 2869 | range[1] = 127; |
| 2870 | *precision = 23; |
| 2871 | break; |
| 2872 | |
| 2873 | case GL_LOW_INT: |
| 2874 | case GL_MEDIUM_INT: |
| 2875 | case GL_HIGH_INT: |
| 2876 | // Some (most) hardware only supports single-precision floating-point numbers, |
| 2877 | // which can accurately represent integers up to +/-16777216 |
| 2878 | range[0] = 24; |
| 2879 | range[1] = 24; |
| 2880 | *precision = 0; |
| 2881 | break; |
| 2882 | |
| 2883 | default: |
| 2884 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2885 | return; |
| 2886 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2887 | } |
| 2888 | } |
| 2889 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2890 | 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] | 2891 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2892 | 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] | 2893 | shader, bufsize, length, source); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2894 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2895 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2896 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2897 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2898 | if (bufsize < 0) |
| 2899 | { |
| 2900 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2901 | return; |
| 2902 | } |
| 2903 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2904 | gl::Shader *shaderObject = context->getShader(shader); |
| 2905 | |
| 2906 | if (!shaderObject) |
| 2907 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2908 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2909 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2910 | } |
| 2911 | |
| 2912 | shaderObject->getSource(bufsize, length, source); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2913 | } |
| 2914 | } |
| 2915 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2916 | 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] | 2917 | { |
| 2918 | EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)", |
| 2919 | shader, bufsize, length, source); |
| 2920 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2921 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2922 | if (context) |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2923 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2924 | if (bufsize < 0) |
| 2925 | { |
| 2926 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2927 | return; |
| 2928 | } |
| 2929 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2930 | gl::Shader *shaderObject = context->getShader(shader); |
| 2931 | |
| 2932 | if (!shaderObject) |
| 2933 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2934 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2935 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2936 | } |
| 2937 | |
Tibor den Ouden | 97049c6 | 2014-10-06 21:39:16 +0200 | [diff] [blame] | 2938 | // Only returns extra info if ANGLE_GENERATE_SHADER_DEBUG_INFO is defined |
| 2939 | shaderObject->getTranslatedSourceWithDebugInfo(bufsize, length, source); |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2940 | } |
| 2941 | } |
| 2942 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2943 | const GLubyte* GL_APIENTRY glGetString(GLenum name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2944 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2945 | EVENT("(GLenum name = 0x%X)", name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2946 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2947 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 3e4c600 | 2010-05-05 18:50:13 +0000 | [diff] [blame] | 2948 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2949 | switch (name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2950 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2951 | case GL_VENDOR: |
| 2952 | return (GLubyte*)"Google Inc."; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2953 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2954 | case GL_RENDERER: |
| 2955 | return (GLubyte*)((context != NULL) ? context->getRendererString().c_str() : "ANGLE"); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2956 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2957 | case GL_VERSION: |
| 2958 | if (context->getClientVersion() == 2) |
| 2959 | { |
| 2960 | return (GLubyte*)"OpenGL ES 2.0 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2961 | } |
| 2962 | else |
| 2963 | { |
| 2964 | return (GLubyte*)"OpenGL ES 3.0 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2965 | } |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2966 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2967 | case GL_SHADING_LANGUAGE_VERSION: |
| 2968 | if (context->getClientVersion() == 2) |
| 2969 | { |
| 2970 | return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2971 | } |
| 2972 | else |
| 2973 | { |
| 2974 | return (GLubyte*)"OpenGL ES GLSL ES 3.00 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2975 | } |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2976 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2977 | case GL_EXTENSIONS: |
| 2978 | return (GLubyte*)((context != NULL) ? context->getExtensionString().c_str() : ""); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2979 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2980 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2981 | if (context) |
| 2982 | { |
| 2983 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2984 | } |
| 2985 | return NULL; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2986 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2987 | } |
| 2988 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 2989 | void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2990 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2991 | 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] | 2992 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2993 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2994 | if (context) |
| 2995 | { |
| 2996 | gl::Texture *texture = context->getTargetTexture(target); |
| 2997 | |
| 2998 | if (!texture) |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 2999 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3000 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3001 | return; |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 3002 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3003 | |
| 3004 | switch (pname) |
| 3005 | { |
| 3006 | case GL_TEXTURE_MAG_FILTER: |
| 3007 | *params = (GLfloat)texture->getSamplerState().magFilter; |
| 3008 | break; |
| 3009 | case GL_TEXTURE_MIN_FILTER: |
| 3010 | *params = (GLfloat)texture->getSamplerState().minFilter; |
| 3011 | break; |
| 3012 | case GL_TEXTURE_WRAP_S: |
| 3013 | *params = (GLfloat)texture->getSamplerState().wrapS; |
| 3014 | break; |
| 3015 | case GL_TEXTURE_WRAP_T: |
| 3016 | *params = (GLfloat)texture->getSamplerState().wrapT; |
| 3017 | break; |
| 3018 | case GL_TEXTURE_WRAP_R: |
| 3019 | if (context->getClientVersion() < 3) |
| 3020 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3021 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3022 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3023 | } |
| 3024 | *params = (GLfloat)texture->getSamplerState().wrapR; |
| 3025 | break; |
| 3026 | case GL_TEXTURE_IMMUTABLE_FORMAT: |
| 3027 | // Exposed to ES2.0 through EXT_texture_storage, no client version validation. |
| 3028 | *params = (GLfloat)(texture->isImmutable() ? GL_TRUE : GL_FALSE); |
| 3029 | break; |
| 3030 | case GL_TEXTURE_IMMUTABLE_LEVELS: |
| 3031 | if (context->getClientVersion() < 3) |
| 3032 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3033 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3034 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3035 | } |
| 3036 | *params = (GLfloat)texture->immutableLevelCount(); |
| 3037 | break; |
| 3038 | case GL_TEXTURE_USAGE_ANGLE: |
| 3039 | *params = (GLfloat)texture->getUsage(); |
| 3040 | break; |
| 3041 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
| 3042 | if (!context->getExtensions().textureFilterAnisotropic) |
| 3043 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3044 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3045 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3046 | } |
| 3047 | *params = (GLfloat)texture->getSamplerState().maxAnisotropy; |
| 3048 | break; |
| 3049 | case GL_TEXTURE_SWIZZLE_R: |
| 3050 | if (context->getClientVersion() < 3) |
| 3051 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3052 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3053 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3054 | } |
| 3055 | *params = (GLfloat)texture->getSamplerState().swizzleRed; |
| 3056 | break; |
| 3057 | case GL_TEXTURE_SWIZZLE_G: |
| 3058 | if (context->getClientVersion() < 3) |
| 3059 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3060 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3061 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3062 | } |
| 3063 | *params = (GLfloat)texture->getSamplerState().swizzleGreen; |
| 3064 | break; |
| 3065 | case GL_TEXTURE_SWIZZLE_B: |
| 3066 | if (context->getClientVersion() < 3) |
| 3067 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3068 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3069 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3070 | } |
| 3071 | *params = (GLfloat)texture->getSamplerState().swizzleBlue; |
| 3072 | break; |
| 3073 | case GL_TEXTURE_SWIZZLE_A: |
| 3074 | if (context->getClientVersion() < 3) |
| 3075 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3076 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3077 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3078 | } |
| 3079 | *params = (GLfloat)texture->getSamplerState().swizzleAlpha; |
| 3080 | break; |
| 3081 | case GL_TEXTURE_BASE_LEVEL: |
| 3082 | if (context->getClientVersion() < 3) |
| 3083 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3084 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3085 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3086 | } |
| 3087 | *params = (GLfloat)texture->getSamplerState().baseLevel; |
| 3088 | break; |
| 3089 | case GL_TEXTURE_MAX_LEVEL: |
| 3090 | if (context->getClientVersion() < 3) |
| 3091 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3092 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3093 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3094 | } |
| 3095 | *params = (GLfloat)texture->getSamplerState().maxLevel; |
| 3096 | break; |
| 3097 | case GL_TEXTURE_MIN_LOD: |
| 3098 | if (context->getClientVersion() < 3) |
| 3099 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3100 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3101 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3102 | } |
| 3103 | *params = texture->getSamplerState().minLod; |
| 3104 | break; |
| 3105 | case GL_TEXTURE_MAX_LOD: |
| 3106 | if (context->getClientVersion() < 3) |
| 3107 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3108 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3109 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3110 | } |
| 3111 | *params = texture->getSamplerState().maxLod; |
| 3112 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3113 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3114 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3115 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3116 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3117 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3118 | } |
| 3119 | } |
| 3120 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3121 | void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3122 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3123 | 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] | 3124 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3125 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3126 | if (context) |
| 3127 | { |
| 3128 | gl::Texture *texture = context->getTargetTexture(target); |
| 3129 | |
| 3130 | if (!texture) |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 3131 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3132 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3133 | return; |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 3134 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3135 | |
| 3136 | switch (pname) |
| 3137 | { |
| 3138 | case GL_TEXTURE_MAG_FILTER: |
| 3139 | *params = texture->getSamplerState().magFilter; |
| 3140 | break; |
| 3141 | case GL_TEXTURE_MIN_FILTER: |
| 3142 | *params = texture->getSamplerState().minFilter; |
| 3143 | break; |
| 3144 | case GL_TEXTURE_WRAP_S: |
| 3145 | *params = texture->getSamplerState().wrapS; |
| 3146 | break; |
| 3147 | case GL_TEXTURE_WRAP_T: |
| 3148 | *params = texture->getSamplerState().wrapT; |
| 3149 | break; |
| 3150 | case GL_TEXTURE_WRAP_R: |
| 3151 | if (context->getClientVersion() < 3) |
| 3152 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3153 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3154 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3155 | } |
| 3156 | *params = texture->getSamplerState().wrapR; |
| 3157 | break; |
| 3158 | case GL_TEXTURE_IMMUTABLE_FORMAT: |
| 3159 | // Exposed to ES2.0 through EXT_texture_storage, no client version validation. |
| 3160 | *params = texture->isImmutable() ? GL_TRUE : GL_FALSE; |
| 3161 | break; |
| 3162 | case GL_TEXTURE_IMMUTABLE_LEVELS: |
| 3163 | if (context->getClientVersion() < 3) |
| 3164 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3165 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3166 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3167 | } |
Jamie Madill | 6948e30 | 2014-10-20 17:04:33 -0400 | [diff] [blame] | 3168 | *params = static_cast<GLint>(texture->immutableLevelCount()); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3169 | break; |
| 3170 | case GL_TEXTURE_USAGE_ANGLE: |
| 3171 | *params = texture->getUsage(); |
| 3172 | break; |
| 3173 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
| 3174 | if (!context->getExtensions().textureFilterAnisotropic) |
| 3175 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3176 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3177 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3178 | } |
| 3179 | *params = (GLint)texture->getSamplerState().maxAnisotropy; |
| 3180 | break; |
| 3181 | case GL_TEXTURE_SWIZZLE_R: |
| 3182 | if (context->getClientVersion() < 3) |
| 3183 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3184 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3185 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3186 | } |
| 3187 | *params = texture->getSamplerState().swizzleRed; |
| 3188 | break; |
| 3189 | case GL_TEXTURE_SWIZZLE_G: |
| 3190 | if (context->getClientVersion() < 3) |
| 3191 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3192 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3193 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3194 | } |
| 3195 | *params = texture->getSamplerState().swizzleGreen; |
| 3196 | break; |
| 3197 | case GL_TEXTURE_SWIZZLE_B: |
| 3198 | if (context->getClientVersion() < 3) |
| 3199 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3200 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3201 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3202 | } |
| 3203 | *params = texture->getSamplerState().swizzleBlue; |
| 3204 | break; |
| 3205 | case GL_TEXTURE_SWIZZLE_A: |
| 3206 | if (context->getClientVersion() < 3) |
| 3207 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3208 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3209 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3210 | } |
| 3211 | *params = texture->getSamplerState().swizzleAlpha; |
| 3212 | break; |
| 3213 | case GL_TEXTURE_BASE_LEVEL: |
| 3214 | if (context->getClientVersion() < 3) |
| 3215 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3216 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3217 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3218 | } |
| 3219 | *params = texture->getSamplerState().baseLevel; |
| 3220 | break; |
| 3221 | case GL_TEXTURE_MAX_LEVEL: |
| 3222 | if (context->getClientVersion() < 3) |
| 3223 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3224 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3225 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3226 | } |
| 3227 | *params = texture->getSamplerState().maxLevel; |
| 3228 | break; |
| 3229 | case GL_TEXTURE_MIN_LOD: |
| 3230 | if (context->getClientVersion() < 3) |
| 3231 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3232 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3233 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3234 | } |
| 3235 | *params = (GLint)texture->getSamplerState().minLod; |
| 3236 | break; |
| 3237 | case GL_TEXTURE_MAX_LOD: |
| 3238 | if (context->getClientVersion() < 3) |
| 3239 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3240 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3241 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3242 | } |
| 3243 | *params = (GLint)texture->getSamplerState().maxLod; |
| 3244 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3245 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3246 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3247 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3248 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3249 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3250 | } |
| 3251 | } |
| 3252 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3253 | 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] | 3254 | { |
| 3255 | EVENT("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLfloat* params = 0x%0.8p)", |
| 3256 | program, location, bufSize, params); |
| 3257 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3258 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3259 | if (context) |
| 3260 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3261 | if (!ValidateGetnUniformfvEXT(context, program, location, bufSize, params)) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3262 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3263 | return; |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3264 | } |
| 3265 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3266 | gl::Program *programObject = context->getProgram(program); |
| 3267 | ASSERT(programObject); |
| 3268 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3269 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3270 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3271 | programBinary->getUniformfv(location, params); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3272 | } |
| 3273 | } |
| 3274 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3275 | void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3276 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3277 | 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] | 3278 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3279 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3280 | if (context) |
| 3281 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3282 | if (!ValidateGetUniformfv(context, program, location, params)) |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3283 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3284 | return; |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3285 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3286 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3287 | gl::Program *programObject = context->getProgram(program); |
| 3288 | ASSERT(programObject); |
| 3289 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3290 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3291 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3292 | programBinary->getUniformfv(location, params); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3293 | } |
| 3294 | } |
| 3295 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3296 | 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] | 3297 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3298 | 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] | 3299 | program, location, bufSize, params); |
| 3300 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3301 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3302 | if (context) |
| 3303 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3304 | if (!ValidateGetnUniformivEXT(context, program, location, bufSize, params)) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3305 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3306 | return; |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3307 | } |
| 3308 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3309 | gl::Program *programObject = context->getProgram(program); |
| 3310 | ASSERT(programObject); |
| 3311 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3312 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3313 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3314 | programBinary->getUniformiv(location, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3315 | } |
| 3316 | } |
| 3317 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3318 | void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3319 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3320 | 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] | 3321 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3322 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3323 | if (context) |
| 3324 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3325 | if (!ValidateGetUniformiv(context, program, location, params)) |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3326 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3327 | return; |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3328 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3329 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3330 | gl::Program *programObject = context->getProgram(program); |
| 3331 | ASSERT(programObject); |
| 3332 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3333 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3334 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3335 | programBinary->getUniformiv(location, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3336 | } |
| 3337 | } |
| 3338 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3339 | GLint GL_APIENTRY glGetUniformLocation(GLuint program, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3340 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3341 | 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] | 3342 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3343 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3344 | if (context) |
| 3345 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3346 | if (strstr(name, "gl_") == name) |
| 3347 | { |
| 3348 | return -1; |
| 3349 | } |
| 3350 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3351 | gl::Program *programObject = context->getProgram(program); |
| 3352 | |
| 3353 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3354 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3355 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3356 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3357 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3358 | return -1; |
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 | else |
| 3361 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3362 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3363 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3364 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3365 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3366 | |
| 3367 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 3368 | if (!programObject->isLinked() || !programBinary) |
| 3369 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3370 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3371 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3372 | } |
| 3373 | |
| 3374 | return programBinary->getUniformLocation(name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3375 | } |
| 3376 | |
| 3377 | return -1; |
| 3378 | } |
| 3379 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3380 | void GL_APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3381 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3382 | 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] | 3383 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3384 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3385 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3386 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3387 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3388 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3389 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3390 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3391 | } |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3392 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3393 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3394 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3395 | { |
| 3396 | return; |
| 3397 | } |
daniel@transgaming.com | 428d158 | 2010-05-04 03:35:25 +0000 | [diff] [blame] | 3398 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3399 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 3400 | { |
| 3401 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 3402 | for (int i = 0; i < 4; ++i) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3403 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3404 | params[i] = currentValueData.FloatValues[i]; |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3405 | } |
| 3406 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3407 | else |
| 3408 | { |
| 3409 | *params = gl::QuerySingleVertexAttributeParameter<GLfloat>(attribState, pname); |
| 3410 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3411 | } |
| 3412 | } |
| 3413 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3414 | void GL_APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3415 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3416 | 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] | 3417 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3418 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3419 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3420 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3421 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3422 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3423 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3424 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3425 | } |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3426 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3427 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
daniel@transgaming.com | 428d158 | 2010-05-04 03:35:25 +0000 | [diff] [blame] | 3428 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3429 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3430 | { |
| 3431 | return; |
| 3432 | } |
Jamie Madill | aff7150 | 2013-07-02 11:57:05 -0400 | [diff] [blame] | 3433 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3434 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 3435 | { |
| 3436 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 3437 | for (int i = 0; i < 4; ++i) |
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 | float currentValue = currentValueData.FloatValues[i]; |
| 3440 | params[i] = gl::iround<GLint>(currentValue); |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3441 | } |
| 3442 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3443 | else |
| 3444 | { |
| 3445 | *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname); |
| 3446 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3447 | } |
| 3448 | } |
| 3449 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3450 | void GL_APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3451 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3452 | 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] | 3453 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3454 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3455 | if (context) |
| 3456 | { |
| 3457 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3458 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3459 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3460 | return; |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3461 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3462 | |
| 3463 | if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER) |
| 3464 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3465 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3466 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3467 | } |
| 3468 | |
| 3469 | *pointer = const_cast<GLvoid*>(context->getState().getVertexAttribPointer(index)); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3470 | } |
| 3471 | } |
| 3472 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3473 | void GL_APIENTRY glHint(GLenum target, GLenum mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3474 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3475 | EVENT("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3476 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3477 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3478 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3479 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3480 | switch (mode) |
| 3481 | { |
| 3482 | case GL_FASTEST: |
| 3483 | case GL_NICEST: |
| 3484 | case GL_DONT_CARE: |
| 3485 | break; |
| 3486 | |
| 3487 | default: |
| 3488 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3489 | return; |
| 3490 | } |
| 3491 | |
| 3492 | switch (target) |
| 3493 | { |
| 3494 | case GL_GENERATE_MIPMAP_HINT: |
| 3495 | context->getState().setGenerateMipmapHint(mode); |
| 3496 | break; |
| 3497 | |
| 3498 | case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: |
| 3499 | context->getState().setFragmentShaderDerivativeHint(mode); |
| 3500 | break; |
| 3501 | |
| 3502 | default: |
| 3503 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3504 | return; |
| 3505 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3506 | } |
| 3507 | } |
| 3508 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3509 | GLboolean GL_APIENTRY glIsBuffer(GLuint buffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3510 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3511 | EVENT("(GLuint buffer = %d)", buffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3512 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3513 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3514 | if (context && buffer) |
| 3515 | { |
| 3516 | gl::Buffer *bufferObject = context->getBuffer(buffer); |
| 3517 | |
| 3518 | if (bufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3519 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3520 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3521 | } |
| 3522 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3523 | |
| 3524 | return GL_FALSE; |
| 3525 | } |
| 3526 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3527 | GLboolean GL_APIENTRY glIsEnabled(GLenum cap) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3528 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3529 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3530 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3531 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3532 | if (context) |
| 3533 | { |
| 3534 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3535 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3536 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3537 | return GL_FALSE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3538 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3539 | |
| 3540 | return context->getState().getEnableFeature(cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3541 | } |
| 3542 | |
| 3543 | return false; |
| 3544 | } |
| 3545 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3546 | GLboolean GL_APIENTRY glIsFenceNV(GLuint fence) |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3547 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3548 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3549 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3550 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3551 | if (context) |
| 3552 | { |
| 3553 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 3554 | |
| 3555 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3556 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3557 | return GL_FALSE; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3558 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3559 | |
| 3560 | return fenceObject->isFence(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3561 | } |
| 3562 | |
| 3563 | return GL_FALSE; |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3564 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3565 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3566 | GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3567 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3568 | EVENT("(GLuint framebuffer = %d)", framebuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3569 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3570 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3571 | if (context && framebuffer) |
| 3572 | { |
| 3573 | gl::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer); |
| 3574 | |
| 3575 | if (framebufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3576 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3577 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3578 | } |
| 3579 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3580 | |
| 3581 | return GL_FALSE; |
| 3582 | } |
| 3583 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3584 | GLboolean GL_APIENTRY glIsProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3585 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3586 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3587 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3588 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3589 | if (context && program) |
| 3590 | { |
| 3591 | gl::Program *programObject = context->getProgram(program); |
| 3592 | |
| 3593 | if (programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3594 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3595 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3596 | } |
| 3597 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3598 | |
| 3599 | return GL_FALSE; |
| 3600 | } |
| 3601 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3602 | GLboolean GL_APIENTRY glIsQueryEXT(GLuint id) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 3603 | { |
| 3604 | EVENT("(GLuint id = %d)", id); |
| 3605 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3606 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3607 | if (context) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 3608 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3609 | 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] | 3610 | } |
| 3611 | |
| 3612 | return GL_FALSE; |
| 3613 | } |
| 3614 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3615 | GLboolean GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3616 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3617 | EVENT("(GLuint renderbuffer = %d)", renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3618 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3619 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3620 | if (context && renderbuffer) |
| 3621 | { |
| 3622 | gl::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer); |
| 3623 | |
| 3624 | if (renderbufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3625 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3626 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3627 | } |
| 3628 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3629 | |
| 3630 | return GL_FALSE; |
| 3631 | } |
| 3632 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3633 | GLboolean GL_APIENTRY glIsShader(GLuint shader) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3634 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3635 | EVENT("(GLuint shader = %d)", shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3636 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3637 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3638 | if (context && shader) |
| 3639 | { |
| 3640 | gl::Shader *shaderObject = context->getShader(shader); |
| 3641 | |
| 3642 | if (shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3643 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3644 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3645 | } |
| 3646 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3647 | |
| 3648 | return GL_FALSE; |
| 3649 | } |
| 3650 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3651 | GLboolean GL_APIENTRY glIsTexture(GLuint texture) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3652 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3653 | EVENT("(GLuint texture = %d)", texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3654 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3655 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3656 | if (context && texture) |
| 3657 | { |
| 3658 | gl::Texture *textureObject = context->getTexture(texture); |
| 3659 | |
| 3660 | if (textureObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3661 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3662 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3663 | } |
| 3664 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3665 | |
| 3666 | return GL_FALSE; |
| 3667 | } |
| 3668 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3669 | void GL_APIENTRY glLineWidth(GLfloat width) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3670 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3671 | EVENT("(GLfloat width = %f)", width); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3672 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3673 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3674 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3675 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3676 | if (width <= 0.0f) |
| 3677 | { |
| 3678 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3679 | return; |
| 3680 | } |
| 3681 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3682 | context->getState().setLineWidth(width); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3683 | } |
| 3684 | } |
| 3685 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3686 | void GL_APIENTRY glLinkProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3687 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3688 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3689 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3690 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3691 | if (context) |
| 3692 | { |
| 3693 | gl::Program *programObject = context->getProgram(program); |
| 3694 | |
| 3695 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3696 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3697 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3698 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3699 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3700 | return; |
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 | else |
| 3703 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3704 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3705 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3706 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3707 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3708 | |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 3709 | gl::Error error = context->linkProgram(program); |
| 3710 | if (error.isError()) |
| 3711 | { |
| 3712 | context->recordError(error); |
| 3713 | return; |
| 3714 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3715 | } |
| 3716 | } |
| 3717 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3718 | void GL_APIENTRY glPixelStorei(GLenum pname, GLint param) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3719 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3720 | EVENT("(GLenum pname = 0x%X, GLint param = %d)", pname, param); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3721 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3722 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3723 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3724 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3725 | switch (pname) |
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 | case GL_UNPACK_ALIGNMENT: |
| 3728 | if (param != 1 && param != 2 && param != 4 && param != 8) |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3729 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3730 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3731 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3732 | } |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3733 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3734 | context->getState().setUnpackAlignment(param); |
| 3735 | break; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3736 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3737 | case GL_PACK_ALIGNMENT: |
| 3738 | if (param != 1 && param != 2 && param != 4 && param != 8) |
| 3739 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3740 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3741 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3742 | } |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3743 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3744 | context->getState().setPackAlignment(param); |
| 3745 | break; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3746 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3747 | case GL_PACK_REVERSE_ROW_ORDER_ANGLE: |
| 3748 | context->getState().setPackReverseRowOrder(param != 0); |
| 3749 | break; |
bsalomon@google.com | 56d46ab | 2011-11-23 14:53:10 +0000 | [diff] [blame] | 3750 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3751 | case GL_UNPACK_IMAGE_HEIGHT: |
| 3752 | case GL_UNPACK_SKIP_IMAGES: |
| 3753 | case GL_UNPACK_ROW_LENGTH: |
| 3754 | case GL_UNPACK_SKIP_ROWS: |
| 3755 | case GL_UNPACK_SKIP_PIXELS: |
| 3756 | case GL_PACK_ROW_LENGTH: |
| 3757 | case GL_PACK_SKIP_ROWS: |
| 3758 | case GL_PACK_SKIP_PIXELS: |
| 3759 | if (context->getClientVersion() < 3) |
| 3760 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3761 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3762 | return; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3763 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3764 | UNIMPLEMENTED(); |
| 3765 | break; |
| 3766 | |
| 3767 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3768 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3769 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3770 | } |
| 3771 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3772 | } |
| 3773 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3774 | void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3775 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3776 | EVENT("(GLfloat factor = %f, GLfloat units = %f)", factor, units); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3777 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3778 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3779 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3780 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3781 | context->getState().setPolygonOffsetParams(factor, units); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3782 | } |
| 3783 | } |
| 3784 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3785 | 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] | 3786 | GLenum format, GLenum type, GLsizei bufSize, |
| 3787 | GLvoid *data) |
| 3788 | { |
| 3789 | EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, " |
| 3790 | "GLenum format = 0x%X, GLenum type = 0x%X, GLsizei bufSize = 0x%d, GLvoid *data = 0x%0.8p)", |
| 3791 | x, y, width, height, format, type, bufSize, data); |
| 3792 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3793 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3794 | if (context) |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3795 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3796 | if (width < 0 || height < 0 || bufSize < 0) |
| 3797 | { |
| 3798 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3799 | return; |
| 3800 | } |
| 3801 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3802 | if (!gl::ValidateReadPixelsParameters(context, x, y, width, height, |
| 3803 | format, type, &bufSize, data)) |
| 3804 | { |
| 3805 | return; |
| 3806 | } |
| 3807 | |
Geoff Lang | 63d2fc7 | 2014-07-25 14:51:41 -0400 | [diff] [blame] | 3808 | gl::Error error = context->readPixels(x, y, width, height, format, type, &bufSize, data); |
| 3809 | if (error.isError()) |
| 3810 | { |
| 3811 | context->recordError(error); |
| 3812 | return; |
| 3813 | } |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3814 | } |
| 3815 | } |
| 3816 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3817 | 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] | 3818 | GLenum format, GLenum type, GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3819 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3820 | 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] | 3821 | "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] | 3822 | x, y, width, height, format, type, pixels); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3823 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3824 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3825 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3826 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3827 | if (width < 0 || height < 0) |
| 3828 | { |
| 3829 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3830 | return; |
| 3831 | } |
| 3832 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3833 | if (!gl::ValidateReadPixelsParameters(context, x, y, width, height, |
| 3834 | format, type, NULL, pixels)) |
| 3835 | { |
| 3836 | return; |
| 3837 | } |
| 3838 | |
Geoff Lang | 63d2fc7 | 2014-07-25 14:51:41 -0400 | [diff] [blame] | 3839 | gl::Error error = context->readPixels(x, y, width, height, format, type, NULL, pixels); |
| 3840 | if (error.isError()) |
| 3841 | { |
| 3842 | context->recordError(error); |
| 3843 | return; |
| 3844 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3845 | } |
| 3846 | } |
| 3847 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3848 | void GL_APIENTRY glReleaseShaderCompiler(void) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3849 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3850 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3851 | |
Brandon Jones | f05cdee | 2014-08-27 15:24:07 -0700 | [diff] [blame] | 3852 | gl::Context *context = gl::getNonLostContext(); |
| 3853 | |
| 3854 | if (context) |
| 3855 | { |
| 3856 | context->releaseShaderCompiler(); |
| 3857 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3858 | } |
| 3859 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3860 | 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] | 3861 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3862 | 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] | 3863 | target, samples, internalformat, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3864 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3865 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3866 | if (context) |
| 3867 | { |
| 3868 | if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat, |
| 3869 | width, height, true)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3870 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3871 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3872 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3873 | |
| 3874 | context->setRenderbufferStorage(width, height, internalformat, samples); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3875 | } |
| 3876 | } |
| 3877 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3878 | 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] | 3879 | { |
| 3880 | glRenderbufferStorageMultisampleANGLE(target, 0, internalformat, width, height); |
| 3881 | } |
| 3882 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3883 | void GL_APIENTRY glSampleCoverage(GLclampf value, GLboolean invert) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3884 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 3885 | EVENT("(GLclampf value = %f, GLboolean invert = %u)", value, invert); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3886 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3887 | gl::Context* context = gl::getNonLostContext(); |
daniel@transgaming.com | fab5a1a | 2010-03-11 19:22:30 +0000 | [diff] [blame] | 3888 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3889 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3890 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3891 | context->getState().setSampleCoverageParams(gl::clamp01(value), invert == GL_TRUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3892 | } |
| 3893 | } |
| 3894 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3895 | void GL_APIENTRY glSetFenceNV(GLuint fence, GLenum condition) |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3896 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3897 | EVENT("(GLuint fence = %d, GLenum condition = 0x%X)", fence, condition); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3898 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3899 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3900 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3901 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3902 | if (condition != GL_ALL_COMPLETED_NV) |
| 3903 | { |
| 3904 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3905 | return; |
| 3906 | } |
| 3907 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3908 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 3909 | |
| 3910 | if (fenceObject == NULL) |
| 3911 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3912 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3913 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3914 | } |
| 3915 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 3916 | gl::Error error = fenceObject->setFence(condition); |
| 3917 | if (error.isError()) |
| 3918 | { |
| 3919 | context->recordError(error); |
| 3920 | return; |
| 3921 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3922 | } |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3923 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3924 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3925 | 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] | 3926 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3927 | 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] | 3928 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3929 | gl::Context* context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3930 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3931 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3932 | if (width < 0 || height < 0) |
| 3933 | { |
| 3934 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3935 | return; |
| 3936 | } |
| 3937 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3938 | context->getState().setScissorParams(x, y, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3939 | } |
| 3940 | } |
| 3941 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3942 | 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] | 3943 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3944 | 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] | 3945 | "const GLvoid* binary = 0x%0.8p, GLsizei length = %d)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 3946 | n, shaders, binaryformat, binary, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3947 | |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 3948 | gl::Context* context = gl::getNonLostContext(); |
| 3949 | if (context) |
| 3950 | { |
| 3951 | const std::vector<GLenum> &shaderBinaryFormats = context->getCaps().shaderBinaryFormats; |
| 3952 | if (std::find(shaderBinaryFormats.begin(), shaderBinaryFormats.end(), binaryformat) == shaderBinaryFormats.end()) |
| 3953 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3954 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3955 | return; |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 3956 | } |
| 3957 | |
| 3958 | // No binary shader formats are supported. |
| 3959 | UNIMPLEMENTED(); |
| 3960 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3961 | } |
| 3962 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3963 | 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] | 3964 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3965 | 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] | 3966 | shader, count, string, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3967 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3968 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3969 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3970 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3971 | if (count < 0) |
| 3972 | { |
| 3973 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3974 | return; |
| 3975 | } |
| 3976 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3977 | gl::Shader *shaderObject = context->getShader(shader); |
| 3978 | |
| 3979 | if (!shaderObject) |
| 3980 | { |
| 3981 | if (context->getProgram(shader)) |
| 3982 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3983 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3984 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3985 | } |
| 3986 | else |
| 3987 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3988 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3989 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3990 | } |
| 3991 | } |
| 3992 | |
| 3993 | shaderObject->setSource(count, string, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3994 | } |
| 3995 | } |
| 3996 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 3997 | void GL_APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3998 | { |
daniel@transgaming.com | fab5a1a | 2010-03-11 19:22:30 +0000 | [diff] [blame] | 3999 | glStencilFuncSeparate(GL_FRONT_AND_BACK, func, ref, mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4000 | } |
| 4001 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4002 | 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] | 4003 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4004 | 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] | 4005 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4006 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4007 | if (context) |
| 4008 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4009 | switch (face) |
| 4010 | { |
| 4011 | case GL_FRONT: |
| 4012 | case GL_BACK: |
| 4013 | case GL_FRONT_AND_BACK: |
| 4014 | break; |
| 4015 | |
| 4016 | default: |
| 4017 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4018 | return; |
| 4019 | } |
| 4020 | |
| 4021 | switch (func) |
| 4022 | { |
| 4023 | case GL_NEVER: |
| 4024 | case GL_ALWAYS: |
| 4025 | case GL_LESS: |
| 4026 | case GL_LEQUAL: |
| 4027 | case GL_EQUAL: |
| 4028 | case GL_GEQUAL: |
| 4029 | case GL_GREATER: |
| 4030 | case GL_NOTEQUAL: |
| 4031 | break; |
| 4032 | |
| 4033 | default: |
| 4034 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4035 | return; |
| 4036 | } |
| 4037 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4038 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 4039 | { |
| 4040 | context->getState().setStencilParams(func, ref, mask); |
| 4041 | } |
| 4042 | |
| 4043 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 4044 | { |
| 4045 | context->getState().setStencilBackParams(func, ref, mask); |
| 4046 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4047 | } |
| 4048 | } |
| 4049 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4050 | void GL_APIENTRY glStencilMask(GLuint mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4051 | { |
| 4052 | glStencilMaskSeparate(GL_FRONT_AND_BACK, mask); |
| 4053 | } |
| 4054 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4055 | void GL_APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4056 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4057 | EVENT("(GLenum face = 0x%X, GLuint mask = %d)", face, mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4058 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4059 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4060 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4061 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4062 | switch (face) |
| 4063 | { |
| 4064 | case GL_FRONT: |
| 4065 | case GL_BACK: |
| 4066 | case GL_FRONT_AND_BACK: |
| 4067 | break; |
| 4068 | |
| 4069 | default: |
| 4070 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4071 | return; |
| 4072 | } |
| 4073 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4074 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 4075 | { |
| 4076 | context->getState().setStencilWritemask(mask); |
| 4077 | } |
| 4078 | |
| 4079 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 4080 | { |
| 4081 | context->getState().setStencilBackWritemask(mask); |
| 4082 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4083 | } |
| 4084 | } |
| 4085 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4086 | void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4087 | { |
| 4088 | glStencilOpSeparate(GL_FRONT_AND_BACK, fail, zfail, zpass); |
| 4089 | } |
| 4090 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4091 | 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] | 4092 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4093 | 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] | 4094 | face, fail, zfail, zpass); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4095 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4096 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4097 | if (context) |
| 4098 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4099 | switch (face) |
| 4100 | { |
| 4101 | case GL_FRONT: |
| 4102 | case GL_BACK: |
| 4103 | case GL_FRONT_AND_BACK: |
| 4104 | break; |
| 4105 | |
| 4106 | default: |
| 4107 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4108 | return; |
| 4109 | } |
| 4110 | |
| 4111 | switch (fail) |
| 4112 | { |
| 4113 | case GL_ZERO: |
| 4114 | case GL_KEEP: |
| 4115 | case GL_REPLACE: |
| 4116 | case GL_INCR: |
| 4117 | case GL_DECR: |
| 4118 | case GL_INVERT: |
| 4119 | case GL_INCR_WRAP: |
| 4120 | case GL_DECR_WRAP: |
| 4121 | break; |
| 4122 | |
| 4123 | default: |
| 4124 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4125 | return; |
| 4126 | } |
| 4127 | |
| 4128 | switch (zfail) |
| 4129 | { |
| 4130 | case GL_ZERO: |
| 4131 | case GL_KEEP: |
| 4132 | case GL_REPLACE: |
| 4133 | case GL_INCR: |
| 4134 | case GL_DECR: |
| 4135 | case GL_INVERT: |
| 4136 | case GL_INCR_WRAP: |
| 4137 | case GL_DECR_WRAP: |
| 4138 | break; |
| 4139 | |
| 4140 | default: |
| 4141 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4142 | return; |
| 4143 | } |
| 4144 | |
| 4145 | switch (zpass) |
| 4146 | { |
| 4147 | case GL_ZERO: |
| 4148 | case GL_KEEP: |
| 4149 | case GL_REPLACE: |
| 4150 | case GL_INCR: |
| 4151 | case GL_DECR: |
| 4152 | case GL_INVERT: |
| 4153 | case GL_INCR_WRAP: |
| 4154 | case GL_DECR_WRAP: |
| 4155 | break; |
| 4156 | |
| 4157 | default: |
| 4158 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4159 | return; |
| 4160 | } |
| 4161 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4162 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 4163 | { |
| 4164 | context->getState().setStencilOperations(fail, zfail, zpass); |
| 4165 | } |
| 4166 | |
| 4167 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 4168 | { |
| 4169 | context->getState().setStencilBackOperations(fail, zfail, zpass); |
| 4170 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4171 | } |
| 4172 | } |
| 4173 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4174 | GLboolean GL_APIENTRY glTestFenceNV(GLuint fence) |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 4175 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4176 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4177 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4178 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4179 | if (context) |
| 4180 | { |
| 4181 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 4182 | |
| 4183 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4184 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4185 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4186 | return GL_TRUE; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4187 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4188 | |
| 4189 | if (fenceObject->isFence() != GL_TRUE) |
| 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; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4193 | } |
| 4194 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 4195 | GLboolean result; |
| 4196 | gl::Error error = fenceObject->testFence(&result); |
| 4197 | if (error.isError()) |
| 4198 | { |
| 4199 | context->recordError(error); |
| 4200 | return GL_TRUE; |
| 4201 | } |
| 4202 | |
| 4203 | return result; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4204 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4205 | |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4206 | return GL_TRUE; |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 4207 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4208 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4209 | 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] | 4210 | GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4211 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4212 | 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] | 4213 | "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] | 4214 | target, level, internalformat, width, height, border, format, type, pixels); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4215 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4216 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4217 | if (context) |
| 4218 | { |
| 4219 | if (context->getClientVersion() < 3 && |
| 4220 | !ValidateES2TexImageParameters(context, target, level, internalformat, false, false, |
| 4221 | 0, 0, width, height, border, format, type, pixels)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4222 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4223 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4224 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4225 | |
| 4226 | if (context->getClientVersion() >= 3 && |
| 4227 | !ValidateES3TexImageParameters(context, target, level, internalformat, false, false, |
| 4228 | 0, 0, 0, width, height, 1, border, format, type, pixels)) |
| 4229 | { |
| 4230 | return; |
| 4231 | } |
| 4232 | |
| 4233 | switch (target) |
| 4234 | { |
| 4235 | case GL_TEXTURE_2D: |
| 4236 | { |
| 4237 | gl::Texture2D *texture = context->getTexture2D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 4238 | gl::Error error = texture->setImage(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4239 | if (error.isError()) |
| 4240 | { |
| 4241 | context->recordError(error); |
| 4242 | return; |
| 4243 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4244 | } |
| 4245 | break; |
Geoff Lang | 8376cea | 2014-09-02 11:47:07 -0400 | [diff] [blame] | 4246 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4247 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4248 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4249 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4250 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4251 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4252 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 4253 | { |
| 4254 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Geoff Lang | 8376cea | 2014-09-02 11:47:07 -0400 | [diff] [blame] | 4255 | 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] | 4256 | if (error.isError()) |
| 4257 | { |
| 4258 | context->recordError(error); |
| 4259 | return; |
| 4260 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4261 | } |
| 4262 | break; |
Geoff Lang | 8376cea | 2014-09-02 11:47:07 -0400 | [diff] [blame] | 4263 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4264 | default: UNREACHABLE(); |
| 4265 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4266 | } |
| 4267 | } |
| 4268 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4269 | void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4270 | { |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4271 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %f)", target, pname, param); |
| 4272 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4273 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4274 | if (context) |
| 4275 | { |
| 4276 | if (!ValidateTexParamParameters(context, pname, static_cast<GLint>(param))) |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4277 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4278 | return; |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4279 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4280 | |
| 4281 | gl::Texture *texture = context->getTargetTexture(target); |
| 4282 | |
| 4283 | if (!texture) |
| 4284 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4285 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4286 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4287 | } |
| 4288 | |
| 4289 | switch (pname) |
| 4290 | { |
| 4291 | case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = gl::uiround<GLenum>(param); break; |
| 4292 | case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = gl::uiround<GLenum>(param); break; |
| 4293 | case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = gl::uiround<GLenum>(param); break; |
| 4294 | case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = gl::uiround<GLenum>(param); break; |
| 4295 | case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = gl::uiround<GLenum>(param); break; |
| 4296 | case GL_TEXTURE_USAGE_ANGLE: texture->setUsage(gl::uiround<GLenum>(param)); break; |
| 4297 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min(param, context->getExtensions().maxTextureAnisotropy); break; |
| 4298 | case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = gl::uiround<GLenum>(param); break; |
| 4299 | case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = gl::uiround<GLenum>(param); break; |
| 4300 | case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = gl::uiround<GLenum>(param); break; |
| 4301 | case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = gl::uiround<GLenum>(param); break; |
| 4302 | case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = gl::uiround<GLenum>(param); break; |
| 4303 | case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = gl::uiround<GLenum>(param); break; |
| 4304 | case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = gl::iround<GLint>(param); break; |
| 4305 | case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = gl::iround<GLint>(param); break; |
| 4306 | case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = param; break; |
| 4307 | case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = param; break; |
| 4308 | default: UNREACHABLE(); break; |
| 4309 | } |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4310 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4311 | } |
| 4312 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4313 | void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4314 | { |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4315 | glTexParameterf(target, pname, (GLfloat)*params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4316 | } |
| 4317 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4318 | void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4319 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4320 | 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] | 4321 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4322 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4323 | if (context) |
| 4324 | { |
| 4325 | if (!ValidateTexParamParameters(context, pname, param)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4326 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4327 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4328 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4329 | |
| 4330 | gl::Texture *texture = context->getTargetTexture(target); |
| 4331 | |
| 4332 | if (!texture) |
| 4333 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4334 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4335 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4336 | } |
| 4337 | |
| 4338 | switch (pname) |
| 4339 | { |
| 4340 | case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = (GLenum)param; break; |
| 4341 | case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = (GLenum)param; break; |
| 4342 | case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = (GLenum)param; break; |
| 4343 | case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = (GLenum)param; break; |
| 4344 | case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = (GLenum)param; break; |
| 4345 | case GL_TEXTURE_USAGE_ANGLE: texture->setUsage((GLenum)param); break; |
| 4346 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min((float)param, context->getExtensions().maxTextureAnisotropy); break; |
| 4347 | case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = (GLenum)param; break; |
| 4348 | case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = (GLenum)param; break; |
| 4349 | case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = (GLenum)param; break; |
| 4350 | case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = (GLenum)param; break; |
| 4351 | case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = (GLenum)param; break; |
| 4352 | case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = (GLenum)param; break; |
| 4353 | case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = param; break; |
| 4354 | case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = param; break; |
| 4355 | case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = (GLfloat)param; break; |
| 4356 | case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = (GLfloat)param; break; |
| 4357 | default: UNREACHABLE(); break; |
| 4358 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4359 | } |
| 4360 | } |
| 4361 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4362 | void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint* params) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4363 | { |
| 4364 | glTexParameteri(target, pname, *params); |
| 4365 | } |
| 4366 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4367 | 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] | 4368 | { |
| 4369 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 4370 | target, levels, internalformat, width, height); |
| 4371 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4372 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4373 | if (context) |
| 4374 | { |
| 4375 | if (!context->getExtensions().textureStorage) |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4376 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4377 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4378 | return; |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4379 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4380 | |
| 4381 | if (context->getClientVersion() < 3 && |
| 4382 | !ValidateES2TexStorageParameters(context, target, levels, internalformat, width, height)) |
| 4383 | { |
| 4384 | return; |
| 4385 | } |
| 4386 | |
| 4387 | if (context->getClientVersion() >= 3 && |
| 4388 | !ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1)) |
| 4389 | { |
| 4390 | return; |
| 4391 | } |
| 4392 | |
| 4393 | switch (target) |
| 4394 | { |
| 4395 | case GL_TEXTURE_2D: |
| 4396 | { |
| 4397 | gl::Texture2D *texture2d = context->getTexture2D(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 4398 | gl::Error error = texture2d->storage(levels, internalformat, width, height); |
| 4399 | if (error.isError()) |
| 4400 | { |
| 4401 | context->recordError(error); |
| 4402 | return; |
| 4403 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4404 | } |
| 4405 | break; |
| 4406 | |
| 4407 | case GL_TEXTURE_CUBE_MAP: |
| 4408 | { |
| 4409 | gl::TextureCubeMap *textureCube = context->getTextureCubeMap(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 4410 | gl::Error error = textureCube->storage(levels, internalformat, width); |
| 4411 | if (error.isError()) |
| 4412 | { |
| 4413 | context->recordError(error); |
| 4414 | return; |
| 4415 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4416 | } |
| 4417 | break; |
| 4418 | |
| 4419 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4420 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4421 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4422 | } |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4423 | } |
| 4424 | } |
| 4425 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4426 | 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] | 4427 | GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4428 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4429 | 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] | 4430 | "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] | 4431 | "const GLvoid* pixels = 0x%0.8p)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4432 | target, level, xoffset, yoffset, width, height, format, type, pixels); |
| 4433 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4434 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4435 | if (context) |
| 4436 | { |
| 4437 | if (context->getClientVersion() < 3 && |
| 4438 | !ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true, |
| 4439 | xoffset, yoffset, width, height, 0, format, type, pixels)) |
daniel@transgaming.com | 00c7596 | 2010-03-11 20:36:15 +0000 | [diff] [blame] | 4440 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4441 | return; |
daniel@transgaming.com | 00c7596 | 2010-03-11 20:36:15 +0000 | [diff] [blame] | 4442 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4443 | |
| 4444 | if (context->getClientVersion() >= 3 && |
| 4445 | !ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true, |
| 4446 | xoffset, yoffset, 0, width, height, 1, 0, format, type, pixels)) |
| 4447 | { |
| 4448 | return; |
| 4449 | } |
| 4450 | |
| 4451 | // Zero sized uploads are valid but no-ops |
| 4452 | if (width == 0 || height == 0) |
| 4453 | { |
| 4454 | return; |
| 4455 | } |
| 4456 | |
| 4457 | switch (target) |
| 4458 | { |
| 4459 | case GL_TEXTURE_2D: |
| 4460 | { |
| 4461 | gl::Texture2D *texture = context->getTexture2D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 4462 | gl::Error error = texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels); |
| 4463 | if (error.isError()) |
| 4464 | { |
| 4465 | context->recordError(error); |
| 4466 | return; |
| 4467 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4468 | } |
| 4469 | break; |
| 4470 | |
| 4471 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 4472 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 4473 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 4474 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 4475 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 4476 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 4477 | { |
| 4478 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 4479 | gl::Error error = texture->subImage(target, level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels); |
| 4480 | if (error.isError()) |
| 4481 | { |
| 4482 | context->recordError(error); |
| 4483 | return; |
| 4484 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4485 | } |
| 4486 | break; |
| 4487 | |
| 4488 | default: |
| 4489 | UNREACHABLE(); |
| 4490 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4491 | } |
| 4492 | } |
| 4493 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4494 | void GL_APIENTRY glUniform1f(GLint location, GLfloat x) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4495 | { |
| 4496 | glUniform1fv(location, 1, &x); |
| 4497 | } |
| 4498 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4499 | void GL_APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4500 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4501 | 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] | 4502 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4503 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4504 | if (context) |
| 4505 | { |
| 4506 | if (!ValidateUniform(context, GL_FLOAT, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4507 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4508 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4509 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4510 | |
| 4511 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4512 | programBinary->setUniform1fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4513 | } |
| 4514 | } |
| 4515 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4516 | void GL_APIENTRY glUniform1i(GLint location, GLint x) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4517 | { |
| 4518 | glUniform1iv(location, 1, &x); |
| 4519 | } |
| 4520 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4521 | void GL_APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4522 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4523 | 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] | 4524 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4525 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4526 | if (context) |
| 4527 | { |
| 4528 | if (!ValidateUniform(context, GL_INT, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4529 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4530 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4531 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4532 | |
| 4533 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4534 | programBinary->setUniform1iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4535 | } |
| 4536 | } |
| 4537 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4538 | void GL_APIENTRY glUniform2f(GLint location, GLfloat x, GLfloat y) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4539 | { |
| 4540 | GLfloat xy[2] = {x, y}; |
| 4541 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4542 | glUniform2fv(location, 1, xy); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4543 | } |
| 4544 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4545 | void GL_APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4546 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4547 | 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] | 4548 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4549 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4550 | if (context) |
| 4551 | { |
| 4552 | if (!ValidateUniform(context, GL_FLOAT_VEC2, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4553 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4554 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4555 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4556 | |
| 4557 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4558 | programBinary->setUniform2fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4559 | } |
| 4560 | } |
| 4561 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4562 | void GL_APIENTRY glUniform2i(GLint location, GLint x, GLint y) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4563 | { |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4564 | GLint xy[2] = {x, y}; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4565 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4566 | glUniform2iv(location, 1, xy); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4567 | } |
| 4568 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4569 | void GL_APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4570 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4571 | 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] | 4572 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4573 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4574 | if (context) |
| 4575 | { |
| 4576 | if (!ValidateUniform(context, GL_INT_VEC2, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4577 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4578 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4579 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4580 | |
| 4581 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4582 | programBinary->setUniform2iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4583 | } |
| 4584 | } |
| 4585 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4586 | 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] | 4587 | { |
| 4588 | GLfloat xyz[3] = {x, y, z}; |
| 4589 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4590 | glUniform3fv(location, 1, xyz); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4591 | } |
| 4592 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4593 | void GL_APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4594 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4595 | 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] | 4596 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4597 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4598 | if (context) |
| 4599 | { |
| 4600 | if (!ValidateUniform(context, GL_FLOAT_VEC3, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4601 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4602 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4603 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4604 | |
| 4605 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4606 | programBinary->setUniform3fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4607 | } |
| 4608 | } |
| 4609 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4610 | 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] | 4611 | { |
| 4612 | GLint xyz[3] = {x, y, z}; |
| 4613 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4614 | glUniform3iv(location, 1, xyz); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4615 | } |
| 4616 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4617 | void GL_APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4618 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4619 | 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] | 4620 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4621 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4622 | if (context) |
| 4623 | { |
| 4624 | if (!ValidateUniform(context, GL_INT_VEC3, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4625 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4626 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4627 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4628 | |
| 4629 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4630 | programBinary->setUniform3iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4631 | } |
| 4632 | } |
| 4633 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4634 | 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] | 4635 | { |
| 4636 | GLfloat xyzw[4] = {x, y, z, w}; |
| 4637 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4638 | glUniform4fv(location, 1, xyzw); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4639 | } |
| 4640 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4641 | void GL_APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4642 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4643 | 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] | 4644 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4645 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4646 | if (context) |
| 4647 | { |
| 4648 | if (!ValidateUniform(context, GL_FLOAT_VEC4, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4649 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4650 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4651 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4652 | |
| 4653 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4654 | programBinary->setUniform4fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4655 | } |
| 4656 | } |
| 4657 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4658 | 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] | 4659 | { |
| 4660 | GLint xyzw[4] = {x, y, z, w}; |
| 4661 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4662 | glUniform4iv(location, 1, xyzw); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4663 | } |
| 4664 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4665 | void GL_APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint* v) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4666 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4667 | 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] | 4668 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4669 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4670 | if (context) |
| 4671 | { |
| 4672 | if (!ValidateUniform(context, GL_INT_VEC4, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4673 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4674 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4675 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4676 | |
| 4677 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4678 | programBinary->setUniform4iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4679 | } |
| 4680 | } |
| 4681 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4682 | 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] | 4683 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4684 | 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] | 4685 | location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4686 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4687 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4688 | if (context) |
| 4689 | { |
| 4690 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4691 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4692 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4693 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4694 | |
| 4695 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4696 | programBinary->setUniformMatrix2fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4697 | } |
| 4698 | } |
| 4699 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4700 | 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] | 4701 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4702 | 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] | 4703 | location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4704 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4705 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4706 | if (context) |
| 4707 | { |
| 4708 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4709 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4710 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4711 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4712 | |
| 4713 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4714 | programBinary->setUniformMatrix3fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4715 | } |
| 4716 | } |
| 4717 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4718 | 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] | 4719 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4720 | 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] | 4721 | location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4722 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4723 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4724 | if (context) |
| 4725 | { |
| 4726 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4727 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4728 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4729 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4730 | |
| 4731 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4732 | programBinary->setUniformMatrix4fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4733 | } |
| 4734 | } |
| 4735 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4736 | void GL_APIENTRY glUseProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4737 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4738 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4739 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4740 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4741 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4742 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4743 | gl::Program *programObject = context->getProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4744 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4745 | if (!programObject && program != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4746 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4747 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4748 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4749 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4750 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4751 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4752 | else |
| 4753 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4754 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4755 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4756 | } |
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 | |
| 4759 | if (program != 0 && !programObject->isLinked()) |
| 4760 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4761 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4762 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4763 | } |
| 4764 | |
| 4765 | context->useProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4766 | } |
| 4767 | } |
| 4768 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4769 | void GL_APIENTRY glValidateProgram(GLuint program) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4770 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4771 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4772 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4773 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4774 | if (context) |
| 4775 | { |
| 4776 | gl::Program *programObject = context->getProgram(program); |
| 4777 | |
| 4778 | if (!programObject) |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4779 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4780 | if (context->getShader(program)) |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4781 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4782 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4783 | return; |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4784 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4785 | else |
| 4786 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4787 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4788 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4789 | } |
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 | |
Brandon Jones | 43a53e2 | 2014-08-28 16:23:22 -0700 | [diff] [blame] | 4792 | programObject->validate(context->getCaps()); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4793 | } |
| 4794 | } |
| 4795 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4796 | void GL_APIENTRY glVertexAttrib1f(GLuint index, GLfloat x) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4797 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4798 | EVENT("(GLuint index = %d, GLfloat x = %f)", index, x); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4799 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4800 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4801 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4802 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4803 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4804 | { |
| 4805 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4806 | return; |
| 4807 | } |
| 4808 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4809 | GLfloat vals[4] = { x, 0, 0, 1 }; |
| 4810 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4811 | } |
| 4812 | } |
| 4813 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4814 | void GL_APIENTRY glVertexAttrib1fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4815 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4816 | 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] | 4817 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4818 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4819 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4820 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4821 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4822 | { |
| 4823 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4824 | return; |
| 4825 | } |
| 4826 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4827 | GLfloat vals[4] = { values[0], 0, 0, 1 }; |
| 4828 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4829 | } |
| 4830 | } |
| 4831 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4832 | void GL_APIENTRY glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4833 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4834 | 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] | 4835 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4836 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4837 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4838 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4839 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4840 | { |
| 4841 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4842 | return; |
| 4843 | } |
| 4844 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4845 | GLfloat vals[4] = { x, y, 0, 1 }; |
| 4846 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4847 | } |
| 4848 | } |
| 4849 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4850 | void GL_APIENTRY glVertexAttrib2fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4851 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4852 | 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] | 4853 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4854 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4855 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4856 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4857 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4858 | { |
| 4859 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4860 | return; |
| 4861 | } |
| 4862 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4863 | GLfloat vals[4] = { values[0], values[1], 0, 1 }; |
| 4864 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4865 | } |
| 4866 | } |
| 4867 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4868 | 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] | 4869 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4870 | 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] | 4871 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4872 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4873 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4874 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4875 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4876 | { |
| 4877 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4878 | return; |
| 4879 | } |
| 4880 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4881 | GLfloat vals[4] = { x, y, z, 1 }; |
| 4882 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4883 | } |
| 4884 | } |
| 4885 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4886 | void GL_APIENTRY glVertexAttrib3fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4887 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4888 | 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] | 4889 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4890 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4891 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4892 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4893 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4894 | { |
| 4895 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4896 | return; |
| 4897 | } |
| 4898 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4899 | GLfloat vals[4] = { values[0], values[1], values[2], 1 }; |
| 4900 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4901 | } |
| 4902 | } |
| 4903 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4904 | 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] | 4905 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4906 | 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] | 4907 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4908 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4909 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4910 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4911 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4912 | { |
| 4913 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4914 | return; |
| 4915 | } |
| 4916 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4917 | GLfloat vals[4] = { x, y, z, w }; |
| 4918 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4919 | } |
| 4920 | } |
| 4921 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4922 | void GL_APIENTRY glVertexAttrib4fv(GLuint index, const GLfloat* values) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4923 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4924 | 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] | 4925 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4926 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4927 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4928 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4929 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4930 | { |
| 4931 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4932 | return; |
| 4933 | } |
| 4934 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4935 | context->getState().setVertexAttribf(index, values); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4936 | } |
| 4937 | } |
| 4938 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4939 | void GL_APIENTRY glVertexAttribDivisorANGLE(GLuint index, GLuint divisor) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4940 | { |
| 4941 | EVENT("(GLuint index = %d, GLuint divisor = %d)", index, divisor); |
| 4942 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4943 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4944 | if (context) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4945 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4946 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4947 | { |
| 4948 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4949 | return; |
| 4950 | } |
| 4951 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4952 | context->setVertexAttribDivisor(index, divisor); |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4953 | } |
| 4954 | } |
| 4955 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 4956 | 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] | 4957 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4958 | 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] | 4959 | "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] | 4960 | index, size, type, normalized, stride, ptr); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4961 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4962 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4963 | if (context) |
| 4964 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4965 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4966 | { |
| 4967 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4968 | return; |
| 4969 | } |
| 4970 | |
| 4971 | if (size < 1 || size > 4) |
| 4972 | { |
| 4973 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4974 | return; |
| 4975 | } |
| 4976 | |
| 4977 | switch (type) |
| 4978 | { |
| 4979 | case GL_BYTE: |
| 4980 | case GL_UNSIGNED_BYTE: |
| 4981 | case GL_SHORT: |
| 4982 | case GL_UNSIGNED_SHORT: |
| 4983 | case GL_FIXED: |
| 4984 | case GL_FLOAT: |
| 4985 | break; |
| 4986 | |
| 4987 | case GL_HALF_FLOAT: |
| 4988 | case GL_INT: |
| 4989 | case GL_UNSIGNED_INT: |
| 4990 | case GL_INT_2_10_10_10_REV: |
| 4991 | case GL_UNSIGNED_INT_2_10_10_10_REV: |
| 4992 | if (context->getClientVersion() < 3) |
| 4993 | { |
| 4994 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4995 | return; |
| 4996 | } |
| 4997 | break; |
| 4998 | |
| 4999 | default: |
| 5000 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5001 | return; |
| 5002 | } |
| 5003 | |
| 5004 | if (stride < 0) |
| 5005 | { |
| 5006 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5007 | return; |
| 5008 | } |
| 5009 | |
| 5010 | if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4) |
| 5011 | { |
| 5012 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5013 | return; |
| 5014 | } |
| 5015 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5016 | // [OpenGL ES 3.0.2] Section 2.8 page 24: |
| 5017 | // An INVALID_OPERATION error is generated when a non-zero vertex array object |
| 5018 | // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point, |
| 5019 | // and the pointer argument is not NULL. |
| 5020 | 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] | 5021 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5022 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5023 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 1ab57be | 2013-04-13 03:38:39 +0000 | [diff] [blame] | 5024 | } |
| 5025 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5026 | context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type, |
| 5027 | normalized == GL_TRUE, false, stride, ptr); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 5028 | } |
| 5029 | } |
| 5030 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5031 | 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] | 5032 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 5033 | 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] | 5034 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5035 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5036 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 5037 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5038 | if (width < 0 || height < 0) |
| 5039 | { |
| 5040 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5041 | return; |
| 5042 | } |
| 5043 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5044 | context->getState().setViewportParams(x, y, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 5045 | } |
| 5046 | } |
| 5047 | |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5048 | // OpenGL ES 3.0 functions |
| 5049 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5050 | void GL_APIENTRY glReadBuffer(GLenum mode) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5051 | { |
| 5052 | EVENT("(GLenum mode = 0x%X)", mode); |
| 5053 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5054 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5055 | if (context) |
| 5056 | { |
| 5057 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5058 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5059 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5060 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5061 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5062 | |
| 5063 | // glReadBuffer |
| 5064 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5065 | } |
| 5066 | } |
| 5067 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5068 | 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] | 5069 | { |
| 5070 | EVENT("(GLenum mode = 0x%X, GLuint start = %u, GLuint end = %u, GLsizei count = %d, GLenum type = 0x%X, " |
| 5071 | "const GLvoid* indices = 0x%0.8p)", mode, start, end, count, type, indices); |
| 5072 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5073 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5074 | if (context) |
| 5075 | { |
| 5076 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5077 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5078 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5079 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5080 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5081 | |
| 5082 | // glDrawRangeElements |
| 5083 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5084 | } |
| 5085 | } |
| 5086 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5087 | 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] | 5088 | { |
| 5089 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, " |
| 5090 | "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLenum format = 0x%X, " |
| 5091 | "GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", |
| 5092 | target, level, internalformat, width, height, depth, border, format, type, pixels); |
| 5093 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5094 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5095 | if (context) |
| 5096 | { |
| 5097 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5098 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5099 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5100 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5101 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5102 | |
| 5103 | // validateES3TexImageFormat sets the error code if there is an error |
| 5104 | if (!ValidateES3TexImageParameters(context, target, level, internalformat, false, false, |
| 5105 | 0, 0, 0, width, height, depth, border, format, type, pixels)) |
| 5106 | { |
| 5107 | return; |
| 5108 | } |
| 5109 | |
| 5110 | switch(target) |
| 5111 | { |
| 5112 | case GL_TEXTURE_3D: |
| 5113 | { |
| 5114 | gl::Texture3D *texture = context->getTexture3D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5115 | gl::Error error = texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 5116 | if (error.isError()) |
| 5117 | { |
| 5118 | context->recordError(error); |
| 5119 | return; |
| 5120 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5121 | } |
| 5122 | break; |
| 5123 | |
| 5124 | case GL_TEXTURE_2D_ARRAY: |
| 5125 | { |
| 5126 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5127 | gl::Error error = texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 5128 | if (error.isError()) |
| 5129 | { |
| 5130 | context->recordError(error); |
| 5131 | return; |
| 5132 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5133 | } |
| 5134 | break; |
| 5135 | |
| 5136 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5137 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5138 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5139 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5140 | } |
| 5141 | } |
| 5142 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5143 | 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] | 5144 | { |
| 5145 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5146 | "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, " |
| 5147 | "GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", |
| 5148 | target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); |
| 5149 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5150 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5151 | if (context) |
| 5152 | { |
| 5153 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5154 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5155 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5156 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5157 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5158 | |
| 5159 | // validateES3TexImageFormat sets the error code if there is an error |
| 5160 | if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true, |
| 5161 | xoffset, yoffset, zoffset, width, height, depth, 0, |
| 5162 | format, type, pixels)) |
| 5163 | { |
| 5164 | return; |
| 5165 | } |
| 5166 | |
| 5167 | // Zero sized uploads are valid but no-ops |
| 5168 | if (width == 0 || height == 0 || depth == 0) |
| 5169 | { |
| 5170 | return; |
| 5171 | } |
| 5172 | |
| 5173 | switch(target) |
| 5174 | { |
| 5175 | case GL_TEXTURE_3D: |
| 5176 | { |
| 5177 | gl::Texture3D *texture = context->getTexture3D(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5178 | gl::Error error = texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels); |
| 5179 | if (error.isError()) |
| 5180 | { |
| 5181 | context->recordError(error); |
| 5182 | return; |
| 5183 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5184 | } |
| 5185 | break; |
| 5186 | |
| 5187 | case GL_TEXTURE_2D_ARRAY: |
| 5188 | { |
| 5189 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Geoff Lang | 1ba6b8d | 2014-08-28 10:57:31 -0400 | [diff] [blame] | 5190 | gl::Error error = texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels); |
| 5191 | if (error.isError()) |
| 5192 | { |
| 5193 | context->recordError(error); |
| 5194 | return; |
| 5195 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5196 | } |
| 5197 | break; |
| 5198 | |
| 5199 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5200 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5201 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5202 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5203 | } |
| 5204 | } |
| 5205 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5206 | 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] | 5207 | { |
| 5208 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5209 | "GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", |
| 5210 | target, level, xoffset, yoffset, zoffset, x, y, width, height); |
| 5211 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5212 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5213 | if (context) |
| 5214 | { |
| 5215 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5216 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5217 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5218 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5219 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5220 | |
| 5221 | if (!ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true, xoffset, yoffset, zoffset, |
| 5222 | x, y, width, height, 0)) |
| 5223 | { |
| 5224 | return; |
| 5225 | } |
| 5226 | |
| 5227 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 5228 | gl::Texture *texture = NULL; |
| 5229 | switch (target) |
| 5230 | { |
| 5231 | case GL_TEXTURE_3D: |
| 5232 | texture = context->getTexture3D(); |
| 5233 | break; |
| 5234 | |
| 5235 | case GL_TEXTURE_2D_ARRAY: |
| 5236 | texture = context->getTexture2DArray(); |
| 5237 | break; |
| 5238 | |
| 5239 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5240 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5241 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5242 | } |
| 5243 | |
Geoff Lang | ef7b016 | 2014-09-04 13:29:23 -0400 | [diff] [blame] | 5244 | gl::Error error = texture->copySubImage(target, level, xoffset, yoffset, zoffset, x, y, width, height, framebuffer); |
| 5245 | if (error.isError()) |
| 5246 | { |
| 5247 | context->recordError(error); |
| 5248 | return; |
| 5249 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5250 | } |
| 5251 | } |
| 5252 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5253 | 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] | 5254 | { |
Geoff Lang | eef52cc | 2013-10-16 15:07:39 -0400 | [diff] [blame] | 5255 | 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] | 5256 | "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLsizei imageSize = %d, " |
| 5257 | "const GLvoid* data = 0x%0.8p)", |
| 5258 | target, level, internalformat, width, height, depth, border, imageSize, data); |
| 5259 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5260 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5261 | if (context) |
| 5262 | { |
| 5263 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5264 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5265 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5266 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5267 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5268 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 5269 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat); |
| 5270 | 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] | 5271 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5272 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5273 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5274 | } |
| 5275 | |
| 5276 | // validateES3TexImageFormat sets the error code if there is an error |
| 5277 | if (!ValidateES3TexImageParameters(context, target, level, internalformat, true, false, |
| 5278 | 0, 0, 0, width, height, depth, border, GL_NONE, GL_NONE, data)) |
| 5279 | { |
| 5280 | return; |
| 5281 | } |
| 5282 | |
| 5283 | switch(target) |
| 5284 | { |
| 5285 | case GL_TEXTURE_3D: |
| 5286 | { |
| 5287 | gl::Texture3D *texture = context->getTexture3D(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame^] | 5288 | 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] | 5289 | if (error.isError()) |
| 5290 | { |
| 5291 | context->recordError(error); |
| 5292 | return; |
| 5293 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5294 | } |
| 5295 | break; |
| 5296 | |
| 5297 | case GL_TEXTURE_2D_ARRAY: |
| 5298 | { |
| 5299 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame^] | 5300 | 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] | 5301 | if (error.isError()) |
| 5302 | { |
| 5303 | context->recordError(error); |
| 5304 | return; |
| 5305 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5306 | } |
| 5307 | break; |
| 5308 | |
| 5309 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5310 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5311 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5312 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5313 | } |
| 5314 | } |
| 5315 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5316 | 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] | 5317 | { |
| 5318 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5319 | "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, " |
| 5320 | "GLenum format = 0x%X, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
| 5321 | target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); |
| 5322 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5323 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5324 | if (context) |
| 5325 | { |
| 5326 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5327 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5328 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5329 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5330 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5331 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 5332 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format); |
| 5333 | 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] | 5334 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5335 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5336 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5337 | } |
| 5338 | |
| 5339 | if (!data) |
| 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 | // validateES3TexImageFormat sets the error code if there is an error |
| 5346 | if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true, |
| 5347 | 0, 0, 0, width, height, depth, 0, GL_NONE, GL_NONE, data)) |
| 5348 | { |
| 5349 | return; |
| 5350 | } |
| 5351 | |
| 5352 | // Zero sized uploads are valid but no-ops |
| 5353 | if (width == 0 || height == 0) |
| 5354 | { |
| 5355 | return; |
| 5356 | } |
| 5357 | |
| 5358 | switch(target) |
| 5359 | { |
| 5360 | case GL_TEXTURE_3D: |
| 5361 | { |
| 5362 | gl::Texture3D *texture = context->getTexture3D(); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5363 | gl::Error error = texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame^] | 5364 | format, imageSize, context->getState().getUnpackState(), data); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5365 | if (error.isError()) |
| 5366 | { |
| 5367 | context->recordError(error); |
| 5368 | return; |
| 5369 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5370 | } |
| 5371 | break; |
| 5372 | |
| 5373 | case GL_TEXTURE_2D_ARRAY: |
| 5374 | { |
| 5375 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5376 | gl::Error error = texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, |
Jamie Madill | c751d1e | 2014-10-21 17:46:29 -0400 | [diff] [blame^] | 5377 | format, imageSize, context->getState().getUnpackState(), data); |
Geoff Lang | b534833 | 2014-09-02 13:16:34 -0400 | [diff] [blame] | 5378 | if (error.isError()) |
| 5379 | { |
| 5380 | context->recordError(error); |
| 5381 | return; |
| 5382 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5383 | } |
| 5384 | break; |
| 5385 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5386 | default: |
| 5387 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5388 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5389 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5390 | } |
| 5391 | } |
| 5392 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5393 | void GL_APIENTRY glGenQueries(GLsizei n, GLuint* ids) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5394 | { |
| 5395 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 5396 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5397 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5398 | if (context) |
| 5399 | { |
| 5400 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5401 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5402 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5403 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5404 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5405 | |
| 5406 | if (n < 0) |
| 5407 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5408 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5409 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5410 | } |
| 5411 | |
| 5412 | for (GLsizei i = 0; i < n; i++) |
| 5413 | { |
| 5414 | ids[i] = context->createQuery(); |
| 5415 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5416 | } |
| 5417 | } |
| 5418 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5419 | 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] | 5420 | { |
| 5421 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 5422 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5423 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5424 | if (context) |
| 5425 | { |
| 5426 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5427 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5428 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5429 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5430 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5431 | |
| 5432 | if (n < 0) |
| 5433 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5434 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5435 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5436 | } |
| 5437 | |
| 5438 | for (GLsizei i = 0; i < n; i++) |
| 5439 | { |
| 5440 | context->deleteQuery(ids[i]); |
| 5441 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5442 | } |
| 5443 | } |
| 5444 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5445 | GLboolean GL_APIENTRY glIsQuery(GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5446 | { |
| 5447 | EVENT("(GLuint id = %u)", id); |
| 5448 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5449 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5450 | if (context) |
| 5451 | { |
| 5452 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5453 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5454 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5455 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5456 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5457 | |
| 5458 | 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] | 5459 | } |
| 5460 | |
| 5461 | return GL_FALSE; |
| 5462 | } |
| 5463 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5464 | void GL_APIENTRY glBeginQuery(GLenum target, GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5465 | { |
| 5466 | EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id); |
| 5467 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5468 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5469 | if (context) |
| 5470 | { |
| 5471 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5472 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5473 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5474 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5475 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5476 | |
| 5477 | if (!ValidateBeginQuery(context, target, id)) |
| 5478 | { |
| 5479 | return; |
| 5480 | } |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5481 | |
| 5482 | gl::Error error = context->beginQuery(target, id); |
| 5483 | if (error.isError()) |
| 5484 | { |
| 5485 | context->recordError(error); |
| 5486 | return; |
| 5487 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5488 | } |
| 5489 | } |
| 5490 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5491 | void GL_APIENTRY glEndQuery(GLenum target) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5492 | { |
| 5493 | EVENT("(GLenum target = 0x%X)", target); |
| 5494 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5495 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5496 | if (context) |
| 5497 | { |
| 5498 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5499 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5500 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5501 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5502 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5503 | |
| 5504 | if (!ValidateEndQuery(context, target)) |
| 5505 | { |
| 5506 | return; |
| 5507 | } |
| 5508 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5509 | gl::Error error = context->endQuery(target); |
| 5510 | if (error.isError()) |
| 5511 | { |
| 5512 | context->recordError(error); |
| 5513 | return; |
| 5514 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5515 | } |
| 5516 | } |
| 5517 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5518 | 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] | 5519 | { |
| 5520 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params); |
| 5521 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5522 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5523 | if (context) |
| 5524 | { |
| 5525 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5526 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5527 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5528 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5529 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5530 | |
| 5531 | if (!ValidQueryType(context, target)) |
| 5532 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5533 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5534 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5535 | } |
| 5536 | |
| 5537 | switch (pname) |
| 5538 | { |
| 5539 | case GL_CURRENT_QUERY: |
| 5540 | params[0] = static_cast<GLint>(context->getState().getActiveQueryId(target)); |
| 5541 | break; |
| 5542 | |
| 5543 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5544 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5545 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5546 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5547 | } |
| 5548 | } |
| 5549 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5550 | 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] | 5551 | { |
| 5552 | EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", id, pname, params); |
| 5553 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5554 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5555 | if (context) |
| 5556 | { |
| 5557 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5558 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5559 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5560 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5561 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5562 | |
| 5563 | gl::Query *queryObject = context->getQuery(id, false, GL_NONE); |
| 5564 | |
| 5565 | if (!queryObject) |
| 5566 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5567 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5568 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5569 | } |
| 5570 | |
| 5571 | if (context->getState().getActiveQueryId(queryObject->getType()) == id) |
| 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 | switch(pname) |
| 5578 | { |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5579 | case GL_QUERY_RESULT_EXT: |
| 5580 | { |
| 5581 | gl::Error error = queryObject->getResult(params); |
| 5582 | if (error.isError()) |
| 5583 | { |
| 5584 | context->recordError(error); |
| 5585 | return; |
| 5586 | } |
| 5587 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5588 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5589 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame] | 5590 | case GL_QUERY_RESULT_AVAILABLE_EXT: |
| 5591 | { |
| 5592 | gl::Error error = queryObject->isResultAvailable(params); |
| 5593 | if (error.isError()) |
| 5594 | { |
| 5595 | context->recordError(error); |
| 5596 | return; |
| 5597 | } |
| 5598 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5599 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5600 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5601 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5602 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5603 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5604 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5605 | } |
| 5606 | } |
| 5607 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5608 | GLboolean GL_APIENTRY glUnmapBuffer(GLenum target) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5609 | { |
| 5610 | EVENT("(GLenum target = 0x%X)", target); |
| 5611 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5612 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5613 | if (context) |
| 5614 | { |
| 5615 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5616 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5617 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5618 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5619 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5620 | |
| 5621 | return glUnmapBufferOES(target); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5622 | } |
| 5623 | |
| 5624 | return GL_FALSE; |
| 5625 | } |
| 5626 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5627 | 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] | 5628 | { |
| 5629 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params); |
| 5630 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5631 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5632 | if (context) |
| 5633 | { |
| 5634 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5635 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5636 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5637 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5638 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5639 | |
| 5640 | glGetBufferPointervOES(target, pname, params); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5641 | } |
| 5642 | } |
| 5643 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5644 | 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] | 5645 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5646 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5647 | if (context) |
| 5648 | { |
| 5649 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5650 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5651 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5652 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 7948c5f | 2013-04-13 03:38:58 +0000 | [diff] [blame] | 5653 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5654 | |
| 5655 | glDrawBuffersEXT(n, bufs); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5656 | } |
| 5657 | } |
| 5658 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5659 | 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] | 5660 | { |
| 5661 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5662 | location, count, transpose, value); |
| 5663 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5664 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5665 | if (context) |
| 5666 | { |
| 5667 | 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] | 5668 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5669 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5670 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5671 | |
| 5672 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5673 | programBinary->setUniformMatrix2x3fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5674 | } |
| 5675 | } |
| 5676 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5677 | 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] | 5678 | { |
| 5679 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5680 | location, count, transpose, value); |
| 5681 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5682 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5683 | if (context) |
| 5684 | { |
| 5685 | 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] | 5686 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5687 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5688 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5689 | |
| 5690 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5691 | programBinary->setUniformMatrix3x2fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5692 | } |
| 5693 | } |
| 5694 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5695 | 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] | 5696 | { |
| 5697 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5698 | location, count, transpose, value); |
| 5699 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5700 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5701 | if (context) |
| 5702 | { |
| 5703 | 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] | 5704 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5705 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5706 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5707 | |
| 5708 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5709 | programBinary->setUniformMatrix2x4fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5710 | } |
| 5711 | } |
| 5712 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5713 | 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] | 5714 | { |
| 5715 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5716 | location, count, transpose, value); |
| 5717 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5718 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5719 | if (context) |
| 5720 | { |
| 5721 | 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] | 5722 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5723 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5724 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5725 | |
| 5726 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5727 | programBinary->setUniformMatrix4x2fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5728 | } |
| 5729 | } |
| 5730 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5731 | 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] | 5732 | { |
| 5733 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5734 | location, count, transpose, value); |
| 5735 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5736 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5737 | if (context) |
| 5738 | { |
| 5739 | 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] | 5740 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5741 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5742 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5743 | |
| 5744 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5745 | programBinary->setUniformMatrix3x4fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5746 | } |
| 5747 | } |
| 5748 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5749 | 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] | 5750 | { |
| 5751 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5752 | location, count, transpose, value); |
| 5753 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5754 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5755 | if (context) |
| 5756 | { |
| 5757 | 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] | 5758 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5759 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5760 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5761 | |
| 5762 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5763 | programBinary->setUniformMatrix4x3fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5764 | } |
| 5765 | } |
| 5766 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5767 | 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] | 5768 | { |
| 5769 | EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, GLint dstX0 = %d, " |
| 5770 | "GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, GLbitfield mask = 0x%X, GLenum filter = 0x%X)", |
| 5771 | srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 5772 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5773 | gl::Context *context = gl::getNonLostContext(); |
| 5774 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5775 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5776 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5777 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5778 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5779 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5780 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5781 | |
| 5782 | if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, |
| 5783 | dstX0, dstY0, dstX1, dstY1, mask, filter, |
| 5784 | false)) |
| 5785 | { |
| 5786 | return; |
| 5787 | } |
| 5788 | |
Geoff Lang | 6483915 | 2014-08-26 16:23:25 -0400 | [diff] [blame] | 5789 | gl::Error error = context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, |
| 5790 | mask, filter); |
| 5791 | if (error.isError()) |
| 5792 | { |
| 5793 | context->recordError(error); |
| 5794 | return; |
| 5795 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5796 | } |
| 5797 | } |
| 5798 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5799 | 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] | 5800 | { |
| 5801 | EVENT("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 5802 | target, samples, internalformat, width, height); |
| 5803 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5804 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5805 | if (context) |
| 5806 | { |
| 5807 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5808 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5809 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5810 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5811 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5812 | |
| 5813 | if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat, |
| 5814 | width, height, false)) |
| 5815 | { |
| 5816 | return; |
| 5817 | } |
| 5818 | |
| 5819 | context->setRenderbufferStorage(width, height, internalformat, samples); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5820 | } |
| 5821 | } |
| 5822 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5823 | 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] | 5824 | { |
| 5825 | EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d, GLint layer = %d)", |
| 5826 | target, attachment, texture, level, layer); |
| 5827 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5828 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5829 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5830 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5831 | if (!ValidateFramebufferTextureLayer(context, target, attachment, texture, |
| 5832 | level, layer)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5833 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5834 | return; |
| 5835 | } |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5836 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5837 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 5838 | ASSERT(framebuffer); |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5839 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5840 | gl::Texture *textureObject = context->getTexture(texture); |
| 5841 | GLenum textarget = textureObject ? textureObject->getTarget() : GL_NONE; |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5842 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5843 | if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT) |
| 5844 | { |
| 5845 | const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT); |
| 5846 | framebuffer->setColorbuffer(colorAttachment, textarget, texture, level, layer); |
| 5847 | } |
| 5848 | else |
| 5849 | { |
| 5850 | switch (attachment) |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5851 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5852 | case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level, layer); break; |
| 5853 | case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level, layer); break; |
| 5854 | case GL_DEPTH_STENCIL_ATTACHMENT: framebuffer->setDepthStencilBuffer(textarget, texture, level, layer); break; |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5855 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5856 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5857 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5858 | } |
| 5859 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5860 | 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] | 5861 | { |
| 5862 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)", |
| 5863 | target, offset, length, access); |
| 5864 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5865 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5866 | if (context) |
| 5867 | { |
| 5868 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5869 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5870 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5871 | return NULL; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5872 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5873 | |
| 5874 | return glMapBufferRangeEXT(target, offset, length, access); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5875 | } |
| 5876 | |
| 5877 | return NULL; |
| 5878 | } |
| 5879 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5880 | 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] | 5881 | { |
| 5882 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length); |
| 5883 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5884 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5885 | if (context) |
| 5886 | { |
| 5887 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5888 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5889 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5890 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5891 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5892 | |
| 5893 | glFlushMappedBufferRangeEXT(target, offset, length); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5894 | } |
| 5895 | } |
| 5896 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5897 | void GL_APIENTRY glBindVertexArray(GLuint array) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5898 | { |
| 5899 | EVENT("(GLuint array = %u)", array); |
| 5900 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5901 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5902 | if (context) |
| 5903 | { |
| 5904 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5905 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5906 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5907 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5908 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5909 | |
| 5910 | gl::VertexArray *vao = context->getVertexArray(array); |
| 5911 | |
| 5912 | if (!vao) |
| 5913 | { |
| 5914 | // The default VAO should always exist |
| 5915 | ASSERT(array != 0); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5916 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5917 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5918 | } |
| 5919 | |
| 5920 | context->bindVertexArray(array); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5921 | } |
| 5922 | } |
| 5923 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5924 | 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] | 5925 | { |
| 5926 | EVENT("(GLsizei n = %d, const GLuint* arrays = 0x%0.8p)", n, arrays); |
| 5927 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5928 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5929 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5930 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5931 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5932 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5933 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5934 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5935 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5936 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5937 | if (n < 0) |
| 5938 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5939 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5940 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5941 | } |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5942 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5943 | for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) |
| 5944 | { |
| 5945 | if (arrays[arrayIndex] != 0) |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5946 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5947 | context->deleteVertexArray(arrays[arrayIndex]); |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5948 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5949 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5950 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5951 | } |
| 5952 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5953 | void GL_APIENTRY glGenVertexArrays(GLsizei n, GLuint* arrays) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5954 | { |
| 5955 | EVENT("(GLsizei n = %d, GLuint* arrays = 0x%0.8p)", n, arrays); |
| 5956 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5957 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5958 | if (context) |
| 5959 | { |
| 5960 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5961 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5962 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5963 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5964 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5965 | |
| 5966 | if (n < 0) |
| 5967 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5968 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5969 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5970 | } |
| 5971 | |
| 5972 | for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) |
| 5973 | { |
| 5974 | arrays[arrayIndex] = context->createVertexArray(); |
| 5975 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5976 | } |
| 5977 | } |
| 5978 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 5979 | GLboolean GL_APIENTRY glIsVertexArray(GLuint array) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5980 | { |
| 5981 | EVENT("(GLuint array = %u)", array); |
| 5982 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5983 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5984 | if (context) |
| 5985 | { |
| 5986 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5987 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5988 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5989 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5990 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5991 | |
| 5992 | if (array == 0) |
| 5993 | { |
| 5994 | return GL_FALSE; |
| 5995 | } |
| 5996 | |
| 5997 | gl::VertexArray *vao = context->getVertexArray(array); |
| 5998 | |
| 5999 | return (vao != NULL ? GL_TRUE : GL_FALSE); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6000 | } |
| 6001 | |
| 6002 | return GL_FALSE; |
| 6003 | } |
| 6004 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6005 | 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] | 6006 | { |
| 6007 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint* data = 0x%0.8p)", |
| 6008 | target, index, data); |
| 6009 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6010 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6011 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6012 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6013 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6014 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6015 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6016 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6017 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6018 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6019 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6020 | switch (target) |
| 6021 | { |
| 6022 | case GL_TRANSFORM_FEEDBACK_BUFFER_START: |
| 6023 | case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: |
| 6024 | case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6025 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
| 6026 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6027 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6028 | return; |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6029 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6030 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6031 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6032 | case GL_UNIFORM_BUFFER_START: |
| 6033 | case GL_UNIFORM_BUFFER_SIZE: |
| 6034 | case GL_UNIFORM_BUFFER_BINDING: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6035 | if (index >= caps.maxCombinedUniformBlocks) |
| 6036 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6037 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6038 | return; |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6039 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6040 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6041 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6042 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6043 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6044 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6045 | } |
| 6046 | |
| 6047 | if (!(context->getIndexedIntegerv(target, index, data))) |
| 6048 | { |
| 6049 | GLenum nativeType; |
| 6050 | unsigned int numParams = 0; |
| 6051 | if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams)) |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6052 | { |
| 6053 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6054 | return; |
| 6055 | } |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6056 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6057 | if (numParams == 0) |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6058 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6059 | 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] | 6060 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6061 | |
| 6062 | if (nativeType == GL_INT_64_ANGLEX) |
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 | GLint64 minIntValue = static_cast<GLint64>(std::numeric_limits<int>::min()); |
| 6065 | GLint64 maxIntValue = static_cast<GLint64>(std::numeric_limits<int>::max()); |
| 6066 | GLint64 *int64Params = new GLint64[numParams]; |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6067 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6068 | context->getIndexedInteger64v(target, index, int64Params); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6069 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6070 | for (unsigned int i = 0; i < numParams; ++i) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6071 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6072 | GLint64 clampedValue = std::max(std::min(int64Params[i], maxIntValue), minIntValue); |
| 6073 | data[i] = static_cast<GLint>(clampedValue); |
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 | |
| 6076 | delete [] int64Params; |
| 6077 | } |
| 6078 | else |
| 6079 | { |
| 6080 | UNREACHABLE(); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 6081 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6082 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6083 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6084 | } |
| 6085 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6086 | void GL_APIENTRY glBeginTransformFeedback(GLenum primitiveMode) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6087 | { |
| 6088 | EVENT("(GLenum primitiveMode = 0x%X)", primitiveMode); |
| 6089 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6090 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6091 | if (context) |
| 6092 | { |
| 6093 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6094 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6095 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6096 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6097 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6098 | |
| 6099 | switch (primitiveMode) |
| 6100 | { |
| 6101 | case GL_TRIANGLES: |
| 6102 | case GL_LINES: |
| 6103 | case GL_POINTS: |
| 6104 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6105 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6106 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6107 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6108 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6109 | } |
| 6110 | |
| 6111 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 6112 | ASSERT(transformFeedback != NULL); |
| 6113 | |
| 6114 | if (transformFeedback->isStarted()) |
| 6115 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6116 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6117 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6118 | } |
| 6119 | |
| 6120 | if (transformFeedback->isPaused()) |
| 6121 | { |
| 6122 | transformFeedback->resume(); |
| 6123 | } |
| 6124 | else |
| 6125 | { |
| 6126 | transformFeedback->start(primitiveMode); |
| 6127 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6128 | } |
| 6129 | } |
| 6130 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6131 | void GL_APIENTRY glEndTransformFeedback(void) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6132 | { |
| 6133 | EVENT("(void)"); |
| 6134 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6135 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6136 | if (context) |
| 6137 | { |
| 6138 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6139 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6140 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6141 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6142 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6143 | |
| 6144 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 6145 | ASSERT(transformFeedback != NULL); |
| 6146 | |
| 6147 | if (!transformFeedback->isStarted()) |
| 6148 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6149 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6150 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6151 | } |
| 6152 | |
| 6153 | transformFeedback->stop(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6154 | } |
| 6155 | } |
| 6156 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6157 | 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] | 6158 | { |
| 6159 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u, GLintptr offset = %d, GLsizeiptr size = %d)", |
| 6160 | target, index, buffer, offset, size); |
| 6161 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6162 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6163 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6164 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6165 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6166 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6167 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6168 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6169 | } |
| 6170 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6171 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6172 | switch (target) |
| 6173 | { |
| 6174 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6175 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6176 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6177 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6178 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6179 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6180 | break; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6181 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6182 | case GL_UNIFORM_BUFFER: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6183 | if (index >= caps.maxUniformBufferBindings) |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6184 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6185 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6186 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6187 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6188 | break; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6189 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6190 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6191 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6192 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6193 | } |
| 6194 | |
| 6195 | if (buffer != 0 && size <= 0) |
| 6196 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6197 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6198 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6199 | } |
| 6200 | |
| 6201 | switch (target) |
| 6202 | { |
| 6203 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 6204 | |
| 6205 | // size and offset must be a multiple of 4 |
| 6206 | 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] | 6207 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6208 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6209 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6210 | } |
| 6211 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6212 | context->bindIndexedTransformFeedbackBuffer(buffer, index, offset, size); |
| 6213 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 6214 | break; |
| 6215 | |
| 6216 | case GL_UNIFORM_BUFFER: |
| 6217 | |
| 6218 | // 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] | 6219 | if (buffer != 0 && (offset % caps.uniformBufferOffsetAlignment) != 0) |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6220 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6221 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6222 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6223 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6224 | |
| 6225 | context->bindIndexedUniformBuffer(buffer, index, offset, size); |
| 6226 | context->bindGenericUniformBuffer(buffer); |
| 6227 | break; |
| 6228 | |
| 6229 | default: |
| 6230 | UNREACHABLE(); |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6231 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6232 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6233 | } |
| 6234 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6235 | 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] | 6236 | { |
| 6237 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u)", |
| 6238 | target, index, buffer); |
| 6239 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6240 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6241 | if (context) |
| 6242 | { |
| 6243 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6244 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6245 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6246 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6247 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6248 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6249 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6250 | switch (target) |
| 6251 | { |
| 6252 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6253 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6254 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6255 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6256 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6257 | } |
| 6258 | break; |
| 6259 | |
| 6260 | case GL_UNIFORM_BUFFER: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6261 | if (index >= caps.maxUniformBufferBindings) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6262 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6263 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6264 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6265 | } |
| 6266 | break; |
| 6267 | |
| 6268 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6269 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6270 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6271 | } |
| 6272 | |
| 6273 | switch (target) |
| 6274 | { |
| 6275 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 6276 | context->bindIndexedTransformFeedbackBuffer(buffer, index, 0, 0); |
| 6277 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 6278 | break; |
| 6279 | |
| 6280 | case GL_UNIFORM_BUFFER: |
| 6281 | context->bindIndexedUniformBuffer(buffer, index, 0, 0); |
| 6282 | context->bindGenericUniformBuffer(buffer); |
| 6283 | break; |
| 6284 | |
| 6285 | default: |
| 6286 | UNREACHABLE(); |
| 6287 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6288 | } |
| 6289 | } |
| 6290 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6291 | 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] | 6292 | { |
| 6293 | EVENT("(GLuint program = %u, GLsizei count = %d, const GLchar* const* varyings = 0x%0.8p, GLenum bufferMode = 0x%X)", |
| 6294 | program, count, varyings, bufferMode); |
| 6295 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6296 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6297 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6298 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6299 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6300 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6301 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6302 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6303 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6304 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6305 | if (count < 0) |
| 6306 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6307 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6308 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6309 | } |
| 6310 | |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6311 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6312 | switch (bufferMode) |
| 6313 | { |
| 6314 | case GL_INTERLEAVED_ATTRIBS: |
| 6315 | break; |
| 6316 | case GL_SEPARATE_ATTRIBS: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6317 | if (static_cast<GLuint>(count) > caps.maxTransformFeedbackSeparateAttributes) |
Geoff Lang | 48dcae7 | 2014-02-05 16:28:24 -0500 | [diff] [blame] | 6318 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6319 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6320 | return; |
Geoff Lang | 48dcae7 | 2014-02-05 16:28:24 -0500 | [diff] [blame] | 6321 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6322 | break; |
| 6323 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6324 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6325 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6326 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6327 | |
| 6328 | if (!gl::ValidProgram(context, program)) |
| 6329 | { |
| 6330 | return; |
| 6331 | } |
| 6332 | |
| 6333 | gl::Program *programObject = context->getProgram(program); |
| 6334 | ASSERT(programObject); |
| 6335 | |
| 6336 | programObject->setTransformFeedbackVaryings(count, varyings, bufferMode); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6337 | } |
| 6338 | } |
| 6339 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6340 | 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] | 6341 | { |
| 6342 | EVENT("(GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, " |
| 6343 | "GLsizei* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)", |
| 6344 | program, index, bufSize, length, size, type, name); |
| 6345 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6346 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6347 | if (context) |
| 6348 | { |
| 6349 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6350 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6351 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6352 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6353 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6354 | |
| 6355 | if (bufSize < 0) |
| 6356 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6357 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6358 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6359 | } |
| 6360 | |
| 6361 | if (!gl::ValidProgram(context, program)) |
| 6362 | { |
| 6363 | return; |
| 6364 | } |
| 6365 | |
| 6366 | gl::Program *programObject = context->getProgram(program); |
| 6367 | ASSERT(programObject); |
| 6368 | |
| 6369 | if (index >= static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount())) |
| 6370 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6371 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6372 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6373 | } |
| 6374 | |
| 6375 | programObject->getTransformFeedbackVarying(index, bufSize, length, size, type, name); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6376 | } |
| 6377 | } |
| 6378 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6379 | 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] | 6380 | { |
| 6381 | EVENT("(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid* pointer = 0x%0.8p)", |
| 6382 | index, size, type, stride, pointer); |
| 6383 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6384 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6385 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6386 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6387 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6388 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6389 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6390 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6391 | } |
| 6392 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6393 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6394 | { |
| 6395 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6396 | return; |
| 6397 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6398 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6399 | if (size < 1 || size > 4) |
| 6400 | { |
| 6401 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6402 | return; |
| 6403 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6404 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6405 | switch (type) |
| 6406 | { |
| 6407 | case GL_BYTE: |
| 6408 | case GL_UNSIGNED_BYTE: |
| 6409 | case GL_SHORT: |
| 6410 | case GL_UNSIGNED_SHORT: |
| 6411 | case GL_INT: |
| 6412 | case GL_UNSIGNED_INT: |
| 6413 | case GL_INT_2_10_10_10_REV: |
| 6414 | case GL_UNSIGNED_INT_2_10_10_10_REV: |
| 6415 | break; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6416 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6417 | default: |
| 6418 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6419 | return; |
| 6420 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6421 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6422 | if (stride < 0) |
| 6423 | { |
| 6424 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6425 | return; |
| 6426 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6427 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6428 | if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4) |
| 6429 | { |
| 6430 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6431 | return; |
| 6432 | } |
| 6433 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6434 | // [OpenGL ES 3.0.2] Section 2.8 page 24: |
| 6435 | // An INVALID_OPERATION error is generated when a non-zero vertex array object |
| 6436 | // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point, |
| 6437 | // and the pointer argument is not NULL. |
| 6438 | 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] | 6439 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6440 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6441 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 1ab57be | 2013-04-13 03:38:39 +0000 | [diff] [blame] | 6442 | } |
| 6443 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6444 | context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type, false, true, |
| 6445 | stride, pointer); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6446 | } |
| 6447 | } |
| 6448 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6449 | 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] | 6450 | { |
| 6451 | EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 6452 | index, pname, params); |
| 6453 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6454 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6455 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6456 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6457 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6458 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6459 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6460 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6461 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6462 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6463 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6464 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6465 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6466 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6467 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6468 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6469 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6470 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6471 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6472 | { |
| 6473 | return; |
| 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 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 6477 | { |
| 6478 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 6479 | for (int i = 0; i < 4; ++i) |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6480 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6481 | params[i] = currentValueData.IntValues[i]; |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6482 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6483 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6484 | else |
| 6485 | { |
| 6486 | *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname); |
| 6487 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6488 | } |
| 6489 | } |
| 6490 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6491 | 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] | 6492 | { |
| 6493 | EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLuint* params = 0x%0.8p)", |
| 6494 | index, pname, params); |
| 6495 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6496 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6497 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6498 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6499 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6500 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6501 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6502 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6503 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6504 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6505 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6506 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6507 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6508 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6509 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6510 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6511 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6512 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6513 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6514 | { |
| 6515 | return; |
| 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 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 6519 | { |
| 6520 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 6521 | for (int i = 0; i < 4; ++i) |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6522 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6523 | params[i] = currentValueData.UnsignedIntValues[i]; |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6524 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6525 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6526 | else |
| 6527 | { |
| 6528 | *params = gl::QuerySingleVertexAttributeParameter<GLuint>(attribState, pname); |
| 6529 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6530 | } |
| 6531 | } |
| 6532 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6533 | 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] | 6534 | { |
| 6535 | EVENT("(GLuint index = %u, GLint x = %d, GLint y = %d, GLint z = %d, GLint w = %d)", |
| 6536 | index, x, y, z, w); |
| 6537 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6538 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6539 | if (context) |
| 6540 | { |
| 6541 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6542 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6543 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6544 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6545 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6546 | |
| 6547 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6548 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6549 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6550 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6551 | } |
| 6552 | |
| 6553 | GLint vals[4] = { x, y, z, w }; |
| 6554 | context->getState().setVertexAttribi(index, vals); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6555 | } |
| 6556 | } |
| 6557 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6558 | void GL_APIENTRY 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] | 6559 | { |
| 6560 | EVENT("(GLuint index = %u, GLuint x = %u, GLuint y = %u, GLuint z = %u, GLuint w = %u)", |
| 6561 | index, x, y, z, w); |
| 6562 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6563 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6564 | if (context) |
| 6565 | { |
| 6566 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6567 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6568 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6569 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6570 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6571 | |
| 6572 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6573 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6574 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6575 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6576 | } |
| 6577 | |
| 6578 | GLuint vals[4] = { x, y, z, w }; |
| 6579 | context->getState().setVertexAttribu(index, vals); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6580 | } |
| 6581 | } |
| 6582 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6583 | 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] | 6584 | { |
| 6585 | EVENT("(GLuint index = %u, const GLint* v = 0x%0.8p)", index, v); |
| 6586 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6587 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6588 | if (context) |
| 6589 | { |
| 6590 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6591 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6592 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6593 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6594 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6595 | |
| 6596 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6597 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6598 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6599 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6600 | } |
| 6601 | |
| 6602 | context->getState().setVertexAttribi(index, v); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6603 | } |
| 6604 | } |
| 6605 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6606 | 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] | 6607 | { |
| 6608 | EVENT("(GLuint index = %u, const GLuint* v = 0x%0.8p)", index, v); |
| 6609 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6610 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6611 | if (context) |
| 6612 | { |
| 6613 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6614 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6615 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6616 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6617 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6618 | |
| 6619 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6620 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6621 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6622 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6623 | } |
| 6624 | |
| 6625 | context->getState().setVertexAttribu(index, v); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6626 | } |
| 6627 | } |
| 6628 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6629 | 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] | 6630 | { |
| 6631 | EVENT("(GLuint program = %u, GLint location = %d, GLuint* params = 0x%0.8p)", |
| 6632 | program, location, params); |
| 6633 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6634 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6635 | if (context) |
| 6636 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 6637 | if (!ValidateGetUniformuiv(context, program, location, params)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6638 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 6639 | return; |
shannon.woods%transgaming.com@gtempaccount.com | e229012 | 2013-04-13 03:41:07 +0000 | [diff] [blame] | 6640 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6641 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 6642 | gl::Program *programObject = context->getProgram(program); |
| 6643 | ASSERT(programObject); |
| 6644 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 6645 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6646 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 6647 | programBinary->getUniformuiv(location, params); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6648 | } |
| 6649 | } |
| 6650 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6651 | 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] | 6652 | { |
| 6653 | EVENT("(GLuint program = %u, const GLchar *name = 0x%0.8p)", |
| 6654 | program, name); |
| 6655 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6656 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6657 | if (context) |
| 6658 | { |
| 6659 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6660 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6661 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6662 | return -1; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6663 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6664 | |
| 6665 | if (program == 0) |
| 6666 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6667 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6668 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6669 | } |
| 6670 | |
| 6671 | gl::Program *programObject = context->getProgram(program); |
| 6672 | |
| 6673 | if (!programObject || !programObject->isLinked()) |
| 6674 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6675 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6676 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6677 | } |
| 6678 | |
| 6679 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 6680 | if (!programBinary) |
| 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 | return programBinary->getFragDataLocation(name); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6687 | } |
| 6688 | |
| 6689 | return 0; |
| 6690 | } |
| 6691 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6692 | void GL_APIENTRY glUniform1ui(GLint location, GLuint v0) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6693 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6694 | glUniform1uiv(location, 1, &v0); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6695 | } |
| 6696 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6697 | 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] | 6698 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6699 | const GLuint xy[] = { v0, v1 }; |
| 6700 | glUniform2uiv(location, 1, xy); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6701 | } |
| 6702 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6703 | 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] | 6704 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6705 | const GLuint xyz[] = { v0, v1, v2 }; |
| 6706 | glUniform3uiv(location, 1, xyz); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6707 | } |
| 6708 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6709 | 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] | 6710 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6711 | const GLuint xyzw[] = { v0, v1, v2, v3 }; |
| 6712 | glUniform4uiv(location, 1, xyzw); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6713 | } |
| 6714 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6715 | 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] | 6716 | { |
| 6717 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6718 | location, count, value); |
| 6719 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6720 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6721 | if (context) |
| 6722 | { |
| 6723 | if (!ValidateUniform(context, GL_UNSIGNED_INT, location, count)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6724 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6725 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6726 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6727 | |
| 6728 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6729 | programBinary->setUniform1uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6730 | } |
| 6731 | } |
| 6732 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6733 | 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] | 6734 | { |
| 6735 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6736 | location, count, value); |
| 6737 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6738 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6739 | if (context) |
| 6740 | { |
| 6741 | 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] | 6742 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6743 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6744 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6745 | |
| 6746 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6747 | programBinary->setUniform2uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6748 | } |
| 6749 | } |
| 6750 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6751 | 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] | 6752 | { |
| 6753 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value)", |
| 6754 | location, count, value); |
| 6755 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6756 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6757 | if (context) |
| 6758 | { |
| 6759 | 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] | 6760 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6761 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6762 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6763 | |
| 6764 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6765 | programBinary->setUniform3uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6766 | } |
| 6767 | } |
| 6768 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6769 | 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] | 6770 | { |
| 6771 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6772 | location, count, value); |
| 6773 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6774 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6775 | if (context) |
| 6776 | { |
| 6777 | 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] | 6778 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6779 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6780 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6781 | |
| 6782 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6783 | programBinary->setUniform4uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6784 | } |
| 6785 | } |
| 6786 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6787 | 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] | 6788 | { |
| 6789 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint* value = 0x%0.8p)", |
| 6790 | buffer, drawbuffer, value); |
| 6791 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6792 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6793 | if (context) |
| 6794 | { |
| 6795 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6796 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6797 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6798 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6799 | |
| 6800 | switch (buffer) |
| 6801 | { |
| 6802 | case GL_COLOR: |
| 6803 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6804 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6805 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6806 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6807 | } |
| 6808 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6809 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6810 | case GL_STENCIL: |
| 6811 | if (drawbuffer != 0) |
| 6812 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6813 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6814 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6815 | } |
| 6816 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6817 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6818 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6819 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6820 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6821 | } |
| 6822 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6823 | gl::Error error = context->clearBufferiv(buffer, drawbuffer, value); |
| 6824 | if (error.isError()) |
| 6825 | { |
| 6826 | context->recordError(error); |
| 6827 | return; |
| 6828 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6829 | } |
| 6830 | } |
| 6831 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6832 | 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] | 6833 | { |
| 6834 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint* value = 0x%0.8p)", |
| 6835 | buffer, drawbuffer, value); |
| 6836 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6837 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6838 | if (context) |
| 6839 | { |
| 6840 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6841 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6842 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6843 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6844 | |
| 6845 | switch (buffer) |
| 6846 | { |
| 6847 | case GL_COLOR: |
| 6848 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6849 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6850 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6851 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6852 | } |
| 6853 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6854 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6855 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6856 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6857 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6858 | } |
| 6859 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6860 | gl::Error error = context->clearBufferuiv(buffer, drawbuffer, value); |
| 6861 | if (error.isError()) |
| 6862 | { |
| 6863 | context->recordError(error); |
| 6864 | return; |
| 6865 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6866 | } |
| 6867 | } |
| 6868 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6869 | 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] | 6870 | { |
| 6871 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat* value = 0x%0.8p)", |
| 6872 | buffer, drawbuffer, value); |
| 6873 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6874 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6875 | if (context) |
| 6876 | { |
| 6877 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6878 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6879 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6880 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6881 | |
| 6882 | switch (buffer) |
| 6883 | { |
| 6884 | case GL_COLOR: |
| 6885 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6886 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6887 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6888 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6889 | } |
| 6890 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6891 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6892 | case GL_DEPTH: |
| 6893 | if (drawbuffer != 0) |
| 6894 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6895 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6896 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6897 | } |
| 6898 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6899 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6900 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6901 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6902 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6903 | } |
| 6904 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6905 | gl::Error error = context->clearBufferfv(buffer, drawbuffer, value); |
| 6906 | if (error.isError()) |
| 6907 | { |
| 6908 | context->recordError(error); |
| 6909 | return; |
| 6910 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6911 | } |
| 6912 | } |
| 6913 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6914 | 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] | 6915 | { |
| 6916 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth, GLint stencil = %d)", |
| 6917 | buffer, drawbuffer, depth, stencil); |
| 6918 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6919 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6920 | if (context) |
| 6921 | { |
| 6922 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6923 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6924 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6925 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6926 | |
| 6927 | switch (buffer) |
| 6928 | { |
| 6929 | case GL_DEPTH_STENCIL: |
| 6930 | if (drawbuffer != 0) |
| 6931 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6932 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6933 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6934 | } |
| 6935 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6936 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6937 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6938 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6939 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6940 | } |
| 6941 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6942 | gl::Error error = context->clearBufferfi(buffer, drawbuffer, depth, stencil); |
| 6943 | if (error.isError()) |
| 6944 | { |
| 6945 | context->recordError(error); |
| 6946 | return; |
| 6947 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6948 | } |
| 6949 | } |
| 6950 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6951 | 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] | 6952 | { |
| 6953 | EVENT("(GLenum name = 0x%X, GLuint index = %u)", name, index); |
| 6954 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6955 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6956 | if (context) |
| 6957 | { |
| 6958 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6959 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6960 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6961 | return NULL; |
shannonwoods@chromium.org | 302df74 | 2013-05-30 00:05:54 +0000 | [diff] [blame] | 6962 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6963 | |
| 6964 | if (name != GL_EXTENSIONS) |
| 6965 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6966 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6967 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6968 | } |
| 6969 | |
| 6970 | if (index >= context->getExtensionStringCount()) |
| 6971 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6972 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6973 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6974 | } |
| 6975 | |
| 6976 | 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] | 6977 | } |
| 6978 | |
| 6979 | return NULL; |
| 6980 | } |
| 6981 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 6982 | 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] | 6983 | { |
| 6984 | EVENT("(GLenum readTarget = 0x%X, GLenum writeTarget = 0x%X, GLintptr readOffset = %d, GLintptr writeOffset = %d, GLsizeiptr size = %d)", |
| 6985 | readTarget, writeTarget, readOffset, writeOffset, size); |
| 6986 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6987 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6988 | if (context) |
| 6989 | { |
| 6990 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6991 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6992 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6993 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 296c3f2 | 2013-04-13 03:39:39 +0000 | [diff] [blame] | 6994 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6995 | |
Jamie Madill | 24e8319 | 2014-10-20 11:00:53 -0400 | [diff] [blame] | 6996 | if (!gl::ValidBufferTarget(context, readTarget) || !gl::ValidBufferTarget(context, writeTarget)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6997 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6998 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6999 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7000 | } |
| 7001 | |
| 7002 | gl::Buffer *readBuffer = context->getState().getTargetBuffer(readTarget); |
| 7003 | gl::Buffer *writeBuffer = context->getState().getTargetBuffer(writeTarget); |
| 7004 | |
| 7005 | if (!readBuffer || !writeBuffer) |
| 7006 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7007 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7008 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7009 | } |
| 7010 | |
Jamie Madill | cfaaf72 | 2014-07-31 10:47:54 -0400 | [diff] [blame] | 7011 | // Verify that readBuffer and writeBuffer are not currently mapped |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7012 | if (readBuffer->isMapped() || writeBuffer->isMapped()) |
| 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 | |
| 7018 | if (readOffset < 0 || writeOffset < 0 || size < 0 || |
| 7019 | static_cast<unsigned int>(readOffset + size) > readBuffer->getSize() || |
| 7020 | static_cast<unsigned int>(writeOffset + size) > writeBuffer->getSize()) |
| 7021 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7022 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7023 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7024 | } |
| 7025 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7026 | if (readBuffer == writeBuffer && std::abs(readOffset - writeOffset) < size) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7027 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7028 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7029 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7030 | } |
| 7031 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7032 | // if size is zero, the copy is a successful no-op |
| 7033 | if (size > 0) |
| 7034 | { |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 7035 | gl::Error error = writeBuffer->copyBufferSubData(readBuffer, readOffset, writeOffset, size); |
| 7036 | if (error.isError()) |
| 7037 | { |
| 7038 | context->recordError(error); |
| 7039 | return; |
| 7040 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7041 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7042 | } |
| 7043 | } |
| 7044 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7045 | 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] | 7046 | { |
| 7047 | EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLchar* const* uniformNames = 0x%0.8p, GLuint* uniformIndices = 0x%0.8p)", |
| 7048 | program, uniformCount, uniformNames, uniformIndices); |
| 7049 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7050 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7051 | if (context) |
| 7052 | { |
| 7053 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7054 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7055 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7056 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7057 | } |
| 7058 | |
| 7059 | if (uniformCount < 0) |
| 7060 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7061 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7062 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7063 | } |
| 7064 | |
| 7065 | gl::Program *programObject = context->getProgram(program); |
| 7066 | |
| 7067 | if (!programObject) |
| 7068 | { |
| 7069 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7070 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7071 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7072 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7073 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7074 | else |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7075 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7076 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7077 | return; |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7078 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7079 | } |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7080 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7081 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7082 | if (!programObject->isLinked() || !programBinary) |
| 7083 | { |
| 7084 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
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 | uniformIndices[uniformId] = GL_INVALID_INDEX; |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 7087 | } |
| 7088 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7089 | else |
| 7090 | { |
| 7091 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 7092 | { |
| 7093 | uniformIndices[uniformId] = programBinary->getUniformIndex(uniformNames[uniformId]); |
| 7094 | } |
| 7095 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7096 | } |
| 7097 | } |
| 7098 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7099 | 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] | 7100 | { |
| 7101 | EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLuint* uniformIndices = 0x%0.8p, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 7102 | program, uniformCount, uniformIndices, pname, params); |
| 7103 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7104 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7105 | if (context) |
| 7106 | { |
| 7107 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7108 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7109 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7110 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7111 | } |
| 7112 | |
| 7113 | if (uniformCount < 0) |
| 7114 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7115 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7116 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7117 | } |
| 7118 | |
| 7119 | gl::Program *programObject = context->getProgram(program); |
| 7120 | |
| 7121 | if (!programObject) |
| 7122 | { |
| 7123 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7124 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7125 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7126 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7127 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7128 | else |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 7129 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7130 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7131 | return; |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 7132 | } |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 7133 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7134 | |
| 7135 | switch (pname) |
| 7136 | { |
| 7137 | case GL_UNIFORM_TYPE: |
| 7138 | case GL_UNIFORM_SIZE: |
| 7139 | case GL_UNIFORM_NAME_LENGTH: |
| 7140 | case GL_UNIFORM_BLOCK_INDEX: |
| 7141 | case GL_UNIFORM_OFFSET: |
| 7142 | case GL_UNIFORM_ARRAY_STRIDE: |
| 7143 | case GL_UNIFORM_MATRIX_STRIDE: |
| 7144 | case GL_UNIFORM_IS_ROW_MAJOR: |
| 7145 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7146 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7147 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7148 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7149 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7150 | } |
| 7151 | |
| 7152 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7153 | |
| 7154 | if (!programBinary && uniformCount > 0) |
| 7155 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7156 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7157 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7158 | } |
| 7159 | |
| 7160 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 7161 | { |
| 7162 | const GLuint index = uniformIndices[uniformId]; |
| 7163 | |
| 7164 | if (index >= (GLuint)programBinary->getActiveUniformCount()) |
| 7165 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7166 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7167 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7168 | } |
| 7169 | } |
| 7170 | |
| 7171 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 7172 | { |
| 7173 | const GLuint index = uniformIndices[uniformId]; |
| 7174 | params[uniformId] = programBinary->getActiveUniformi(index, pname); |
| 7175 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7176 | } |
| 7177 | } |
| 7178 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7179 | 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] | 7180 | { |
| 7181 | EVENT("(GLuint program = %u, const GLchar* uniformBlockName = 0x%0.8p)", program, uniformBlockName); |
| 7182 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7183 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7184 | if (context) |
| 7185 | { |
| 7186 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7187 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7188 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7189 | return GL_INVALID_INDEX; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7190 | } |
| 7191 | |
| 7192 | gl::Program *programObject = context->getProgram(program); |
| 7193 | |
| 7194 | if (!programObject) |
| 7195 | { |
| 7196 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7197 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7198 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7199 | return GL_INVALID_INDEX; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7200 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7201 | else |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 7202 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7203 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7204 | return GL_INVALID_INDEX; |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 7205 | } |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 7206 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7207 | |
| 7208 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7209 | if (!programBinary) |
| 7210 | { |
| 7211 | return GL_INVALID_INDEX; |
| 7212 | } |
| 7213 | |
| 7214 | return programBinary->getUniformBlockIndex(uniformBlockName); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7215 | } |
| 7216 | |
| 7217 | return 0; |
| 7218 | } |
| 7219 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7220 | 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] | 7221 | { |
| 7222 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 7223 | program, uniformBlockIndex, pname, params); |
| 7224 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7225 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7226 | if (context) |
| 7227 | { |
| 7228 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7229 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7230 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7231 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7232 | } |
| 7233 | gl::Program *programObject = context->getProgram(program); |
| 7234 | |
| 7235 | if (!programObject) |
| 7236 | { |
| 7237 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7238 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7239 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7240 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7241 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7242 | else |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 7243 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7244 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7245 | return; |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 7246 | } |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 7247 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7248 | |
| 7249 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7250 | |
| 7251 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 7252 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7253 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7254 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7255 | } |
| 7256 | |
| 7257 | switch (pname) |
| 7258 | { |
| 7259 | case GL_UNIFORM_BLOCK_BINDING: |
| 7260 | *params = static_cast<GLint>(programObject->getUniformBlockBinding(uniformBlockIndex)); |
| 7261 | break; |
| 7262 | |
| 7263 | case GL_UNIFORM_BLOCK_DATA_SIZE: |
| 7264 | case GL_UNIFORM_BLOCK_NAME_LENGTH: |
| 7265 | case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS: |
| 7266 | case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: |
| 7267 | case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: |
| 7268 | case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: |
| 7269 | programBinary->getActiveUniformBlockiv(uniformBlockIndex, pname, params); |
| 7270 | break; |
| 7271 | |
| 7272 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7273 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7274 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7275 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7276 | } |
| 7277 | } |
| 7278 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7279 | 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] | 7280 | { |
| 7281 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLchar* uniformBlockName = 0x%0.8p)", |
| 7282 | program, uniformBlockIndex, bufSize, length, uniformBlockName); |
| 7283 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7284 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7285 | if (context) |
| 7286 | { |
| 7287 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7288 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7289 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7290 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7291 | } |
| 7292 | |
| 7293 | gl::Program *programObject = context->getProgram(program); |
| 7294 | |
| 7295 | if (!programObject) |
| 7296 | { |
| 7297 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7298 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7299 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7300 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7301 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7302 | else |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 7303 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7304 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7305 | return; |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 7306 | } |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 7307 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7308 | |
| 7309 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7310 | |
| 7311 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 7312 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7313 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7314 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7315 | } |
| 7316 | |
| 7317 | programBinary->getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7318 | } |
| 7319 | } |
| 7320 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7321 | 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] | 7322 | { |
| 7323 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLuint uniformBlockBinding = %u)", |
| 7324 | program, uniformBlockIndex, uniformBlockBinding); |
| 7325 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7326 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7327 | if (context) |
| 7328 | { |
| 7329 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7330 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7331 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7332 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7333 | } |
| 7334 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7335 | if (uniformBlockBinding >= context->getCaps().maxUniformBufferBindings) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7336 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7337 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7338 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7339 | } |
| 7340 | |
| 7341 | gl::Program *programObject = context->getProgram(program); |
| 7342 | |
| 7343 | if (!programObject) |
| 7344 | { |
| 7345 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7346 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7347 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7348 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7349 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7350 | else |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 7351 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7352 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7353 | return; |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 7354 | } |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 7355 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7356 | |
| 7357 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7358 | |
| 7359 | // if never linked, there won't be any uniform blocks |
| 7360 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 7361 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7362 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7363 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7364 | } |
| 7365 | |
| 7366 | programObject->bindUniformBlock(uniformBlockIndex, uniformBlockBinding); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7367 | } |
| 7368 | } |
| 7369 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7370 | 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] | 7371 | { |
| 7372 | EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei instanceCount = %d)", |
| 7373 | mode, first, count, instanceCount); |
| 7374 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7375 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7376 | if (context) |
| 7377 | { |
| 7378 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7379 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7380 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7381 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7382 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7383 | |
| 7384 | // glDrawArraysInstanced |
| 7385 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7386 | } |
| 7387 | } |
| 7388 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7389 | 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] | 7390 | { |
| 7391 | EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei instanceCount = %d)", |
| 7392 | mode, count, type, indices, instanceCount); |
| 7393 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7394 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7395 | if (context) |
| 7396 | { |
| 7397 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7398 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7399 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7400 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7401 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7402 | |
| 7403 | // glDrawElementsInstanced |
| 7404 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7405 | } |
| 7406 | } |
| 7407 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7408 | GLsync GL_APIENTRY glFenceSync(GLenum condition, GLbitfield flags) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7409 | { |
| 7410 | EVENT("(GLenum condition = 0x%X, GLbitfield flags = 0x%X)", condition, flags); |
| 7411 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7412 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7413 | if (context) |
| 7414 | { |
| 7415 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7416 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7417 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7418 | return 0; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7419 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7420 | |
| 7421 | if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) |
| 7422 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7423 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7424 | return 0; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7425 | } |
| 7426 | |
| 7427 | if (flags != 0) |
| 7428 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7429 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7430 | return 0; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7431 | } |
| 7432 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7433 | GLsync fenceSync = context->createFenceSync(); |
| 7434 | |
| 7435 | gl::FenceSync *fenceSyncObject = context->getFenceSync(fenceSync); |
| 7436 | gl::Error error = fenceSyncObject->set(condition); |
| 7437 | if (error.isError()) |
| 7438 | { |
| 7439 | context->deleteFenceSync(fenceSync); |
| 7440 | context->recordError(error); |
| 7441 | return NULL; |
| 7442 | } |
| 7443 | |
| 7444 | return fenceSync; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7445 | } |
| 7446 | |
| 7447 | return NULL; |
| 7448 | } |
| 7449 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7450 | GLboolean GL_APIENTRY glIsSync(GLsync sync) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7451 | { |
| 7452 | EVENT("(GLsync sync = 0x%0.8p)", sync); |
| 7453 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7454 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7455 | if (context) |
| 7456 | { |
| 7457 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7458 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7459 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7460 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7461 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7462 | |
| 7463 | return (context->getFenceSync(sync) != NULL); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7464 | } |
| 7465 | |
| 7466 | return GL_FALSE; |
| 7467 | } |
| 7468 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7469 | void GL_APIENTRY glDeleteSync(GLsync sync) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7470 | { |
| 7471 | EVENT("(GLsync sync = 0x%0.8p)", sync); |
| 7472 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7473 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7474 | if (context) |
| 7475 | { |
| 7476 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7477 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7478 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7479 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7480 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7481 | |
| 7482 | if (sync != static_cast<GLsync>(0) && !context->getFenceSync(sync)) |
| 7483 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7484 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7485 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7486 | } |
| 7487 | |
| 7488 | context->deleteFenceSync(sync); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7489 | } |
| 7490 | } |
| 7491 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7492 | 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] | 7493 | { |
| 7494 | EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", |
| 7495 | sync, flags, timeout); |
| 7496 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7497 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7498 | if (context) |
| 7499 | { |
| 7500 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7501 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7502 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7503 | return GL_WAIT_FAILED; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7504 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7505 | |
| 7506 | if ((flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0) |
| 7507 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7508 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7509 | return GL_WAIT_FAILED; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7510 | } |
| 7511 | |
| 7512 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7513 | |
| 7514 | if (!fenceSync) |
| 7515 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7516 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7517 | return GL_WAIT_FAILED; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7518 | } |
| 7519 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7520 | GLenum result = GL_WAIT_FAILED; |
| 7521 | gl::Error error = fenceSync->clientWait(flags, timeout, &result); |
| 7522 | if (error.isError()) |
| 7523 | { |
| 7524 | context->recordError(error); |
| 7525 | return GL_WAIT_FAILED; |
| 7526 | } |
| 7527 | |
| 7528 | return result; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7529 | } |
| 7530 | |
| 7531 | return GL_FALSE; |
| 7532 | } |
| 7533 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7534 | 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] | 7535 | { |
| 7536 | EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", |
| 7537 | sync, flags, timeout); |
| 7538 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7539 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7540 | if (context) |
| 7541 | { |
| 7542 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7543 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7544 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7545 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7546 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7547 | |
| 7548 | if (flags != 0) |
| 7549 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7550 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7551 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7552 | } |
| 7553 | |
| 7554 | if (timeout != GL_TIMEOUT_IGNORED) |
| 7555 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7556 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7557 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7558 | } |
| 7559 | |
| 7560 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7561 | |
| 7562 | if (!fenceSync) |
| 7563 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7564 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7565 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7566 | } |
| 7567 | |
Kenneth Russell | caa549c | 2014-10-10 17:52:59 -0700 | [diff] [blame] | 7568 | gl::Error error = fenceSync->serverWait(flags, timeout); |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7569 | if (error.isError()) |
| 7570 | { |
| 7571 | context->recordError(error); |
| 7572 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7573 | } |
| 7574 | } |
| 7575 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7576 | void GL_APIENTRY glGetInteger64v(GLenum pname, GLint64* params) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7577 | { |
| 7578 | EVENT("(GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", |
| 7579 | pname, params); |
| 7580 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7581 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7582 | if (context) |
| 7583 | { |
| 7584 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7585 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7586 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7587 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7588 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7589 | |
| 7590 | GLenum nativeType; |
| 7591 | unsigned int numParams = 0; |
| 7592 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
| 7593 | { |
| 7594 | return; |
| 7595 | } |
| 7596 | |
| 7597 | if (nativeType == GL_INT_64_ANGLEX) |
| 7598 | { |
| 7599 | context->getInteger64v(pname, params); |
| 7600 | } |
| 7601 | else |
| 7602 | { |
| 7603 | CastStateValues(context, nativeType, pname, numParams, params); |
| 7604 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7605 | } |
| 7606 | } |
| 7607 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7608 | 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] | 7609 | { |
| 7610 | EVENT("(GLsync sync = 0x%0.8p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLint* values = 0x%0.8p)", |
| 7611 | sync, pname, bufSize, length, values); |
| 7612 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7613 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7614 | if (context) |
| 7615 | { |
| 7616 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7617 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7618 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7619 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7620 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7621 | |
| 7622 | if (bufSize < 0) |
| 7623 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7624 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7625 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7626 | } |
| 7627 | |
| 7628 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7629 | |
| 7630 | if (!fenceSync) |
| 7631 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7632 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7633 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7634 | } |
| 7635 | |
| 7636 | switch (pname) |
| 7637 | { |
| 7638 | 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] | 7639 | case GL_SYNC_CONDITION: values[0] = static_cast<GLint>(fenceSync->getCondition()); break; |
| 7640 | case GL_SYNC_FLAGS: values[0] = 0; break; |
| 7641 | |
Geoff Lang | 882033e | 2014-09-30 11:26:07 -0400 | [diff] [blame] | 7642 | case GL_SYNC_STATUS: |
| 7643 | { |
| 7644 | gl::Error error = fenceSync->getStatus(values); |
| 7645 | if (error.isError()) |
| 7646 | { |
| 7647 | context->recordError(error); |
| 7648 | return; |
| 7649 | } |
| 7650 | break; |
| 7651 | } |
| 7652 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7653 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7654 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7655 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7656 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7657 | } |
| 7658 | } |
| 7659 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7660 | 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] | 7661 | { |
| 7662 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint64* data = 0x%0.8p)", |
| 7663 | target, index, data); |
| 7664 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7665 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7666 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7667 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7668 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7669 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7670 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7671 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7672 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7673 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7674 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7675 | switch (target) |
| 7676 | { |
| 7677 | case GL_TRANSFORM_FEEDBACK_BUFFER_START: |
| 7678 | case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: |
| 7679 | case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 7680 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
| 7681 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7682 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7683 | return; |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 7684 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7685 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7686 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7687 | case GL_UNIFORM_BUFFER_START: |
| 7688 | case GL_UNIFORM_BUFFER_SIZE: |
| 7689 | case GL_UNIFORM_BUFFER_BINDING: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7690 | if (index >= caps.maxUniformBufferBindings) |
| 7691 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7692 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7693 | return; |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7694 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7695 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7696 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7697 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7698 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7699 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7700 | } |
| 7701 | |
| 7702 | if (!(context->getIndexedInteger64v(target, index, data))) |
| 7703 | { |
| 7704 | GLenum nativeType; |
| 7705 | unsigned int numParams = 0; |
| 7706 | if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams)) |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7707 | { |
| 7708 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7709 | return; |
| 7710 | } |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7711 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7712 | if (numParams == 0) |
| 7713 | return; // it is known that pname is valid, but there are no parameters to return |
| 7714 | |
| 7715 | if (nativeType == GL_INT) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7716 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7717 | GLint *intParams = new GLint[numParams]; |
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 | context->getIndexedIntegerv(target, index, intParams); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7720 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7721 | for (unsigned int i = 0; i < numParams; ++i) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7722 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7723 | data[i] = static_cast<GLint64>(intParams[i]); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7724 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7725 | |
| 7726 | delete [] intParams; |
| 7727 | } |
| 7728 | else |
| 7729 | { |
| 7730 | UNREACHABLE(); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7731 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7732 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7733 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7734 | } |
| 7735 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7736 | 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] | 7737 | { |
| 7738 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", |
| 7739 | target, pname, params); |
| 7740 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7741 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7742 | if (context) |
| 7743 | { |
| 7744 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7745 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7746 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7747 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7748 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7749 | |
| 7750 | if (!gl::ValidBufferTarget(context, target)) |
| 7751 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7752 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7753 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7754 | } |
| 7755 | |
| 7756 | if (!gl::ValidBufferParameter(context, pname)) |
| 7757 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7758 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7759 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7760 | } |
| 7761 | |
| 7762 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 7763 | |
| 7764 | if (!buffer) |
| 7765 | { |
| 7766 | // 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] | 7767 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7768 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7769 | } |
| 7770 | |
| 7771 | switch (pname) |
| 7772 | { |
| 7773 | case GL_BUFFER_USAGE: |
| 7774 | *params = static_cast<GLint64>(buffer->getUsage()); |
| 7775 | break; |
| 7776 | case GL_BUFFER_SIZE: |
| 7777 | *params = buffer->getSize(); |
| 7778 | break; |
| 7779 | case GL_BUFFER_ACCESS_FLAGS: |
| 7780 | *params = static_cast<GLint64>(buffer->getAccessFlags()); |
| 7781 | break; |
| 7782 | case GL_BUFFER_MAPPED: |
| 7783 | *params = static_cast<GLint64>(buffer->isMapped()); |
| 7784 | break; |
| 7785 | case GL_BUFFER_MAP_OFFSET: |
| 7786 | *params = buffer->getMapOffset(); |
| 7787 | break; |
| 7788 | case GL_BUFFER_MAP_LENGTH: |
| 7789 | *params = buffer->getMapLength(); |
| 7790 | break; |
| 7791 | default: UNREACHABLE(); break; |
| 7792 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7793 | } |
| 7794 | } |
| 7795 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7796 | void GL_APIENTRY glGenSamplers(GLsizei count, GLuint* samplers) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7797 | { |
| 7798 | EVENT("(GLsizei count = %d, GLuint* samplers = 0x%0.8p)", count, samplers); |
| 7799 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7800 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7801 | if (context) |
| 7802 | { |
| 7803 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7804 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7805 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7806 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7807 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7808 | |
| 7809 | if (count < 0) |
| 7810 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7811 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7812 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7813 | } |
| 7814 | |
| 7815 | for (int i = 0; i < count; i++) |
| 7816 | { |
| 7817 | samplers[i] = context->createSampler(); |
| 7818 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7819 | } |
| 7820 | } |
| 7821 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7822 | 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] | 7823 | { |
| 7824 | EVENT("(GLsizei count = %d, const GLuint* samplers = 0x%0.8p)", count, samplers); |
| 7825 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7826 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7827 | if (context) |
| 7828 | { |
| 7829 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7830 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7831 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7832 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7833 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7834 | |
| 7835 | if (count < 0) |
| 7836 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7837 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7838 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7839 | } |
| 7840 | |
| 7841 | for (int i = 0; i < count; i++) |
| 7842 | { |
| 7843 | context->deleteSampler(samplers[i]); |
| 7844 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7845 | } |
| 7846 | } |
| 7847 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7848 | GLboolean GL_APIENTRY glIsSampler(GLuint sampler) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7849 | { |
| 7850 | EVENT("(GLuint sampler = %u)", sampler); |
| 7851 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7852 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7853 | if (context) |
| 7854 | { |
| 7855 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7856 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7857 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7858 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7859 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7860 | |
| 7861 | return context->isSampler(sampler); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7862 | } |
| 7863 | |
| 7864 | return GL_FALSE; |
| 7865 | } |
| 7866 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7867 | void GL_APIENTRY glBindSampler(GLuint unit, GLuint sampler) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7868 | { |
| 7869 | EVENT("(GLuint unit = %u, GLuint sampler = %u)", unit, sampler); |
| 7870 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7871 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7872 | if (context) |
| 7873 | { |
| 7874 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7875 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7876 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7877 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7878 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7879 | |
| 7880 | if (sampler != 0 && !context->isSampler(sampler)) |
| 7881 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7882 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7883 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7884 | } |
| 7885 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7886 | if (unit >= context->getCaps().maxCombinedTextureImageUnits) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7887 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7888 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7889 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7890 | } |
| 7891 | |
| 7892 | context->bindSampler(unit, sampler); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7893 | } |
| 7894 | } |
| 7895 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7896 | 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] | 7897 | { |
| 7898 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint param = %d)", sampler, pname, param); |
| 7899 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7900 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7901 | if (context) |
| 7902 | { |
| 7903 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7904 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7905 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7906 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7907 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7908 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7909 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7910 | { |
| 7911 | return; |
| 7912 | } |
| 7913 | |
| 7914 | if (!gl::ValidateTexParamParameters(context, pname, param)) |
| 7915 | { |
| 7916 | return; |
| 7917 | } |
| 7918 | |
| 7919 | if (!context->isSampler(sampler)) |
| 7920 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7921 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7922 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7923 | } |
| 7924 | |
| 7925 | context->samplerParameteri(sampler, pname, param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7926 | } |
| 7927 | } |
| 7928 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7929 | 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] | 7930 | { |
Jamie Madill | f6cc8cc | 2013-07-03 12:44:15 -0400 | [diff] [blame] | 7931 | glSamplerParameteri(sampler, pname, *param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7932 | } |
| 7933 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7934 | 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] | 7935 | { |
| 7936 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat param = %g)", sampler, pname, param); |
| 7937 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7938 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7939 | if (context) |
| 7940 | { |
| 7941 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7942 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7943 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7944 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7945 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7946 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7947 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7948 | { |
| 7949 | return; |
| 7950 | } |
| 7951 | |
| 7952 | if (!gl::ValidateTexParamParameters(context, pname, static_cast<GLint>(param))) |
| 7953 | { |
| 7954 | return; |
| 7955 | } |
| 7956 | |
| 7957 | if (!context->isSampler(sampler)) |
| 7958 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7959 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7960 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7961 | } |
| 7962 | |
| 7963 | context->samplerParameterf(sampler, pname, param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7964 | } |
| 7965 | } |
| 7966 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7967 | 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] | 7968 | { |
Jamie Madill | f6cc8cc | 2013-07-03 12:44:15 -0400 | [diff] [blame] | 7969 | glSamplerParameterf(sampler, pname, *param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7970 | } |
| 7971 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 7972 | 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] | 7973 | { |
| 7974 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", sampler, pname, params); |
| 7975 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7976 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7977 | if (context) |
| 7978 | { |
| 7979 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7980 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7981 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7982 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7983 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7984 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7985 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7986 | { |
| 7987 | return; |
| 7988 | } |
| 7989 | |
| 7990 | if (!context->isSampler(sampler)) |
| 7991 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7992 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7993 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7994 | } |
| 7995 | |
| 7996 | *params = context->getSamplerParameteri(sampler, pname); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7997 | } |
| 7998 | } |
| 7999 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8000 | 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] | 8001 | { |
| 8002 | EVENT("(GLuint sample = %ur, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", sampler, pname, params); |
| 8003 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8004 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8005 | if (context) |
| 8006 | { |
| 8007 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8008 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8009 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8010 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8011 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8012 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8013 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8014 | { |
| 8015 | return; |
| 8016 | } |
| 8017 | |
| 8018 | if (!context->isSampler(sampler)) |
| 8019 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8020 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8021 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8022 | } |
| 8023 | |
| 8024 | *params = context->getSamplerParameterf(sampler, pname); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8025 | } |
| 8026 | } |
| 8027 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8028 | void GL_APIENTRY glVertexAttribDivisor(GLuint index, GLuint divisor) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8029 | { |
| 8030 | EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor); |
| 8031 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8032 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8033 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8034 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8035 | if (context->getClientVersion() < 3) |
| 8036 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8037 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8038 | return; |
| 8039 | } |
| 8040 | |
| 8041 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 8042 | { |
| 8043 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8044 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8045 | } |
| 8046 | |
| 8047 | context->setVertexAttribDivisor(index, divisor); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8048 | } |
| 8049 | } |
| 8050 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8051 | void GL_APIENTRY glBindTransformFeedback(GLenum target, GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8052 | { |
| 8053 | EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id); |
| 8054 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8055 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8056 | if (context) |
| 8057 | { |
| 8058 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8059 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8060 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8061 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8062 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8063 | |
| 8064 | switch (target) |
| 8065 | { |
| 8066 | case GL_TRANSFORM_FEEDBACK: |
| 8067 | { |
| 8068 | // Cannot bind a transform feedback object if the current one is started and not paused (3.0.2 pg 85 section 2.14.1) |
| 8069 | gl::TransformFeedback *curTransformFeedback = context->getState().getCurrentTransformFeedback(); |
| 8070 | if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused()) |
| 8071 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8072 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8073 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8074 | } |
| 8075 | |
| 8076 | // Cannot bind a transform feedback object that does not exist (3.0.2 pg 85 section 2.14.1) |
| 8077 | if (context->getTransformFeedback(id) == NULL) |
| 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 | context->bindTransformFeedback(id); |
| 8084 | } |
| 8085 | break; |
| 8086 | |
| 8087 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8088 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8089 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8090 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8091 | } |
| 8092 | } |
| 8093 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8094 | 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] | 8095 | { |
| 8096 | EVENT("(GLsizei n = %d, const GLuint* ids = 0x%0.8p)", n, ids); |
| 8097 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8098 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8099 | if (context) |
| 8100 | { |
| 8101 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8102 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8103 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8104 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8105 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8106 | |
| 8107 | for (int i = 0; i < n; i++) |
| 8108 | { |
| 8109 | context->deleteTransformFeedback(ids[i]); |
| 8110 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8111 | } |
| 8112 | } |
| 8113 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8114 | void GL_APIENTRY glGenTransformFeedbacks(GLsizei n, GLuint* ids) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8115 | { |
| 8116 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 8117 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8118 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8119 | if (context) |
| 8120 | { |
| 8121 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8122 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8123 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8124 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8125 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8126 | |
| 8127 | for (int i = 0; i < n; i++) |
| 8128 | { |
| 8129 | ids[i] = context->createTransformFeedback(); |
| 8130 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8131 | } |
| 8132 | } |
| 8133 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8134 | GLboolean GL_APIENTRY glIsTransformFeedback(GLuint id) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8135 | { |
| 8136 | EVENT("(GLuint id = %u)", id); |
| 8137 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8138 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8139 | if (context) |
| 8140 | { |
| 8141 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8142 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8143 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8144 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8145 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8146 | |
| 8147 | 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] | 8148 | } |
| 8149 | |
| 8150 | return GL_FALSE; |
| 8151 | } |
| 8152 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8153 | void GL_APIENTRY glPauseTransformFeedback(void) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8154 | { |
| 8155 | EVENT("(void)"); |
| 8156 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8157 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8158 | if (context) |
| 8159 | { |
| 8160 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8161 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8162 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8163 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8164 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8165 | |
| 8166 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 8167 | ASSERT(transformFeedback != NULL); |
| 8168 | |
| 8169 | // Current transform feedback must be started and not paused in order to pause (3.0.2 pg 86) |
| 8170 | if (!transformFeedback->isStarted() || transformFeedback->isPaused()) |
| 8171 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8172 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8173 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8174 | } |
| 8175 | |
| 8176 | transformFeedback->pause(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8177 | } |
| 8178 | } |
| 8179 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8180 | void GL_APIENTRY glResumeTransformFeedback(void) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8181 | { |
| 8182 | EVENT("(void)"); |
| 8183 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8184 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8185 | if (context) |
| 8186 | { |
| 8187 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8188 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8189 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8190 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8191 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8192 | |
| 8193 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 8194 | ASSERT(transformFeedback != NULL); |
| 8195 | |
| 8196 | // Current transform feedback must be started and paused in order to resume (3.0.2 pg 86) |
| 8197 | if (!transformFeedback->isStarted() || !transformFeedback->isPaused()) |
| 8198 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8199 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8200 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8201 | } |
| 8202 | |
| 8203 | transformFeedback->resume(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8204 | } |
| 8205 | } |
| 8206 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8207 | 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] | 8208 | { |
| 8209 | EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLenum* binaryFormat = 0x%0.8p, GLvoid* binary = 0x%0.8p)", |
| 8210 | program, bufSize, length, binaryFormat, binary); |
| 8211 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8212 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8213 | if (context) |
| 8214 | { |
| 8215 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8216 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8217 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8218 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8219 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8220 | |
| 8221 | // glGetProgramBinary |
| 8222 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8223 | } |
| 8224 | } |
| 8225 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8226 | 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] | 8227 | { |
| 8228 | EVENT("(GLuint program = %u, GLenum binaryFormat = 0x%X, const GLvoid* binary = 0x%0.8p, GLsizei length = %d)", |
| 8229 | program, binaryFormat, binary, length); |
| 8230 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8231 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8232 | if (context) |
| 8233 | { |
| 8234 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8235 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8236 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8237 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8238 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8239 | |
| 8240 | // glProgramBinary |
| 8241 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8242 | } |
| 8243 | } |
| 8244 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8245 | 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] | 8246 | { |
| 8247 | EVENT("(GLuint program = %u, GLenum pname = 0x%X, GLint value = %d)", |
| 8248 | program, pname, value); |
| 8249 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8250 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8251 | if (context) |
| 8252 | { |
| 8253 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8254 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8255 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8256 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8257 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8258 | |
| 8259 | // glProgramParameteri |
| 8260 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8261 | } |
| 8262 | } |
| 8263 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8264 | 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] | 8265 | { |
| 8266 | EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p)", |
| 8267 | target, numAttachments, attachments); |
| 8268 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8269 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8270 | if (context) |
| 8271 | { |
| 8272 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8273 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8274 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8275 | return; |
shannonwoods@chromium.org | d63ef89 | 2013-05-30 00:10:56 +0000 | [diff] [blame] | 8276 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8277 | |
| 8278 | if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments)) |
| 8279 | { |
| 8280 | return; |
| 8281 | } |
| 8282 | |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8283 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 8284 | if (framebuffer && framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE) |
| 8285 | { |
Geoff Lang | 64f23f6 | 2014-09-10 14:40:12 -0400 | [diff] [blame] | 8286 | gl::Error error = framebuffer->invalidate(context->getCaps(), numAttachments, attachments); |
| 8287 | if (error.isError()) |
| 8288 | { |
| 8289 | context->recordError(error); |
| 8290 | return; |
| 8291 | } |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8292 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8293 | } |
| 8294 | } |
| 8295 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8296 | 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] | 8297 | { |
| 8298 | EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p, GLint x = %d, " |
| 8299 | "GLint y = %d, GLsizei width = %d, GLsizei height = %d)", |
| 8300 | target, numAttachments, attachments, x, y, width, height); |
| 8301 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8302 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8303 | if (context) |
| 8304 | { |
| 8305 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8306 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8307 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8308 | return; |
shannonwoods@chromium.org | d63ef89 | 2013-05-30 00:10:56 +0000 | [diff] [blame] | 8309 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8310 | |
| 8311 | if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments)) |
| 8312 | { |
| 8313 | return; |
| 8314 | } |
| 8315 | |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8316 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 8317 | if (framebuffer && framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE) |
| 8318 | { |
Geoff Lang | 64f23f6 | 2014-09-10 14:40:12 -0400 | [diff] [blame] | 8319 | gl::Error error = framebuffer->invalidateSub(numAttachments, attachments, x, y, width, height); |
| 8320 | if (error.isError()) |
| 8321 | { |
| 8322 | context->recordError(error); |
| 8323 | return; |
| 8324 | } |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8325 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8326 | } |
| 8327 | } |
| 8328 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8329 | 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] | 8330 | { |
| 8331 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 8332 | target, levels, internalformat, width, height); |
| 8333 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8334 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8335 | if (context) |
| 8336 | { |
| 8337 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8338 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8339 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8340 | return; |
shannonwoods@chromium.org | 8757c06 | 2013-05-30 00:14:24 +0000 | [diff] [blame] | 8341 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8342 | |
| 8343 | if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1)) |
| 8344 | { |
| 8345 | return; |
| 8346 | } |
| 8347 | |
| 8348 | switch (target) |
| 8349 | { |
| 8350 | case GL_TEXTURE_2D: |
| 8351 | { |
| 8352 | gl::Texture2D *texture2d = context->getTexture2D(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8353 | gl::Error error = texture2d->storage(levels, internalformat, width, height); |
| 8354 | if (error.isError()) |
| 8355 | { |
| 8356 | context->recordError(error); |
| 8357 | return; |
| 8358 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8359 | } |
| 8360 | break; |
| 8361 | |
| 8362 | case GL_TEXTURE_CUBE_MAP: |
| 8363 | { |
| 8364 | gl::TextureCubeMap *textureCube = context->getTextureCubeMap(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8365 | gl::Error error = textureCube->storage(levels, internalformat, width); |
| 8366 | if (error.isError()) |
| 8367 | { |
| 8368 | context->recordError(error); |
| 8369 | return; |
| 8370 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8371 | } |
| 8372 | break; |
| 8373 | |
| 8374 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8375 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8376 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8377 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8378 | } |
| 8379 | } |
| 8380 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8381 | 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] | 8382 | { |
| 8383 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " |
| 8384 | "GLsizei height = %d, GLsizei depth = %d)", |
| 8385 | target, levels, internalformat, width, height, depth); |
| 8386 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8387 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8388 | if (context) |
| 8389 | { |
| 8390 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8391 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8392 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8393 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 14eb55e | 2013-04-13 03:35:06 +0000 | [diff] [blame] | 8394 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8395 | |
| 8396 | if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, depth)) |
| 8397 | { |
| 8398 | return; |
| 8399 | } |
| 8400 | |
| 8401 | switch (target) |
| 8402 | { |
| 8403 | case GL_TEXTURE_3D: |
| 8404 | { |
| 8405 | gl::Texture3D *texture3d = context->getTexture3D(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8406 | gl::Error error = texture3d->storage(levels, internalformat, width, height, depth); |
| 8407 | if (error.isError()) |
| 8408 | { |
| 8409 | context->recordError(error); |
| 8410 | return; |
| 8411 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8412 | } |
| 8413 | break; |
| 8414 | |
| 8415 | case GL_TEXTURE_2D_ARRAY: |
| 8416 | { |
| 8417 | gl::Texture2DArray *texture2darray = context->getTexture2DArray(); |
Geoff Lang | 1f8532b | 2014-09-05 09:46:13 -0400 | [diff] [blame] | 8418 | gl::Error error = texture2darray->storage(levels, internalformat, width, height, depth); |
| 8419 | if (error.isError()) |
| 8420 | { |
| 8421 | context->recordError(error); |
| 8422 | return; |
| 8423 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8424 | } |
| 8425 | break; |
| 8426 | |
| 8427 | default: |
| 8428 | UNREACHABLE(); |
| 8429 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8430 | } |
| 8431 | } |
| 8432 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8433 | 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] | 8434 | { |
| 8435 | EVENT("(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, " |
| 8436 | "GLint* params = 0x%0.8p)", |
| 8437 | target, internalformat, pname, bufSize, params); |
| 8438 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8439 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8440 | if (context) |
| 8441 | { |
| 8442 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8443 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8444 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8445 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8446 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8447 | |
| 8448 | const gl::TextureCaps &formatCaps = context->getTextureCaps().get(internalformat); |
| 8449 | if (!formatCaps.renderable) |
| 8450 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8451 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8452 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8453 | } |
| 8454 | |
| 8455 | if (target != GL_RENDERBUFFER) |
| 8456 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8457 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8458 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8459 | } |
| 8460 | |
| 8461 | if (bufSize < 0) |
| 8462 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8463 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8464 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8465 | } |
| 8466 | |
| 8467 | switch (pname) |
| 8468 | { |
| 8469 | case GL_NUM_SAMPLE_COUNTS: |
| 8470 | if (bufSize != 0) |
Geoff Lang | 5f4c463 | 2014-07-03 13:46:52 -0400 | [diff] [blame] | 8471 | { |
| 8472 | *params = formatCaps.sampleCounts.size(); |
| 8473 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8474 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8475 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8476 | case GL_SAMPLES: |
Geoff Lang | 5f4c463 | 2014-07-03 13:46:52 -0400 | [diff] [blame] | 8477 | 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] | 8478 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8479 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8480 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8481 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8482 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8483 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8484 | } |
| 8485 | } |
| 8486 | |
| 8487 | // Extension functions |
| 8488 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8489 | 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] | 8490 | GLbitfield mask, GLenum filter) |
| 8491 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 8492 | 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] | 8493 | "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, " |
| 8494 | "GLbitfield mask = 0x%X, GLenum filter = 0x%X)", |
| 8495 | srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 8496 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8497 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8498 | if (context) |
| 8499 | { |
| 8500 | if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, |
| 8501 | dstX0, dstY0, dstX1, dstY1, mask, filter, |
| 8502 | true)) |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8503 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8504 | return; |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8505 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8506 | |
Geoff Lang | 6483915 | 2014-08-26 16:23:25 -0400 | [diff] [blame] | 8507 | gl::Error error = context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, |
| 8508 | mask, filter); |
| 8509 | if (error.isError()) |
| 8510 | { |
| 8511 | context->recordError(error); |
| 8512 | return; |
| 8513 | } |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8514 | } |
| 8515 | } |
| 8516 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8517 | 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] | 8518 | GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8519 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 8520 | 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] | 8521 | "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] | 8522 | "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] | 8523 | target, level, internalformat, width, height, depth, border, format, type, pixels); |
| 8524 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8525 | UNIMPLEMENTED(); // FIXME |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8526 | } |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8527 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8528 | void GL_APIENTRY glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8529 | GLenum *binaryFormat, void *binary) |
| 8530 | { |
apatrick@chromium.org | 90080e3 | 2012-07-09 22:15:33 +0000 | [diff] [blame] | 8531 | 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] | 8532 | program, bufSize, length, binaryFormat, binary); |
| 8533 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8534 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8535 | if (context) |
| 8536 | { |
| 8537 | gl::Program *programObject = context->getProgram(program); |
| 8538 | |
| 8539 | if (!programObject || !programObject->isLinked()) |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8540 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8541 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8542 | return; |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8543 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8544 | |
| 8545 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 8546 | |
| 8547 | if (!programBinary) |
| 8548 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8549 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8550 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8551 | } |
| 8552 | |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 8553 | gl::Error error = programBinary->save(binaryFormat, binary, bufSize, length); |
| 8554 | if (error.isError()) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8555 | { |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 8556 | context->recordError(error); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8557 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8558 | } |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8559 | } |
| 8560 | } |
| 8561 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8562 | void GL_APIENTRY glProgramBinaryOES(GLuint program, GLenum binaryFormat, |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8563 | const void *binary, GLint length) |
| 8564 | { |
| 8565 | EVENT("(GLenum program = 0x%X, binaryFormat = 0x%x, binary = 0x%0.8p, length = %d)", |
| 8566 | program, binaryFormat, binary, length); |
| 8567 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8568 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8569 | if (context) |
| 8570 | { |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 8571 | const std::vector<GLenum> &programBinaryFormats = context->getCaps().programBinaryFormats; |
| 8572 | if (std::find(programBinaryFormats.begin(), programBinaryFormats.end(), binaryFormat) == programBinaryFormats.end()) |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8573 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8574 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8575 | return; |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8576 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8577 | |
| 8578 | gl::Program *programObject = context->getProgram(program); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8579 | if (!programObject) |
| 8580 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8581 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8582 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8583 | } |
| 8584 | |
Geoff Lang | b543aff | 2014-09-30 14:52:54 -0400 | [diff] [blame] | 8585 | gl::Error error = context->setProgramBinary(program, binaryFormat, binary, length); |
| 8586 | if (error.isError()) |
| 8587 | { |
| 8588 | context->recordError(error); |
| 8589 | return; |
| 8590 | } |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8591 | } |
| 8592 | } |
| 8593 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8594 | 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] | 8595 | { |
| 8596 | EVENT("(GLenum n = %d, bufs = 0x%0.8p)", n, bufs); |
| 8597 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8598 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8599 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8600 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8601 | 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] | 8602 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8603 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8604 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8605 | } |
| 8606 | |
| 8607 | if (context->getState().getDrawFramebuffer()->id() == 0) |
| 8608 | { |
| 8609 | if (n != 1) |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8610 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8611 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8612 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8613 | } |
| 8614 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8615 | 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] | 8616 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8617 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8618 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 2fa73c5 | 2013-04-13 03:37:20 +0000 | [diff] [blame] | 8619 | } |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8620 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8621 | else |
| 8622 | { |
| 8623 | for (int colorAttachment = 0; colorAttachment < n; colorAttachment++) |
| 8624 | { |
| 8625 | const GLenum attachment = GL_COLOR_ATTACHMENT0_EXT + colorAttachment; |
| 8626 | if (bufs[colorAttachment] != GL_NONE && bufs[colorAttachment] != attachment) |
| 8627 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8628 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8629 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8630 | } |
| 8631 | } |
| 8632 | } |
| 8633 | |
| 8634 | gl::Framebuffer *framebuffer = context->getState().getDrawFramebuffer(); |
| 8635 | |
| 8636 | for (unsigned int colorAttachment = 0; colorAttachment < static_cast<unsigned int>(n); colorAttachment++) |
| 8637 | { |
| 8638 | framebuffer->setDrawBufferState(colorAttachment, bufs[colorAttachment]); |
| 8639 | } |
| 8640 | |
| 8641 | for (unsigned int colorAttachment = n; colorAttachment < context->getCaps().maxDrawBuffers; colorAttachment++) |
| 8642 | { |
| 8643 | framebuffer->setDrawBufferState(colorAttachment, GL_NONE); |
| 8644 | } |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8645 | } |
| 8646 | } |
| 8647 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8648 | void GL_APIENTRY glGetBufferPointervOES(GLenum target, GLenum pname, void** params) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8649 | { |
| 8650 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params); |
| 8651 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8652 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8653 | if (context) |
| 8654 | { |
| 8655 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8656 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8657 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8658 | return; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8659 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8660 | |
| 8661 | if (pname != GL_BUFFER_MAP_POINTER) |
| 8662 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8663 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8664 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8665 | } |
| 8666 | |
| 8667 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8668 | |
| 8669 | if (!buffer || !buffer->isMapped()) |
| 8670 | { |
| 8671 | *params = NULL; |
| 8672 | } |
| 8673 | else |
| 8674 | { |
| 8675 | *params = buffer->getMapPointer(); |
| 8676 | } |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8677 | } |
| 8678 | } |
| 8679 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8680 | void * GL_APIENTRY glMapBufferOES(GLenum target, GLenum access) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8681 | { |
| 8682 | EVENT("(GLenum target = 0x%X, GLbitfield access = 0x%X)", target, access); |
| 8683 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8684 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8685 | if (context) |
| 8686 | { |
| 8687 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8688 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8689 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8690 | return NULL; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8691 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8692 | |
| 8693 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8694 | |
| 8695 | if (buffer == NULL) |
| 8696 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8697 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8698 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8699 | } |
| 8700 | |
| 8701 | if (access != GL_WRITE_ONLY_OES) |
| 8702 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8703 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8704 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8705 | } |
| 8706 | |
| 8707 | if (buffer->isMapped()) |
| 8708 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8709 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8710 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8711 | } |
| 8712 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 8713 | gl::Error error = buffer->mapRange(0, buffer->getSize(), GL_MAP_WRITE_BIT); |
| 8714 | if (error.isError()) |
| 8715 | { |
| 8716 | context->recordError(error); |
| 8717 | return NULL; |
| 8718 | } |
| 8719 | |
| 8720 | return buffer->getMapPointer(); |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8721 | } |
| 8722 | |
| 8723 | return NULL; |
| 8724 | } |
| 8725 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8726 | GLboolean GL_APIENTRY glUnmapBufferOES(GLenum target) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8727 | { |
| 8728 | EVENT("(GLenum target = 0x%X)", target); |
| 8729 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8730 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8731 | if (context) |
| 8732 | { |
| 8733 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8734 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8735 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8736 | return GL_FALSE; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8737 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8738 | |
| 8739 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8740 | |
| 8741 | if (buffer == NULL || !buffer->isMapped()) |
| 8742 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8743 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8744 | return GL_FALSE; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8745 | } |
| 8746 | |
| 8747 | // TODO: detect if we had corruption. if so, throw an error and return false. |
| 8748 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 8749 | gl::Error error = buffer->unmap(); |
| 8750 | if (error.isError()) |
| 8751 | { |
| 8752 | context->recordError(error); |
| 8753 | return GL_FALSE; |
| 8754 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8755 | |
| 8756 | return GL_TRUE; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8757 | } |
| 8758 | |
| 8759 | return GL_FALSE; |
| 8760 | } |
| 8761 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8762 | void* GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8763 | { |
| 8764 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)", |
| 8765 | target, offset, length, access); |
| 8766 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8767 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8768 | if (context) |
| 8769 | { |
| 8770 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8771 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8772 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8773 | return NULL; |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8774 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8775 | |
| 8776 | if (offset < 0 || length < 0) |
| 8777 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8778 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8779 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8780 | } |
| 8781 | |
| 8782 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8783 | |
| 8784 | if (buffer == NULL) |
| 8785 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8786 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8787 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8788 | } |
| 8789 | |
| 8790 | // Check for buffer overflow |
| 8791 | size_t offsetSize = static_cast<size_t>(offset); |
| 8792 | size_t lengthSize = static_cast<size_t>(length); |
| 8793 | |
| 8794 | if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) || |
| 8795 | offsetSize + lengthSize > static_cast<size_t>(buffer->getSize())) |
| 8796 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8797 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8798 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8799 | } |
| 8800 | |
| 8801 | // Check for invalid bits in the mask |
| 8802 | GLbitfield allAccessBits = GL_MAP_READ_BIT | |
| 8803 | GL_MAP_WRITE_BIT | |
| 8804 | GL_MAP_INVALIDATE_RANGE_BIT | |
| 8805 | GL_MAP_INVALIDATE_BUFFER_BIT | |
| 8806 | GL_MAP_FLUSH_EXPLICIT_BIT | |
| 8807 | GL_MAP_UNSYNCHRONIZED_BIT; |
| 8808 | |
| 8809 | if (access & ~(allAccessBits)) |
| 8810 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8811 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8812 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8813 | } |
| 8814 | |
| 8815 | if (length == 0 || buffer->isMapped()) |
| 8816 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8817 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8818 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8819 | } |
| 8820 | |
| 8821 | // Check for invalid bit combinations |
| 8822 | if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0) |
| 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 | GLbitfield writeOnlyBits = GL_MAP_INVALIDATE_RANGE_BIT | |
| 8829 | GL_MAP_INVALIDATE_BUFFER_BIT | |
| 8830 | GL_MAP_UNSYNCHRONIZED_BIT; |
| 8831 | |
| 8832 | if ((access & GL_MAP_READ_BIT) != 0 && (access & writeOnlyBits) != 0) |
| 8833 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8834 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8835 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8836 | } |
| 8837 | |
| 8838 | if ((access & GL_MAP_WRITE_BIT) == 0 && (access & GL_MAP_FLUSH_EXPLICIT_BIT) != 0) |
| 8839 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8840 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8841 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8842 | } |
| 8843 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 8844 | gl::Error error = buffer->mapRange(offset, length, access); |
| 8845 | if (error.isError()) |
| 8846 | { |
| 8847 | context->recordError(error); |
| 8848 | return NULL; |
| 8849 | } |
| 8850 | |
| 8851 | return buffer->getMapPointer(); |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8852 | } |
| 8853 | |
| 8854 | return NULL; |
| 8855 | } |
| 8856 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8857 | void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8858 | { |
| 8859 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length); |
| 8860 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8861 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8862 | if (context) |
| 8863 | { |
| 8864 | if (offset < 0 || length < 0) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8865 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8866 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8867 | return; |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8868 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8869 | |
| 8870 | if (!gl::ValidBufferTarget(context, target)) |
| 8871 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8872 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8873 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8874 | } |
| 8875 | |
| 8876 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8877 | |
| 8878 | if (buffer == NULL) |
| 8879 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8880 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8881 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8882 | } |
| 8883 | |
| 8884 | if (!buffer->isMapped() || (buffer->getAccessFlags() & GL_MAP_FLUSH_EXPLICIT_BIT) == 0) |
| 8885 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8886 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8887 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8888 | } |
| 8889 | |
| 8890 | // Check for buffer overflow |
| 8891 | size_t offsetSize = static_cast<size_t>(offset); |
| 8892 | size_t lengthSize = static_cast<size_t>(length); |
| 8893 | |
| 8894 | if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) || |
| 8895 | offsetSize + lengthSize > static_cast<size_t>(buffer->getMapLength())) |
| 8896 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8897 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8898 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8899 | } |
| 8900 | |
| 8901 | // We do not currently support a non-trivial implementation of FlushMappedBufferRange |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8902 | } |
| 8903 | } |
| 8904 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8905 | __eglMustCastToProperFunctionPointerType EGLAPIENTRY glGetProcAddress(const char *procname) |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8906 | { |
| 8907 | struct Extension |
| 8908 | { |
| 8909 | const char *name; |
| 8910 | __eglMustCastToProperFunctionPointerType address; |
| 8911 | }; |
| 8912 | |
| 8913 | static const Extension glExtensions[] = |
| 8914 | { |
| 8915 | {"glTexImage3DOES", (__eglMustCastToProperFunctionPointerType)glTexImage3DOES}, |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 8916 | {"glBlitFramebufferANGLE", (__eglMustCastToProperFunctionPointerType)glBlitFramebufferANGLE}, |
daniel@transgaming.com | 1fe96c9 | 2011-01-14 15:08:44 +0000 | [diff] [blame] | 8917 | {"glRenderbufferStorageMultisampleANGLE", (__eglMustCastToProperFunctionPointerType)glRenderbufferStorageMultisampleANGLE}, |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 8918 | {"glDeleteFencesNV", (__eglMustCastToProperFunctionPointerType)glDeleteFencesNV}, |
| 8919 | {"glGenFencesNV", (__eglMustCastToProperFunctionPointerType)glGenFencesNV}, |
| 8920 | {"glIsFenceNV", (__eglMustCastToProperFunctionPointerType)glIsFenceNV}, |
| 8921 | {"glTestFenceNV", (__eglMustCastToProperFunctionPointerType)glTestFenceNV}, |
| 8922 | {"glGetFenceivNV", (__eglMustCastToProperFunctionPointerType)glGetFenceivNV}, |
| 8923 | {"glFinishFenceNV", (__eglMustCastToProperFunctionPointerType)glFinishFenceNV}, |
| 8924 | {"glSetFenceNV", (__eglMustCastToProperFunctionPointerType)glSetFenceNV}, |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 8925 | {"glGetTranslatedShaderSourceANGLE", (__eglMustCastToProperFunctionPointerType)glGetTranslatedShaderSourceANGLE}, |
daniel@transgaming.com | 0bd1f2f | 2011-11-11 04:19:03 +0000 | [diff] [blame] | 8926 | {"glTexStorage2DEXT", (__eglMustCastToProperFunctionPointerType)glTexStorage2DEXT}, |
daniel@transgaming.com | 709ed11 | 2011-11-12 03:18:10 +0000 | [diff] [blame] | 8927 | {"glGetGraphicsResetStatusEXT", (__eglMustCastToProperFunctionPointerType)glGetGraphicsResetStatusEXT}, |
| 8928 | {"glReadnPixelsEXT", (__eglMustCastToProperFunctionPointerType)glReadnPixelsEXT}, |
| 8929 | {"glGetnUniformfvEXT", (__eglMustCastToProperFunctionPointerType)glGetnUniformfvEXT}, |
| 8930 | {"glGetnUniformivEXT", (__eglMustCastToProperFunctionPointerType)glGetnUniformivEXT}, |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 8931 | {"glGenQueriesEXT", (__eglMustCastToProperFunctionPointerType)glGenQueriesEXT}, |
| 8932 | {"glDeleteQueriesEXT", (__eglMustCastToProperFunctionPointerType)glDeleteQueriesEXT}, |
| 8933 | {"glIsQueryEXT", (__eglMustCastToProperFunctionPointerType)glIsQueryEXT}, |
| 8934 | {"glBeginQueryEXT", (__eglMustCastToProperFunctionPointerType)glBeginQueryEXT}, |
| 8935 | {"glEndQueryEXT", (__eglMustCastToProperFunctionPointerType)glEndQueryEXT}, |
| 8936 | {"glGetQueryivEXT", (__eglMustCastToProperFunctionPointerType)glGetQueryivEXT}, |
| 8937 | {"glGetQueryObjectuivEXT", (__eglMustCastToProperFunctionPointerType)glGetQueryObjectuivEXT}, |
shannon.woods%transgaming.com@gtempaccount.com | 77d9472 | 2013-04-13 03:34:22 +0000 | [diff] [blame] | 8938 | {"glDrawBuffersEXT", (__eglMustCastToProperFunctionPointerType)glDrawBuffersEXT}, |
daniel@transgaming.com | dce02fd | 2012-01-27 15:39:51 +0000 | [diff] [blame] | 8939 | {"glVertexAttribDivisorANGLE", (__eglMustCastToProperFunctionPointerType)glVertexAttribDivisorANGLE}, |
| 8940 | {"glDrawArraysInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawArraysInstancedANGLE}, |
| 8941 | {"glDrawElementsInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawElementsInstancedANGLE}, |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8942 | {"glGetProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glGetProgramBinaryOES}, |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8943 | {"glProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glProgramBinaryOES}, |
| 8944 | {"glGetBufferPointervOES", (__eglMustCastToProperFunctionPointerType)glGetBufferPointervOES}, |
| 8945 | {"glMapBufferOES", (__eglMustCastToProperFunctionPointerType)glMapBufferOES}, |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8946 | {"glUnmapBufferOES", (__eglMustCastToProperFunctionPointerType)glUnmapBufferOES}, |
| 8947 | {"glMapBufferRangeEXT", (__eglMustCastToProperFunctionPointerType)glMapBufferRangeEXT}, |
| 8948 | {"glFlushMappedBufferRangeEXT", (__eglMustCastToProperFunctionPointerType)glFlushMappedBufferRangeEXT}, }; |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8949 | |
shannon.woods@transgaming.com | d438fd4 | 2013-02-28 23:17:45 +0000 | [diff] [blame] | 8950 | for (unsigned int ext = 0; ext < ArraySize(glExtensions); ext++) |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8951 | { |
| 8952 | if (strcmp(procname, glExtensions[ext].name) == 0) |
| 8953 | { |
| 8954 | return (__eglMustCastToProperFunctionPointerType)glExtensions[ext].address; |
| 8955 | } |
| 8956 | } |
| 8957 | |
| 8958 | return NULL; |
| 8959 | } |
| 8960 | |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 8961 | // Non-public functions used by EGL |
| 8962 | |
Kenneth Russell | 67ea190 | 2014-10-06 16:44:50 -0700 | [diff] [blame] | 8963 | bool EGLAPIENTRY glBindTexImage(egl::Surface *surface) |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8964 | { |
| 8965 | EVENT("(egl::Surface* surface = 0x%0.8p)", |
| 8966 | surface); |
| 8967 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8968 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8969 | if (context) |
| 8970 | { |
| 8971 | gl::Texture2D *textureObject = context->getTexture2D(); |
| 8972 | ASSERT(textureObject != NULL); |
| 8973 | |
| 8974 | if (textureObject->isImmutable()) |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8975 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8976 | return false; |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8977 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8978 | |
| 8979 | textureObject->bindTexImage(surface); |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8980 | } |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 8981 | |
| 8982 | return true; |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8983 | } |
| 8984 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8985 | } |