shannon.woods@transgaming.com | bdf2d80 | 2013-02-28 23:16:20 +0000 | [diff] [blame] | 1 | #include "precompiled.h" |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2 | // |
Geoff Lang | 48dcae7 | 2014-02-05 16:28:24 -0500 | [diff] [blame] | 3 | // Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4 | // Use of this source code is governed by a BSD-style license that can be |
| 5 | // found in the LICENSE file. |
| 6 | // |
| 7 | |
| 8 | // libGLESv2.cpp: Implements the exported OpenGL ES 2.0 functions. |
| 9 | |
daniel@transgaming.com | a0ce7e6 | 2011-01-25 14:47:16 +0000 | [diff] [blame] | 10 | #include "common/version.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 11 | |
| 12 | #include "libGLESv2/main.h" |
shannonwoods@chromium.org | a2ecfcc | 2013-05-30 00:11:59 +0000 | [diff] [blame] | 13 | #include "common/utilities.h" |
shannonwoods@chromium.org | 8dcfc6a | 2013-05-30 00:09:48 +0000 | [diff] [blame] | 14 | #include "libGLESv2/formatutils.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 15 | #include "libGLESv2/Buffer.h" |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 16 | #include "libGLESv2/Fence.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 17 | #include "libGLESv2/Framebuffer.h" |
shannon.woods@transgaming.com | 486d9e9 | 2013-02-28 23:15:41 +0000 | [diff] [blame] | 18 | #include "libGLESv2/Renderbuffer.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 19 | #include "libGLESv2/Program.h" |
apatrick@chromium.org | ea09f9b | 2012-06-08 00:45:32 +0000 | [diff] [blame] | 20 | #include "libGLESv2/ProgramBinary.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 21 | #include "libGLESv2/Texture.h" |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 22 | #include "libGLESv2/Query.h" |
shannon.woods@transgaming.com | 486d9e9 | 2013-02-28 23:15:41 +0000 | [diff] [blame] | 23 | #include "libGLESv2/Context.h" |
Jamie Madill | 57a8972 | 2013-07-02 11:57:03 -0400 | [diff] [blame] | 24 | #include "libGLESv2/VertexArray.h" |
Brandon Jones | 5bf9829 | 2014-06-06 17:19:38 -0700 | [diff] [blame] | 25 | #include "libGLESv2/VertexAttribute.h" |
Geoff Lang | c805845 | 2014-02-03 12:04:11 -0500 | [diff] [blame] | 26 | #include "libGLESv2/TransformFeedback.h" |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame] | 27 | #include "libGLESv2/FramebufferAttachment.h" |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 28 | |
Geoff Lang | e8ebe7f | 2013-08-05 15:03:13 -0400 | [diff] [blame] | 29 | #include "libGLESv2/validationES.h" |
| 30 | #include "libGLESv2/validationES2.h" |
| 31 | #include "libGLESv2/validationES3.h" |
Jamie Madill | 55856b1 | 2014-01-02 13:59:50 -0500 | [diff] [blame] | 32 | #include "libGLESv2/queryconversions.h" |
Jamie Madill | 478fdb2 | 2013-07-19 16:36:59 -0400 | [diff] [blame] | 33 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 34 | extern "C" |
| 35 | { |
| 36 | |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 37 | // OpenGL ES 2.0 functions |
| 38 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 39 | void __stdcall glActiveTexture(GLenum texture) |
| 40 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 41 | EVENT("(GLenum texture = 0x%X)", texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 42 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 43 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 44 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 45 | if (context) |
| 46 | { |
| 47 | if (texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + context->getMaximumCombinedTextureImageUnits() - 1) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 48 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 49 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 50 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 51 | |
| 52 | context->getState().setActiveSampler(texture - GL_TEXTURE0); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 53 | } |
| 54 | } |
| 55 | |
| 56 | void __stdcall glAttachShader(GLuint program, GLuint shader) |
| 57 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 58 | EVENT("(GLuint program = %d, GLuint shader = %d)", program, shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 59 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 60 | gl::Context *context = gl::getNonLostContext(); |
| 61 | |
| 62 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 63 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 64 | gl::Program *programObject = context->getProgram(program); |
| 65 | gl::Shader *shaderObject = context->getShader(shader); |
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 (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 68 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 69 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 70 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 71 | return gl::error(GL_INVALID_OPERATION); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 72 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 73 | else |
| 74 | { |
| 75 | return gl::error(GL_INVALID_VALUE); |
| 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 | { |
| 83 | return gl::error(GL_INVALID_OPERATION); |
| 84 | } |
| 85 | else |
| 86 | { |
| 87 | return gl::error(GL_INVALID_VALUE); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | if (!programObject->attachShader(shaderObject)) |
| 92 | { |
| 93 | return gl::error(GL_INVALID_OPERATION); |
| 94 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 95 | } |
| 96 | } |
| 97 | |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 98 | void __stdcall glBeginQueryEXT(GLenum target, GLuint id) |
| 99 | { |
| 100 | EVENT("(GLenum target = 0x%X, GLuint %d)", target, id); |
| 101 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 102 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 103 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 104 | if (context) |
| 105 | { |
| 106 | if (!ValidateBeginQuery(context, target, id)) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 107 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 108 | return; |
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 | |
| 111 | context->beginQuery(target, id); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 112 | } |
| 113 | } |
| 114 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 115 | void __stdcall glBindAttribLocation(GLuint program, GLuint index, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 116 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 117 | 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] | 118 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 119 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 120 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 121 | return gl::error(GL_INVALID_VALUE); |
| 122 | } |
| 123 | |
| 124 | gl::Context *context = gl::getNonLostContext(); |
| 125 | |
| 126 | if (context) |
| 127 | { |
| 128 | gl::Program *programObject = context->getProgram(program); |
| 129 | |
| 130 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 131 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 132 | if (context->getShader(program)) |
daniel@transgaming.com | 9807983 | 2010-04-13 03:26:29 +0000 | [diff] [blame] | 133 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 134 | return gl::error(GL_INVALID_OPERATION); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 135 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 136 | else |
| 137 | { |
| 138 | return gl::error(GL_INVALID_VALUE); |
| 139 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 140 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 141 | |
| 142 | if (strncmp(name, "gl_", 3) == 0) |
| 143 | { |
| 144 | return gl::error(GL_INVALID_OPERATION); |
| 145 | } |
| 146 | |
| 147 | programObject->bindAttributeLocation(index, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 148 | } |
| 149 | } |
| 150 | |
| 151 | void __stdcall glBindBuffer(GLenum target, GLuint buffer) |
| 152 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 153 | EVENT("(GLenum target = 0x%X, GLuint buffer = %d)", target, buffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 154 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 155 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 156 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 157 | if (context) |
| 158 | { |
| 159 | if (!gl::ValidBufferTarget(context, target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 160 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 161 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 162 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 163 | |
| 164 | switch (target) |
| 165 | { |
| 166 | case GL_ARRAY_BUFFER: |
| 167 | context->bindArrayBuffer(buffer); |
| 168 | return; |
| 169 | case GL_ELEMENT_ARRAY_BUFFER: |
| 170 | context->bindElementArrayBuffer(buffer); |
| 171 | return; |
| 172 | case GL_COPY_READ_BUFFER: |
| 173 | context->bindCopyReadBuffer(buffer); |
| 174 | return; |
| 175 | case GL_COPY_WRITE_BUFFER: |
| 176 | context->bindCopyWriteBuffer(buffer); |
| 177 | return; |
| 178 | case GL_PIXEL_PACK_BUFFER: |
| 179 | context->bindPixelPackBuffer(buffer); |
| 180 | return; |
| 181 | case GL_PIXEL_UNPACK_BUFFER: |
| 182 | context->bindPixelUnpackBuffer(buffer); |
| 183 | return; |
| 184 | case GL_UNIFORM_BUFFER: |
| 185 | context->bindGenericUniformBuffer(buffer); |
| 186 | return; |
| 187 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 188 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 189 | return; |
| 190 | default: |
| 191 | return gl::error(GL_INVALID_ENUM); |
| 192 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 193 | } |
| 194 | } |
| 195 | |
| 196 | void __stdcall glBindFramebuffer(GLenum target, GLuint framebuffer) |
| 197 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 198 | EVENT("(GLenum target = 0x%X, GLuint framebuffer = %d)", target, framebuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 199 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 200 | if (!gl::ValidFramebufferTarget(target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 201 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 202 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 203 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 204 | |
| 205 | gl::Context *context = gl::getNonLostContext(); |
| 206 | |
| 207 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 208 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 209 | if (target == GL_READ_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER) |
| 210 | { |
| 211 | context->bindReadFramebuffer(framebuffer); |
| 212 | } |
| 213 | |
| 214 | if (target == GL_DRAW_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER) |
| 215 | { |
| 216 | context->bindDrawFramebuffer(framebuffer); |
| 217 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 218 | } |
| 219 | } |
| 220 | |
| 221 | void __stdcall glBindRenderbuffer(GLenum target, GLuint renderbuffer) |
| 222 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 223 | EVENT("(GLenum target = 0x%X, GLuint renderbuffer = %d)", target, renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 224 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 225 | if (target != GL_RENDERBUFFER) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 226 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 227 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 228 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 229 | |
| 230 | gl::Context *context = gl::getNonLostContext(); |
| 231 | |
| 232 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 233 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 234 | context->bindRenderbuffer(renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 235 | } |
| 236 | } |
| 237 | |
| 238 | void __stdcall glBindTexture(GLenum target, GLuint texture) |
| 239 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 240 | EVENT("(GLenum target = 0x%X, GLuint texture = %d)", target, texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 241 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 242 | gl::Context *context = gl::getNonLostContext(); |
| 243 | |
| 244 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 245 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 246 | gl::Texture *textureObject = context->getTexture(texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 247 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 248 | if (textureObject && textureObject->getTarget() != target && texture != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 249 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 250 | return gl::error(GL_INVALID_OPERATION); |
| 251 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 252 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 253 | switch (target) |
| 254 | { |
| 255 | case GL_TEXTURE_2D: |
| 256 | context->bindTexture2D(texture); |
| 257 | return; |
| 258 | case GL_TEXTURE_CUBE_MAP: |
| 259 | context->bindTextureCubeMap(texture); |
| 260 | return; |
| 261 | case GL_TEXTURE_3D: |
| 262 | if (context->getClientVersion() < 3) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 263 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 264 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 265 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 266 | context->bindTexture3D(texture); |
| 267 | return; |
| 268 | case GL_TEXTURE_2D_ARRAY: |
| 269 | if (context->getClientVersion() < 3) |
| 270 | { |
| 271 | return gl::error(GL_INVALID_ENUM); |
| 272 | } |
| 273 | context->bindTexture2DArray(texture); |
| 274 | return; |
| 275 | default: |
| 276 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 277 | } |
| 278 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 279 | } |
| 280 | |
| 281 | void __stdcall glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) |
| 282 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 283 | 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] | 284 | red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 285 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 286 | gl::Context* context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 287 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 288 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 289 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 290 | 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] | 291 | } |
| 292 | } |
| 293 | |
| 294 | void __stdcall glBlendEquation(GLenum mode) |
| 295 | { |
| 296 | glBlendEquationSeparate(mode, mode); |
| 297 | } |
| 298 | |
| 299 | void __stdcall glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) |
| 300 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 301 | EVENT("(GLenum modeRGB = 0x%X, GLenum modeAlpha = 0x%X)", modeRGB, modeAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 302 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 303 | gl::Context *context = gl::getNonLostContext(); |
| 304 | |
| 305 | switch (modeRGB) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 306 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 307 | case GL_FUNC_ADD: |
| 308 | case GL_FUNC_SUBTRACT: |
| 309 | case GL_FUNC_REVERSE_SUBTRACT: |
| 310 | case GL_MIN: |
| 311 | case GL_MAX: |
| 312 | break; |
shannon.woods%transgaming.com@gtempaccount.com | 00b6a0e | 2013-04-13 03:38:00 +0000 | [diff] [blame] | 313 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 314 | default: |
| 315 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 316 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 317 | |
| 318 | switch (modeAlpha) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 319 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 320 | case GL_FUNC_ADD: |
| 321 | case GL_FUNC_SUBTRACT: |
| 322 | case GL_FUNC_REVERSE_SUBTRACT: |
| 323 | case GL_MIN: |
| 324 | case GL_MAX: |
| 325 | break; |
| 326 | |
| 327 | default: |
| 328 | return gl::error(GL_INVALID_ENUM); |
| 329 | } |
| 330 | |
| 331 | if (context) |
| 332 | { |
| 333 | context->getState().setBlendEquation(modeRGB, modeAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 334 | } |
| 335 | } |
| 336 | |
| 337 | void __stdcall glBlendFunc(GLenum sfactor, GLenum dfactor) |
| 338 | { |
| 339 | glBlendFuncSeparate(sfactor, dfactor, sfactor, dfactor); |
| 340 | } |
| 341 | |
| 342 | void __stdcall glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) |
| 343 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 344 | 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] | 345 | srcRGB, dstRGB, srcAlpha, dstAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 346 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 347 | gl::Context *context = gl::getNonLostContext(); |
| 348 | |
| 349 | switch (srcRGB) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 350 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 351 | case GL_ZERO: |
| 352 | case GL_ONE: |
| 353 | case GL_SRC_COLOR: |
| 354 | case GL_ONE_MINUS_SRC_COLOR: |
| 355 | case GL_DST_COLOR: |
| 356 | case GL_ONE_MINUS_DST_COLOR: |
| 357 | case GL_SRC_ALPHA: |
| 358 | case GL_ONE_MINUS_SRC_ALPHA: |
| 359 | case GL_DST_ALPHA: |
| 360 | case GL_ONE_MINUS_DST_ALPHA: |
| 361 | case GL_CONSTANT_COLOR: |
| 362 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 363 | case GL_CONSTANT_ALPHA: |
| 364 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 365 | case GL_SRC_ALPHA_SATURATE: |
| 366 | break; |
| 367 | default: |
| 368 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 369 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 370 | |
| 371 | switch (dstRGB) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 372 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 373 | case GL_ZERO: |
| 374 | case GL_ONE: |
| 375 | case GL_SRC_COLOR: |
| 376 | case GL_ONE_MINUS_SRC_COLOR: |
| 377 | case GL_DST_COLOR: |
| 378 | case GL_ONE_MINUS_DST_COLOR: |
| 379 | case GL_SRC_ALPHA: |
| 380 | case GL_ONE_MINUS_SRC_ALPHA: |
| 381 | case GL_DST_ALPHA: |
| 382 | case GL_ONE_MINUS_DST_ALPHA: |
| 383 | case GL_CONSTANT_COLOR: |
| 384 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 385 | case GL_CONSTANT_ALPHA: |
| 386 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 387 | break; |
| 388 | |
| 389 | case GL_SRC_ALPHA_SATURATE: |
| 390 | if (!context || context->getClientVersion() < 3) |
| 391 | { |
| 392 | return gl::error(GL_INVALID_ENUM); |
| 393 | } |
| 394 | break; |
| 395 | |
| 396 | default: |
| 397 | return gl::error(GL_INVALID_ENUM); |
| 398 | } |
| 399 | |
| 400 | switch (srcAlpha) |
| 401 | { |
| 402 | case GL_ZERO: |
| 403 | case GL_ONE: |
| 404 | case GL_SRC_COLOR: |
| 405 | case GL_ONE_MINUS_SRC_COLOR: |
| 406 | case GL_DST_COLOR: |
| 407 | case GL_ONE_MINUS_DST_COLOR: |
| 408 | case GL_SRC_ALPHA: |
| 409 | case GL_ONE_MINUS_SRC_ALPHA: |
| 410 | case GL_DST_ALPHA: |
| 411 | case GL_ONE_MINUS_DST_ALPHA: |
| 412 | case GL_CONSTANT_COLOR: |
| 413 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 414 | case GL_CONSTANT_ALPHA: |
| 415 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 416 | case GL_SRC_ALPHA_SATURATE: |
| 417 | break; |
| 418 | default: |
| 419 | return gl::error(GL_INVALID_ENUM); |
| 420 | } |
| 421 | |
| 422 | switch (dstAlpha) |
| 423 | { |
| 424 | case GL_ZERO: |
| 425 | case GL_ONE: |
| 426 | case GL_SRC_COLOR: |
| 427 | case GL_ONE_MINUS_SRC_COLOR: |
| 428 | case GL_DST_COLOR: |
| 429 | case GL_ONE_MINUS_DST_COLOR: |
| 430 | case GL_SRC_ALPHA: |
| 431 | case GL_ONE_MINUS_SRC_ALPHA: |
| 432 | case GL_DST_ALPHA: |
| 433 | case GL_ONE_MINUS_DST_ALPHA: |
| 434 | case GL_CONSTANT_COLOR: |
| 435 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 436 | case GL_CONSTANT_ALPHA: |
| 437 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 438 | break; |
| 439 | |
| 440 | case GL_SRC_ALPHA_SATURATE: |
| 441 | if (!context || context->getClientVersion() < 3) |
| 442 | { |
| 443 | return gl::error(GL_INVALID_ENUM); |
| 444 | } |
| 445 | break; |
| 446 | |
| 447 | default: |
| 448 | return gl::error(GL_INVALID_ENUM); |
| 449 | } |
| 450 | |
| 451 | bool constantColorUsed = (srcRGB == GL_CONSTANT_COLOR || srcRGB == GL_ONE_MINUS_CONSTANT_COLOR || |
| 452 | dstRGB == GL_CONSTANT_COLOR || dstRGB == GL_ONE_MINUS_CONSTANT_COLOR); |
| 453 | |
| 454 | bool constantAlphaUsed = (srcRGB == GL_CONSTANT_ALPHA || srcRGB == GL_ONE_MINUS_CONSTANT_ALPHA || |
| 455 | dstRGB == GL_CONSTANT_ALPHA || dstRGB == GL_ONE_MINUS_CONSTANT_ALPHA); |
| 456 | |
| 457 | if (constantColorUsed && constantAlphaUsed) |
| 458 | { |
| 459 | ERR("Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR invalid under WebGL"); |
| 460 | return gl::error(GL_INVALID_OPERATION); |
| 461 | } |
| 462 | |
| 463 | if (context) |
| 464 | { |
| 465 | context->getState().setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 466 | } |
| 467 | } |
| 468 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 469 | void __stdcall glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 470 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 471 | 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] | 472 | target, size, data, usage); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 473 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 474 | if (size < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 475 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 476 | return gl::error(GL_INVALID_VALUE); |
| 477 | } |
| 478 | |
| 479 | gl::Context *context = gl::getNonLostContext(); |
| 480 | |
| 481 | switch (usage) |
| 482 | { |
| 483 | case GL_STREAM_DRAW: |
| 484 | case GL_STATIC_DRAW: |
| 485 | case GL_DYNAMIC_DRAW: |
| 486 | break; |
| 487 | |
| 488 | case GL_STREAM_READ: |
| 489 | case GL_STREAM_COPY: |
| 490 | case GL_STATIC_READ: |
| 491 | case GL_STATIC_COPY: |
| 492 | case GL_DYNAMIC_READ: |
| 493 | case GL_DYNAMIC_COPY: |
| 494 | if (context && context->getClientVersion() < 3) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 495 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 496 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 497 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 498 | break; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 499 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 500 | default: |
| 501 | return gl::error(GL_INVALID_ENUM); |
| 502 | } |
shannon.woods%transgaming.com@gtempaccount.com | f2db40b | 2013-04-13 03:37:09 +0000 | [diff] [blame] | 503 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 504 | if (context) |
| 505 | { |
| 506 | if (!gl::ValidBufferTarget(context, target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 507 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 508 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 509 | } |
| 510 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 511 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 512 | |
| 513 | if (!buffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 514 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 515 | return gl::error(GL_INVALID_OPERATION); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 516 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 517 | |
| 518 | buffer->bufferData(data, size, usage); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 519 | } |
| 520 | } |
| 521 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 522 | void __stdcall glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 523 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 524 | 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] | 525 | target, offset, size, data); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 526 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 527 | if (size < 0 || offset < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 528 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 529 | return gl::error(GL_INVALID_VALUE); |
| 530 | } |
| 531 | |
| 532 | if (data == NULL) |
| 533 | { |
| 534 | return; |
| 535 | } |
| 536 | |
| 537 | gl::Context *context = gl::getNonLostContext(); |
| 538 | |
| 539 | if (context) |
| 540 | { |
| 541 | if (!gl::ValidBufferTarget(context, target)) |
| 542 | { |
| 543 | return gl::error(GL_INVALID_ENUM); |
| 544 | } |
| 545 | |
| 546 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 547 | |
| 548 | if (!buffer) |
| 549 | { |
| 550 | return gl::error(GL_INVALID_OPERATION); |
| 551 | } |
| 552 | |
| 553 | if (buffer->isMapped()) |
| 554 | { |
| 555 | return gl::error(GL_INVALID_OPERATION); |
| 556 | } |
| 557 | |
| 558 | // Check for possible overflow of size + offset |
| 559 | if (!rx::IsUnsignedAdditionSafe<size_t>(size, offset)) |
| 560 | { |
| 561 | return gl::error(GL_OUT_OF_MEMORY); |
| 562 | } |
| 563 | |
| 564 | if (size + offset > buffer->getSize()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 565 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 566 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 567 | } |
| 568 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 569 | buffer->bufferSubData(data, size, offset); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 570 | } |
| 571 | } |
| 572 | |
| 573 | GLenum __stdcall glCheckFramebufferStatus(GLenum target) |
| 574 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 575 | EVENT("(GLenum target = 0x%X)", target); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 576 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 577 | if (!gl::ValidFramebufferTarget(target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 578 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 579 | return gl::error(GL_INVALID_ENUM, 0); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 580 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 581 | |
| 582 | gl::Context *context = gl::getNonLostContext(); |
| 583 | |
| 584 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 585 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 586 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 587 | ASSERT(framebuffer); |
| 588 | return framebuffer->completeness(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 589 | } |
| 590 | |
| 591 | return 0; |
| 592 | } |
| 593 | |
| 594 | void __stdcall glClear(GLbitfield mask) |
| 595 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 596 | EVENT("(GLbitfield mask = 0x%X)", mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 597 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 598 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 599 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 600 | if (context) |
| 601 | { |
| 602 | gl::Framebuffer *framebufferObject = context->getState().getDrawFramebuffer(); |
| 603 | |
| 604 | if (!framebufferObject || framebufferObject->completeness() != GL_FRAMEBUFFER_COMPLETE) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 605 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 606 | return gl::error(GL_INVALID_FRAMEBUFFER_OPERATION); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 607 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 608 | |
| 609 | if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0) |
| 610 | { |
| 611 | return gl::error(GL_INVALID_VALUE); |
| 612 | } |
| 613 | |
| 614 | context->clear(mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 615 | } |
| 616 | } |
| 617 | |
| 618 | void __stdcall glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) |
| 619 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 620 | 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] | 621 | red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 622 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 623 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 624 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 625 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 626 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 627 | context->getState().setClearColor(red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 628 | } |
| 629 | } |
| 630 | |
| 631 | void __stdcall glClearDepthf(GLclampf depth) |
| 632 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 633 | EVENT("(GLclampf depth = %f)", depth); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 634 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 635 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 636 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 637 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 638 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 639 | context->getState().setClearDepth(depth); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 640 | } |
| 641 | } |
| 642 | |
| 643 | void __stdcall glClearStencil(GLint s) |
| 644 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 645 | EVENT("(GLint s = %d)", s); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 646 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 647 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 648 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 649 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 650 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 651 | context->getState().setClearStencil(s); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 652 | } |
| 653 | } |
| 654 | |
| 655 | void __stdcall glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) |
| 656 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 657 | 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] | 658 | red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 659 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 660 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 661 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 662 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 663 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 664 | 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] | 665 | } |
| 666 | } |
| 667 | |
| 668 | void __stdcall glCompileShader(GLuint shader) |
| 669 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 670 | EVENT("(GLuint shader = %d)", shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 671 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 672 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 673 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 674 | if (context) |
| 675 | { |
| 676 | gl::Shader *shaderObject = context->getShader(shader); |
| 677 | |
| 678 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 679 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 680 | if (context->getProgram(shader)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 681 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 682 | return gl::error(GL_INVALID_OPERATION); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 683 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 684 | else |
daniel@transgaming.com | 5d752f2 | 2010-10-07 13:37:20 +0000 | [diff] [blame] | 685 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 686 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 5d752f2 | 2010-10-07 13:37:20 +0000 | [diff] [blame] | 687 | } |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 688 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 689 | |
| 690 | shaderObject->compile(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 691 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 692 | } |
| 693 | |
| 694 | void __stdcall glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, |
| 695 | GLint border, GLsizei imageSize, const GLvoid* data) |
| 696 | { |
| 697 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " |
| 698 | "GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
| 699 | target, level, internalformat, width, height, border, imageSize, data); |
| 700 | |
| 701 | gl::Context *context = gl::getNonLostContext(); |
| 702 | |
| 703 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 704 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 705 | if (context->getClientVersion() < 3 && |
| 706 | !ValidateES2TexImageParameters(context, target, level, internalformat, true, false, |
| 707 | 0, 0, width, height, border, GL_NONE, GL_NONE, data)) |
| 708 | { |
| 709 | return; |
| 710 | } |
| 711 | |
| 712 | if (context->getClientVersion() >= 3 && |
| 713 | !ValidateES3TexImageParameters(context, target, level, internalformat, true, false, |
| 714 | 0, 0, 0, width, height, 1, border, GL_NONE, GL_NONE, data)) |
| 715 | { |
| 716 | return; |
| 717 | } |
| 718 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 719 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat); |
| 720 | 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] | 721 | { |
| 722 | return gl::error(GL_INVALID_VALUE); |
| 723 | } |
| 724 | |
| 725 | switch (target) |
| 726 | { |
| 727 | case GL_TEXTURE_2D: |
| 728 | { |
| 729 | gl::Texture2D *texture = context->getTexture2D(); |
| 730 | texture->setCompressedImage(level, internalformat, width, height, imageSize, data); |
| 731 | } |
| 732 | break; |
| 733 | |
| 734 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 735 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 736 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 737 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 738 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 739 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 740 | { |
| 741 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 742 | texture->setCompressedImage(target, level, internalformat, width, height, imageSize, data); |
| 743 | } |
| 744 | break; |
| 745 | |
| 746 | default: |
| 747 | return gl::error(GL_INVALID_ENUM); |
| 748 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 749 | } |
| 750 | } |
| 751 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 752 | void __stdcall glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, |
| 753 | GLenum format, GLsizei imageSize, const GLvoid* data) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 754 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 755 | 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] | 756 | "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, " |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 757 | "GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 758 | target, level, xoffset, yoffset, width, height, format, imageSize, data); |
| 759 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 760 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 761 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 762 | if (context) |
| 763 | { |
| 764 | if (context->getClientVersion() < 3 && |
| 765 | !ValidateES2TexImageParameters(context, target, level, GL_NONE, true, true, |
| 766 | xoffset, yoffset, width, height, 0, GL_NONE, GL_NONE, data)) |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 767 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 768 | return; |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 769 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 770 | |
| 771 | if (context->getClientVersion() >= 3 && |
| 772 | !ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true, |
| 773 | xoffset, yoffset, 0, width, height, 1, 0, GL_NONE, GL_NONE, data)) |
| 774 | { |
| 775 | return; |
| 776 | } |
| 777 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 778 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format); |
| 779 | 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] | 780 | { |
| 781 | return gl::error(GL_INVALID_VALUE); |
| 782 | } |
| 783 | |
| 784 | switch (target) |
| 785 | { |
| 786 | case GL_TEXTURE_2D: |
| 787 | { |
| 788 | gl::Texture2D *texture = context->getTexture2D(); |
| 789 | texture->subImageCompressed(level, xoffset, yoffset, width, height, format, imageSize, data); |
| 790 | } |
| 791 | break; |
| 792 | |
| 793 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 794 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 795 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 796 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 797 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 798 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 799 | { |
| 800 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 801 | texture->subImageCompressed(target, level, xoffset, yoffset, width, height, format, imageSize, data); |
| 802 | } |
| 803 | break; |
| 804 | |
| 805 | default: |
| 806 | return gl::error(GL_INVALID_ENUM); |
| 807 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 808 | } |
| 809 | } |
| 810 | |
| 811 | void __stdcall glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) |
| 812 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 813 | 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] | 814 | "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] | 815 | target, level, internalformat, x, y, width, height, border); |
| 816 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 817 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 818 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 819 | if (context) |
| 820 | { |
| 821 | if (context->getClientVersion() < 3 && |
| 822 | !ValidateES2CopyTexImageParameters(context, target, level, internalformat, false, |
| 823 | 0, 0, x, y, width, height, border)) |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 824 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 825 | return; |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 826 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 827 | |
| 828 | if (context->getClientVersion() >= 3 && |
| 829 | !ValidateES3CopyTexImageParameters(context, target, level, internalformat, false, |
| 830 | 0, 0, 0, x, y, width, height, border)) |
| 831 | { |
| 832 | return; |
| 833 | } |
| 834 | |
| 835 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 836 | |
| 837 | switch (target) |
| 838 | { |
| 839 | case GL_TEXTURE_2D: |
| 840 | { |
| 841 | gl::Texture2D *texture = context->getTexture2D(); |
| 842 | texture->copyImage(level, internalformat, x, y, width, height, framebuffer); |
| 843 | } |
| 844 | break; |
| 845 | |
| 846 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 847 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 848 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 849 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 850 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 851 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 852 | { |
| 853 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 854 | texture->copyImage(target, level, internalformat, x, y, width, height, framebuffer); |
| 855 | } |
| 856 | break; |
| 857 | |
| 858 | default: |
| 859 | return gl::error(GL_INVALID_ENUM); |
| 860 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 861 | } |
| 862 | } |
| 863 | |
| 864 | void __stdcall glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
| 865 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 866 | 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] | 867 | "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] | 868 | target, level, xoffset, yoffset, x, y, width, height); |
| 869 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 870 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 871 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 872 | if (context) |
| 873 | { |
| 874 | if (context->getClientVersion() < 3 && |
| 875 | !ValidateES2CopyTexImageParameters(context, target, level, GL_NONE, true, |
| 876 | xoffset, yoffset, x, y, width, height, 0)) |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 877 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 878 | return; |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 879 | } |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 880 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 881 | if (context->getClientVersion() >= 3 && |
| 882 | !ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true, |
| 883 | xoffset, yoffset, 0, x, y, width, height, 0)) |
| 884 | { |
| 885 | return; |
| 886 | } |
| 887 | |
| 888 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 889 | |
| 890 | switch (target) |
| 891 | { |
| 892 | case GL_TEXTURE_2D: |
| 893 | { |
| 894 | gl::Texture2D *texture = context->getTexture2D(); |
| 895 | texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer); |
| 896 | } |
| 897 | break; |
| 898 | |
| 899 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 900 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 901 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 902 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 903 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 904 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 905 | { |
| 906 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 907 | texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer); |
| 908 | } |
| 909 | break; |
| 910 | |
| 911 | default: |
| 912 | return gl::error(GL_INVALID_ENUM); |
| 913 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 914 | } |
| 915 | } |
| 916 | |
| 917 | GLuint __stdcall glCreateProgram(void) |
| 918 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 919 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 920 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 921 | gl::Context *context = gl::getNonLostContext(); |
| 922 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 923 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 924 | return context->createProgram(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 925 | } |
| 926 | |
| 927 | return 0; |
| 928 | } |
| 929 | |
| 930 | GLuint __stdcall glCreateShader(GLenum type) |
| 931 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 932 | EVENT("(GLenum type = 0x%X)", type); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 933 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 934 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 935 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 936 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 937 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 938 | switch (type) |
| 939 | { |
| 940 | case GL_FRAGMENT_SHADER: |
| 941 | case GL_VERTEX_SHADER: |
| 942 | return context->createShader(type); |
| 943 | default: |
| 944 | return gl::error(GL_INVALID_ENUM, 0); |
| 945 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 946 | } |
| 947 | |
| 948 | return 0; |
| 949 | } |
| 950 | |
| 951 | void __stdcall glCullFace(GLenum mode) |
| 952 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 953 | EVENT("(GLenum mode = 0x%X)", mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 954 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 955 | switch (mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 956 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 957 | case GL_FRONT: |
| 958 | case GL_BACK: |
| 959 | case GL_FRONT_AND_BACK: |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 960 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 961 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 962 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 963 | if (context) |
| 964 | { |
| 965 | context->getState().setCullMode(mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 966 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 967 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 968 | break; |
| 969 | default: |
| 970 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 971 | } |
| 972 | } |
| 973 | |
| 974 | void __stdcall glDeleteBuffers(GLsizei n, const GLuint* buffers) |
| 975 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 976 | 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] | 977 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 978 | if (n < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 979 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 980 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 981 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 982 | |
| 983 | gl::Context *context = gl::getNonLostContext(); |
| 984 | |
| 985 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 986 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 987 | for (int i = 0; i < n; i++) |
| 988 | { |
| 989 | context->deleteBuffer(buffers[i]); |
| 990 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 991 | } |
| 992 | } |
| 993 | |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 994 | void __stdcall glDeleteFencesNV(GLsizei n, const GLuint* fences) |
| 995 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 996 | 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] | 997 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 998 | if (n < 0) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 999 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1000 | return gl::error(GL_INVALID_VALUE); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1001 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1002 | |
| 1003 | gl::Context *context = gl::getNonLostContext(); |
| 1004 | |
| 1005 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1006 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1007 | for (int i = 0; i < n; i++) |
| 1008 | { |
| 1009 | context->deleteFenceNV(fences[i]); |
| 1010 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1011 | } |
| 1012 | } |
| 1013 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1014 | void __stdcall glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) |
| 1015 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1016 | 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] | 1017 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1018 | if (n < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1019 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1020 | return gl::error(GL_INVALID_VALUE); |
| 1021 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1022 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1023 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1024 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1025 | if (context) |
| 1026 | { |
| 1027 | for (int i = 0; i < n; i++) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1028 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1029 | if (framebuffers[i] != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1030 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1031 | context->deleteFramebuffer(framebuffers[i]); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1032 | } |
| 1033 | } |
| 1034 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1035 | } |
| 1036 | |
| 1037 | void __stdcall glDeleteProgram(GLuint program) |
| 1038 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1039 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1040 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1041 | if (program == 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1042 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1043 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1044 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1045 | |
| 1046 | gl::Context *context = gl::getNonLostContext(); |
| 1047 | |
| 1048 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1049 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1050 | if (!context->getProgram(program)) |
| 1051 | { |
| 1052 | if(context->getShader(program)) |
| 1053 | { |
| 1054 | return gl::error(GL_INVALID_OPERATION); |
| 1055 | } |
| 1056 | else |
| 1057 | { |
| 1058 | return gl::error(GL_INVALID_VALUE); |
| 1059 | } |
| 1060 | } |
| 1061 | |
| 1062 | context->deleteProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1063 | } |
| 1064 | } |
| 1065 | |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1066 | void __stdcall glDeleteQueriesEXT(GLsizei n, const GLuint *ids) |
| 1067 | { |
| 1068 | EVENT("(GLsizei n = %d, const GLuint *ids = 0x%0.8p)", n, ids); |
| 1069 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1070 | if (n < 0) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1071 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1072 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1073 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1074 | |
| 1075 | gl::Context *context = gl::getNonLostContext(); |
| 1076 | |
| 1077 | if (context) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1078 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1079 | for (int i = 0; i < n; i++) |
| 1080 | { |
| 1081 | context->deleteQuery(ids[i]); |
| 1082 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1083 | } |
| 1084 | } |
| 1085 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1086 | void __stdcall glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) |
| 1087 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1088 | 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] | 1089 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1090 | if (n < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1091 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1092 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1093 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1094 | |
| 1095 | gl::Context *context = gl::getNonLostContext(); |
| 1096 | |
| 1097 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1098 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1099 | for (int i = 0; i < n; i++) |
| 1100 | { |
| 1101 | context->deleteRenderbuffer(renderbuffers[i]); |
| 1102 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1103 | } |
| 1104 | } |
| 1105 | |
| 1106 | void __stdcall glDeleteShader(GLuint shader) |
| 1107 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1108 | EVENT("(GLuint shader = %d)", shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1109 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1110 | if (shader == 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1111 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1112 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1113 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1114 | |
| 1115 | gl::Context *context = gl::getNonLostContext(); |
| 1116 | |
| 1117 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1118 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1119 | if (!context->getShader(shader)) |
| 1120 | { |
| 1121 | if(context->getProgram(shader)) |
| 1122 | { |
| 1123 | return gl::error(GL_INVALID_OPERATION); |
| 1124 | } |
| 1125 | else |
| 1126 | { |
| 1127 | return gl::error(GL_INVALID_VALUE); |
| 1128 | } |
| 1129 | } |
| 1130 | |
| 1131 | context->deleteShader(shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1132 | } |
| 1133 | } |
| 1134 | |
| 1135 | void __stdcall glDeleteTextures(GLsizei n, const GLuint* textures) |
| 1136 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1137 | 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] | 1138 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1139 | if (n < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1140 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1141 | return gl::error(GL_INVALID_VALUE); |
| 1142 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1143 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1144 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1145 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1146 | if (context) |
| 1147 | { |
| 1148 | for (int i = 0; i < n; i++) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1149 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1150 | if (textures[i] != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1151 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1152 | context->deleteTexture(textures[i]); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1153 | } |
| 1154 | } |
| 1155 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1156 | } |
| 1157 | |
| 1158 | void __stdcall glDepthFunc(GLenum func) |
| 1159 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1160 | EVENT("(GLenum func = 0x%X)", func); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1161 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1162 | switch (func) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1163 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1164 | case GL_NEVER: |
| 1165 | case GL_ALWAYS: |
| 1166 | case GL_LESS: |
| 1167 | case GL_LEQUAL: |
| 1168 | case GL_EQUAL: |
| 1169 | case GL_GREATER: |
| 1170 | case GL_GEQUAL: |
| 1171 | case GL_NOTEQUAL: |
| 1172 | break; |
| 1173 | default: |
| 1174 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1175 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1176 | |
| 1177 | gl::Context *context = gl::getNonLostContext(); |
| 1178 | |
| 1179 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1180 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1181 | context->getState().setDepthFunc(func); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1182 | } |
| 1183 | } |
| 1184 | |
| 1185 | void __stdcall glDepthMask(GLboolean flag) |
| 1186 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 1187 | EVENT("(GLboolean flag = %u)", flag); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1188 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1189 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1190 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1191 | if (context) |
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 | context->getState().setDepthMask(flag != GL_FALSE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1194 | } |
| 1195 | } |
| 1196 | |
| 1197 | void __stdcall glDepthRangef(GLclampf zNear, GLclampf zFar) |
| 1198 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1199 | EVENT("(GLclampf zNear = %f, GLclampf zFar = %f)", zNear, zFar); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1200 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1201 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1202 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1203 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1204 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1205 | context->getState().setDepthRange(zNear, zFar); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1206 | } |
| 1207 | } |
| 1208 | |
| 1209 | void __stdcall glDetachShader(GLuint program, GLuint shader) |
| 1210 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1211 | EVENT("(GLuint program = %d, GLuint shader = %d)", program, shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1212 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1213 | gl::Context *context = gl::getNonLostContext(); |
| 1214 | |
| 1215 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1216 | { |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1217 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1218 | gl::Program *programObject = context->getProgram(program); |
| 1219 | gl::Shader *shaderObject = context->getShader(shader); |
| 1220 | |
| 1221 | if (!programObject) |
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::Shader *shaderByProgramHandle; |
| 1224 | shaderByProgramHandle = context->getShader(program); |
| 1225 | if (!shaderByProgramHandle) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1226 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1227 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 73c2c2e | 2010-04-13 03:26:11 +0000 | [diff] [blame] | 1228 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1229 | else |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1230 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 1231 | return gl::error(GL_INVALID_OPERATION); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1232 | } |
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 | |
| 1235 | if (!shaderObject) |
| 1236 | { |
| 1237 | gl::Program *programByShaderHandle = context->getProgram(shader); |
| 1238 | if (!programByShaderHandle) |
| 1239 | { |
| 1240 | return gl::error(GL_INVALID_VALUE); |
| 1241 | } |
| 1242 | else |
| 1243 | { |
| 1244 | return gl::error(GL_INVALID_OPERATION); |
| 1245 | } |
| 1246 | } |
| 1247 | |
| 1248 | if (!programObject->detachShader(shaderObject)) |
| 1249 | { |
| 1250 | return gl::error(GL_INVALID_OPERATION); |
| 1251 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1252 | } |
| 1253 | } |
| 1254 | |
| 1255 | void __stdcall glDisable(GLenum cap) |
| 1256 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1257 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1258 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1259 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1260 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1261 | if (context) |
| 1262 | { |
| 1263 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1264 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1265 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1266 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1267 | |
| 1268 | context->getState().setEnableFeature(cap, false); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1269 | } |
| 1270 | } |
| 1271 | |
| 1272 | void __stdcall glDisableVertexAttribArray(GLuint index) |
| 1273 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1274 | EVENT("(GLuint index = %d)", index); |
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 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1277 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1278 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1279 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1280 | |
| 1281 | gl::Context *context = gl::getNonLostContext(); |
| 1282 | |
| 1283 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1284 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1285 | context->getState().setEnableVertexAttribArray(index, false); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1286 | } |
| 1287 | } |
| 1288 | |
| 1289 | void __stdcall glDrawArrays(GLenum mode, GLint first, GLsizei count) |
| 1290 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1291 | 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] | 1292 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1293 | gl::Context *context = gl::getNonLostContext(); |
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 | if (context) |
| 1296 | { |
| 1297 | if (!ValidateDrawArrays(context, mode, first, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1298 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1299 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1300 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1301 | |
| 1302 | context->drawArrays(mode, first, count, 0); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1303 | } |
| 1304 | } |
| 1305 | |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1306 | void __stdcall glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount) |
| 1307 | { |
| 1308 | EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei primcount = %d)", mode, first, count, primcount); |
| 1309 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1310 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1311 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1312 | if (context) |
| 1313 | { |
| 1314 | if (!ValidateDrawArraysInstanced(context, mode, first, count, primcount)) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1315 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1316 | return; |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1317 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1318 | |
| 1319 | context->drawArrays(mode, first, count, primcount); |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1320 | } |
| 1321 | } |
| 1322 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 1323 | void __stdcall glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1324 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1325 | 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] | 1326 | mode, count, type, indices); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1327 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1328 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1329 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1330 | if (context) |
| 1331 | { |
| 1332 | if (!ValidateDrawElements(context, mode, count, type, indices)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1333 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1334 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1335 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1336 | |
| 1337 | context->drawElements(mode, count, type, indices, 0); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1338 | } |
| 1339 | } |
| 1340 | |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1341 | void __stdcall glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount) |
| 1342 | { |
| 1343 | EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei primcount = %d)", |
| 1344 | mode, count, type, indices, primcount); |
| 1345 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1346 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1347 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1348 | if (context) |
| 1349 | { |
| 1350 | if (!ValidateDrawElementsInstanced(context, mode, count, type, indices, primcount)) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1351 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1352 | return; |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1353 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1354 | |
| 1355 | context->drawElements(mode, count, type, indices, primcount); |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1356 | } |
| 1357 | } |
| 1358 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1359 | void __stdcall glEnable(GLenum cap) |
| 1360 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1361 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1362 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1363 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1364 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1365 | if (context) |
| 1366 | { |
| 1367 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1368 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1369 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1370 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1371 | |
| 1372 | context->getState().setEnableFeature(cap, true); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1373 | } |
| 1374 | } |
| 1375 | |
| 1376 | void __stdcall glEnableVertexAttribArray(GLuint index) |
| 1377 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1378 | EVENT("(GLuint index = %d)", index); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1379 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1380 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1381 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1382 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1383 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1384 | |
| 1385 | gl::Context *context = gl::getNonLostContext(); |
| 1386 | |
| 1387 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1388 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1389 | context->getState().setEnableVertexAttribArray(index, true); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1390 | } |
| 1391 | } |
| 1392 | |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1393 | void __stdcall glEndQueryEXT(GLenum target) |
| 1394 | { |
| 1395 | EVENT("GLenum target = 0x%X)", target); |
| 1396 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1397 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1398 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1399 | if (context) |
| 1400 | { |
| 1401 | if (!ValidateEndQuery(context, target)) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1402 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1403 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1404 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1405 | |
| 1406 | context->endQuery(target); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1407 | } |
| 1408 | } |
| 1409 | |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1410 | void __stdcall glFinishFenceNV(GLuint fence) |
| 1411 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1412 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1413 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1414 | gl::Context *context = gl::getNonLostContext(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1415 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1416 | if (context) |
| 1417 | { |
| 1418 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 1419 | |
| 1420 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1421 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1422 | return gl::error(GL_INVALID_OPERATION); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1423 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1424 | |
| 1425 | if (fenceObject->isFence() != GL_TRUE) |
| 1426 | { |
| 1427 | return gl::error(GL_INVALID_OPERATION); |
| 1428 | } |
| 1429 | |
| 1430 | fenceObject->finishFence(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1431 | } |
| 1432 | } |
| 1433 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1434 | void __stdcall glFinish(void) |
| 1435 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1436 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1437 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1438 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1439 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1440 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1441 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1442 | context->sync(true); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1443 | } |
| 1444 | } |
| 1445 | |
| 1446 | void __stdcall glFlush(void) |
| 1447 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1448 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1449 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1450 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1451 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1452 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1453 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1454 | context->sync(false); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1455 | } |
| 1456 | } |
| 1457 | |
| 1458 | void __stdcall glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) |
| 1459 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1460 | 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] | 1461 | "GLuint renderbuffer = %d)", target, attachment, renderbuffertarget, renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1462 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1463 | if (!gl::ValidFramebufferTarget(target) || (renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1464 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1465 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1466 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1467 | |
| 1468 | gl::Context *context = gl::getNonLostContext(); |
| 1469 | |
| 1470 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1471 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1472 | if (!gl::ValidateFramebufferRenderbufferParameters(context, target, attachment, renderbuffertarget, renderbuffer)) |
| 1473 | { |
| 1474 | return; |
| 1475 | } |
| 1476 | |
| 1477 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 1478 | ASSERT(framebuffer); |
| 1479 | |
| 1480 | if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT) |
| 1481 | { |
| 1482 | unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT); |
| 1483 | framebuffer->setColorbuffer(colorAttachment, GL_RENDERBUFFER, renderbuffer, 0, 0); |
| 1484 | } |
| 1485 | else |
| 1486 | { |
| 1487 | switch (attachment) |
| 1488 | { |
| 1489 | case GL_DEPTH_ATTACHMENT: |
| 1490 | framebuffer->setDepthbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0); |
| 1491 | break; |
| 1492 | case GL_STENCIL_ATTACHMENT: |
| 1493 | framebuffer->setStencilbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0); |
| 1494 | break; |
| 1495 | case GL_DEPTH_STENCIL_ATTACHMENT: |
| 1496 | framebuffer->setDepthStencilBuffer(GL_RENDERBUFFER, renderbuffer, 0, 0); |
| 1497 | break; |
| 1498 | default: |
| 1499 | UNREACHABLE(); |
| 1500 | break; |
| 1501 | } |
| 1502 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1503 | } |
| 1504 | } |
| 1505 | |
| 1506 | void __stdcall glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) |
| 1507 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1508 | 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] | 1509 | "GLuint texture = %d, GLint level = %d)", target, attachment, textarget, texture, level); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1510 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1511 | gl::Context *context = gl::getNonLostContext(); |
| 1512 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1513 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1514 | if (!ValidateFramebufferTexture2D(context, target, attachment, textarget, texture, level)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1515 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1516 | return; |
| 1517 | } |
shannon.woods%transgaming.com@gtempaccount.com | 89ae113 | 2013-04-13 03:28:43 +0000 | [diff] [blame] | 1518 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1519 | if (texture == 0) |
| 1520 | { |
| 1521 | textarget = GL_NONE; |
| 1522 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1523 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1524 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1525 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1526 | if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT) |
| 1527 | { |
| 1528 | const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT); |
| 1529 | framebuffer->setColorbuffer(colorAttachment, textarget, texture, level, 0); |
| 1530 | } |
| 1531 | else |
| 1532 | { |
| 1533 | switch (attachment) |
daniel@transgaming.com | fbc0953 | 2010-04-26 15:33:41 +0000 | [diff] [blame] | 1534 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1535 | case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level, 0); break; |
| 1536 | case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level, 0); break; |
| 1537 | 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] | 1538 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1539 | } |
| 1540 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1541 | } |
| 1542 | |
| 1543 | void __stdcall glFrontFace(GLenum mode) |
| 1544 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1545 | EVENT("(GLenum mode = 0x%X)", mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1546 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1547 | switch (mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1548 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1549 | case GL_CW: |
| 1550 | case GL_CCW: |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1551 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1552 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1553 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1554 | if (context) |
| 1555 | { |
| 1556 | context->getState().setFrontFace(mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1557 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1558 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1559 | break; |
| 1560 | default: |
| 1561 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1562 | } |
| 1563 | } |
| 1564 | |
| 1565 | void __stdcall glGenBuffers(GLsizei n, GLuint* buffers) |
| 1566 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1567 | EVENT("(GLsizei n = %d, GLuint* buffers = 0x%0.8p)", n, buffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1568 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1569 | if (n < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1570 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1571 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1572 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1573 | |
| 1574 | gl::Context *context = gl::getNonLostContext(); |
| 1575 | |
| 1576 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1577 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1578 | for (int i = 0; i < n; i++) |
| 1579 | { |
| 1580 | buffers[i] = context->createBuffer(); |
| 1581 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1582 | } |
| 1583 | } |
| 1584 | |
| 1585 | void __stdcall glGenerateMipmap(GLenum target) |
| 1586 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1587 | EVENT("(GLenum target = 0x%X)", target); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1588 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1589 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 8fd99e2 | 2010-04-20 18:52:00 +0000 | [diff] [blame] | 1590 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1591 | if (context) |
| 1592 | { |
| 1593 | if (!ValidTextureTarget(context, target)) |
daniel@transgaming.com | 8fd99e2 | 2010-04-20 18:52:00 +0000 | [diff] [blame] | 1594 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1595 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 8fd99e2 | 2010-04-20 18:52:00 +0000 | [diff] [blame] | 1596 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1597 | |
| 1598 | gl::Texture *texture = context->getTargetTexture(target); |
| 1599 | |
| 1600 | if (texture == NULL) |
| 1601 | { |
| 1602 | return gl::error(GL_INVALID_OPERATION); |
| 1603 | } |
| 1604 | |
| 1605 | GLenum internalFormat = texture->getBaseLevelInternalFormat(); |
| 1606 | const gl::TextureCaps &formatCaps = context->getTextureCaps().get(internalFormat); |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 1607 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1608 | |
| 1609 | // GenerateMipmap should not generate an INVALID_OPERATION for textures created with |
| 1610 | // unsized formats or that are color renderable and filterable. Since we do not track if |
| 1611 | // the texture was created with sized or unsized format (only sized formats are stored), |
| 1612 | // it is not possible to make sure the the LUMA formats can generate mipmaps (they should |
| 1613 | // be able to) because they aren't color renderable. Simply do a special case for LUMA |
| 1614 | // textures since they're the only texture format that can be created with unsized formats |
| 1615 | // that is not color renderable. New unsized formats are unlikely to be added, since ES2 |
| 1616 | // was the last version to use add them. |
| 1617 | bool isLUMA = internalFormat == GL_LUMINANCE8_EXT || |
| 1618 | internalFormat == GL_LUMINANCE8_ALPHA8_EXT || |
| 1619 | internalFormat == GL_ALPHA8_EXT; |
| 1620 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 1621 | if (formatInfo.depthBits > 0 || formatInfo.stencilBits > 0 || !formatCaps.filterable || |
| 1622 | (!formatCaps.renderable && !isLUMA) || formatInfo.compressed) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1623 | { |
| 1624 | return gl::error(GL_INVALID_OPERATION); |
| 1625 | } |
| 1626 | |
| 1627 | // GL_EXT_sRGB does not support mipmap generation on sRGB textures |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 1628 | if (context->getClientVersion() == 2 && formatInfo.colorEncoding == GL_SRGB) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1629 | { |
| 1630 | return gl::error(GL_INVALID_OPERATION); |
| 1631 | } |
| 1632 | |
| 1633 | // Non-power of 2 ES2 check |
| 1634 | if (!context->getExtensions().textureNPOT && (!gl::isPow2(texture->getBaseLevelWidth()) || !gl::isPow2(texture->getBaseLevelHeight()))) |
| 1635 | { |
| 1636 | ASSERT(context->getClientVersion() <= 2 && (target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP)); |
| 1637 | return gl::error(GL_INVALID_OPERATION); |
| 1638 | } |
| 1639 | |
| 1640 | // Cube completeness check |
| 1641 | if (target == GL_TEXTURE_CUBE_MAP) |
| 1642 | { |
| 1643 | gl::TextureCubeMap *textureCube = static_cast<gl::TextureCubeMap *>(texture); |
| 1644 | if (!textureCube->isCubeComplete()) |
| 1645 | { |
| 1646 | return gl::error(GL_INVALID_OPERATION); |
| 1647 | } |
| 1648 | } |
| 1649 | |
| 1650 | texture->generateMipmaps(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1651 | } |
| 1652 | } |
| 1653 | |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1654 | void __stdcall glGenFencesNV(GLsizei n, GLuint* fences) |
| 1655 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1656 | EVENT("(GLsizei n = %d, GLuint* fences = 0x%0.8p)", n, fences); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1657 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1658 | if (n < 0) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1659 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1660 | return gl::error(GL_INVALID_VALUE); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1661 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1662 | |
| 1663 | gl::Context *context = gl::getNonLostContext(); |
| 1664 | |
| 1665 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1666 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1667 | for (int i = 0; i < n; i++) |
| 1668 | { |
| 1669 | fences[i] = context->createFenceNV(); |
| 1670 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1671 | } |
| 1672 | } |
| 1673 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1674 | void __stdcall glGenFramebuffers(GLsizei n, GLuint* framebuffers) |
| 1675 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1676 | EVENT("(GLsizei n = %d, GLuint* framebuffers = 0x%0.8p)", n, framebuffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1677 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1678 | if (n < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1679 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1680 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1681 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1682 | |
| 1683 | gl::Context *context = gl::getNonLostContext(); |
| 1684 | |
| 1685 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1686 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1687 | for (int i = 0; i < n; i++) |
| 1688 | { |
| 1689 | framebuffers[i] = context->createFramebuffer(); |
| 1690 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1691 | } |
| 1692 | } |
| 1693 | |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1694 | void __stdcall glGenQueriesEXT(GLsizei n, GLuint* ids) |
| 1695 | { |
| 1696 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 1697 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1698 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1699 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1700 | if (context) |
| 1701 | { |
| 1702 | if (n < 0) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1703 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1704 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1705 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1706 | |
| 1707 | for (GLsizei i = 0; i < n; i++) |
| 1708 | { |
| 1709 | ids[i] = context->createQuery(); |
| 1710 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1711 | } |
| 1712 | } |
| 1713 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1714 | void __stdcall glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) |
| 1715 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1716 | EVENT("(GLsizei n = %d, GLuint* renderbuffers = 0x%0.8p)", n, renderbuffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1717 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1718 | if (n < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1719 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1720 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1721 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1722 | |
| 1723 | gl::Context *context = gl::getNonLostContext(); |
| 1724 | |
| 1725 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1726 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1727 | for (int i = 0; i < n; i++) |
| 1728 | { |
| 1729 | renderbuffers[i] = context->createRenderbuffer(); |
| 1730 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1731 | } |
| 1732 | } |
| 1733 | |
| 1734 | void __stdcall glGenTextures(GLsizei n, GLuint* textures) |
| 1735 | { |
Jamie Madill | 1fc7e2c | 2014-01-21 16:47:10 -0500 | [diff] [blame] | 1736 | EVENT("(GLsizei n = %d, GLuint* textures = 0x%0.8p)", n, textures); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1737 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1738 | if (n < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1739 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1740 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1741 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1742 | |
| 1743 | gl::Context *context = gl::getNonLostContext(); |
| 1744 | |
| 1745 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1746 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1747 | for (int i = 0; i < n; i++) |
| 1748 | { |
| 1749 | textures[i] = context->createTexture(); |
| 1750 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1751 | } |
| 1752 | } |
| 1753 | |
daniel@transgaming.com | 8542318 | 2010-04-22 13:35:27 +0000 | [diff] [blame] | 1754 | void __stdcall 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] | 1755 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1756 | 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] | 1757 | "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] | 1758 | program, index, bufsize, length, size, type, name); |
| 1759 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1760 | if (bufsize < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1761 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1762 | return gl::error(GL_INVALID_VALUE); |
| 1763 | } |
| 1764 | |
| 1765 | gl::Context *context = gl::getNonLostContext(); |
| 1766 | |
| 1767 | if (context) |
| 1768 | { |
| 1769 | gl::Program *programObject = context->getProgram(program); |
| 1770 | |
| 1771 | if (!programObject) |
| 1772 | { |
| 1773 | if (context->getShader(program)) |
| 1774 | { |
| 1775 | return gl::error(GL_INVALID_OPERATION); |
| 1776 | } |
| 1777 | else |
| 1778 | { |
| 1779 | return gl::error(GL_INVALID_VALUE); |
| 1780 | } |
| 1781 | } |
| 1782 | |
| 1783 | if (index >= (GLuint)programObject->getActiveAttributeCount()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1784 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 1785 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1786 | } |
| 1787 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1788 | programObject->getActiveAttribute(index, bufsize, length, size, type, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1789 | } |
| 1790 | } |
| 1791 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 1792 | void __stdcall 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] | 1793 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1794 | EVENT("(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, " |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 1795 | "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] | 1796 | program, index, bufsize, length, size, type, name); |
| 1797 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1798 | if (bufsize < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1799 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1800 | return gl::error(GL_INVALID_VALUE); |
| 1801 | } |
| 1802 | |
| 1803 | gl::Context *context = gl::getNonLostContext(); |
| 1804 | |
| 1805 | if (context) |
| 1806 | { |
| 1807 | gl::Program *programObject = context->getProgram(program); |
| 1808 | |
| 1809 | if (!programObject) |
| 1810 | { |
| 1811 | if (context->getShader(program)) |
| 1812 | { |
| 1813 | return gl::error(GL_INVALID_OPERATION); |
| 1814 | } |
| 1815 | else |
| 1816 | { |
| 1817 | return gl::error(GL_INVALID_VALUE); |
| 1818 | } |
| 1819 | } |
| 1820 | |
| 1821 | if (index >= (GLuint)programObject->getActiveUniformCount()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1822 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 1823 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1824 | } |
| 1825 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1826 | programObject->getActiveUniform(index, bufsize, length, size, type, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1827 | } |
| 1828 | } |
| 1829 | |
| 1830 | void __stdcall glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) |
| 1831 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1832 | 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] | 1833 | program, maxcount, count, shaders); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1834 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1835 | if (maxcount < 0) |
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 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1838 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1839 | |
| 1840 | gl::Context *context = gl::getNonLostContext(); |
| 1841 | |
| 1842 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1843 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1844 | gl::Program *programObject = context->getProgram(program); |
| 1845 | |
| 1846 | if (!programObject) |
| 1847 | { |
| 1848 | if (context->getShader(program)) |
| 1849 | { |
| 1850 | return gl::error(GL_INVALID_OPERATION); |
| 1851 | } |
| 1852 | else |
| 1853 | { |
| 1854 | return gl::error(GL_INVALID_VALUE); |
| 1855 | } |
| 1856 | } |
| 1857 | |
| 1858 | return programObject->getAttachedShaders(maxcount, count, shaders); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1859 | } |
| 1860 | } |
| 1861 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 1862 | int __stdcall glGetAttribLocation(GLuint program, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1863 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1864 | EVENT("(GLuint program = %d, const GLchar* name = %s)", program, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1865 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1866 | gl::Context *context = gl::getNonLostContext(); |
| 1867 | |
| 1868 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1869 | { |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1870 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1871 | gl::Program *programObject = context->getProgram(program); |
| 1872 | |
| 1873 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1874 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1875 | if (context->getShader(program)) |
daniel@transgaming.com | cf4aa87 | 2010-04-13 03:26:27 +0000 | [diff] [blame] | 1876 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 1877 | return gl::error(GL_INVALID_OPERATION, -1); |
daniel@transgaming.com | cf4aa87 | 2010-04-13 03:26:27 +0000 | [diff] [blame] | 1878 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1879 | else |
| 1880 | { |
| 1881 | return gl::error(GL_INVALID_VALUE, -1); |
| 1882 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1883 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1884 | |
| 1885 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 1886 | if (!programObject->isLinked() || !programBinary) |
| 1887 | { |
| 1888 | return gl::error(GL_INVALID_OPERATION, -1); |
| 1889 | } |
| 1890 | |
| 1891 | return programBinary->getAttributeLocation(name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1892 | } |
| 1893 | |
| 1894 | return -1; |
| 1895 | } |
| 1896 | |
| 1897 | void __stdcall glGetBooleanv(GLenum pname, GLboolean* params) |
| 1898 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1899 | 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] | 1900 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1901 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 777f267 | 2010-04-07 03:25:16 +0000 | [diff] [blame] | 1902 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1903 | if (context) |
| 1904 | { |
| 1905 | GLenum nativeType; |
| 1906 | unsigned int numParams = 0; |
| 1907 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1908 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1909 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1910 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1911 | |
| 1912 | if (nativeType == GL_BOOL) |
| 1913 | { |
| 1914 | context->getBooleanv(pname, params); |
| 1915 | } |
| 1916 | else |
| 1917 | { |
| 1918 | CastStateValues(context, nativeType, pname, numParams, params); |
| 1919 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1920 | } |
| 1921 | } |
| 1922 | |
| 1923 | void __stdcall glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) |
| 1924 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1925 | 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] | 1926 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1927 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | aa0ccbd | 2010-04-15 20:45:05 +0000 | [diff] [blame] | 1928 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1929 | if (context) |
| 1930 | { |
| 1931 | if (!gl::ValidBufferTarget(context, target)) |
daniel@transgaming.com | aa0ccbd | 2010-04-15 20:45:05 +0000 | [diff] [blame] | 1932 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1933 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | aa0ccbd | 2010-04-15 20:45:05 +0000 | [diff] [blame] | 1934 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1935 | |
| 1936 | if (!gl::ValidBufferParameter(context, pname)) |
| 1937 | { |
| 1938 | return gl::error(GL_INVALID_ENUM); |
| 1939 | } |
| 1940 | |
| 1941 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 1942 | |
| 1943 | if (!buffer) |
| 1944 | { |
| 1945 | // A null buffer means that "0" is bound to the requested buffer target |
| 1946 | return gl::error(GL_INVALID_OPERATION); |
| 1947 | } |
| 1948 | |
| 1949 | switch (pname) |
| 1950 | { |
| 1951 | case GL_BUFFER_USAGE: |
| 1952 | *params = static_cast<GLint>(buffer->getUsage()); |
| 1953 | break; |
| 1954 | case GL_BUFFER_SIZE: |
| 1955 | *params = gl::clampCast<GLint>(buffer->getSize()); |
| 1956 | break; |
| 1957 | case GL_BUFFER_ACCESS_FLAGS: |
| 1958 | *params = buffer->getAccessFlags(); |
| 1959 | break; |
| 1960 | case GL_BUFFER_MAPPED: |
| 1961 | *params = static_cast<GLint>(buffer->isMapped()); |
| 1962 | break; |
| 1963 | case GL_BUFFER_MAP_OFFSET: |
| 1964 | *params = gl::clampCast<GLint>(buffer->getMapOffset()); |
| 1965 | break; |
| 1966 | case GL_BUFFER_MAP_LENGTH: |
| 1967 | *params = gl::clampCast<GLint>(buffer->getMapLength()); |
| 1968 | break; |
| 1969 | default: UNREACHABLE(); break; |
| 1970 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1971 | } |
| 1972 | } |
| 1973 | |
| 1974 | GLenum __stdcall glGetError(void) |
| 1975 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1976 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1977 | |
| 1978 | gl::Context *context = gl::getContext(); |
| 1979 | |
| 1980 | if (context) |
| 1981 | { |
daniel@transgaming.com | 82b2891 | 2011-12-12 21:01:35 +0000 | [diff] [blame] | 1982 | return context->getError(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1983 | } |
| 1984 | |
| 1985 | return GL_NO_ERROR; |
| 1986 | } |
| 1987 | |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1988 | void __stdcall glGetFenceivNV(GLuint fence, GLenum pname, GLint *params) |
| 1989 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1990 | 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] | 1991 | |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1992 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1993 | gl::Context *context = gl::getNonLostContext(); |
| 1994 | |
| 1995 | if (context) |
| 1996 | { |
| 1997 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 1998 | |
| 1999 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2000 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2001 | return gl::error(GL_INVALID_OPERATION); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2002 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2003 | |
| 2004 | if (fenceObject->isFence() != GL_TRUE) |
| 2005 | { |
| 2006 | return gl::error(GL_INVALID_OPERATION); |
| 2007 | } |
| 2008 | |
| 2009 | switch (pname) |
| 2010 | { |
| 2011 | case GL_FENCE_STATUS_NV: |
| 2012 | case GL_FENCE_CONDITION_NV: |
| 2013 | break; |
| 2014 | |
| 2015 | default: return gl::error(GL_INVALID_ENUM); |
| 2016 | } |
| 2017 | |
| 2018 | params[0] = fenceObject->getFencei(pname); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2019 | } |
| 2020 | } |
| 2021 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2022 | void __stdcall glGetFloatv(GLenum pname, GLfloat* params) |
| 2023 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2024 | 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] | 2025 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2026 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 32e58cd | 2010-03-24 09:44:10 +0000 | [diff] [blame] | 2027 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2028 | if (context) |
| 2029 | { |
| 2030 | GLenum nativeType; |
| 2031 | unsigned int numParams = 0; |
| 2032 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 32e58cd | 2010-03-24 09:44:10 +0000 | [diff] [blame] | 2033 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2034 | return; |
daniel@transgaming.com | 32e58cd | 2010-03-24 09:44:10 +0000 | [diff] [blame] | 2035 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2036 | |
| 2037 | if (nativeType == GL_FLOAT) |
| 2038 | { |
| 2039 | context->getFloatv(pname, params); |
| 2040 | } |
| 2041 | else |
| 2042 | { |
| 2043 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2044 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2045 | } |
| 2046 | } |
| 2047 | |
| 2048 | void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) |
| 2049 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2050 | 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] | 2051 | target, attachment, pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2052 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2053 | gl::Context *context = gl::getNonLostContext(); |
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 | if (context) |
| 2056 | { |
| 2057 | if (!gl::ValidFramebufferTarget(target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2058 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2059 | return gl::error(GL_INVALID_ENUM); |
| 2060 | } |
| 2061 | |
| 2062 | int clientVersion = context->getClientVersion(); |
| 2063 | |
| 2064 | switch (pname) |
| 2065 | { |
| 2066 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2067 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2068 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| 2069 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| 2070 | break; |
| 2071 | case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: |
| 2072 | if (clientVersion < 3 && !context->getExtensions().sRGB) |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2073 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 2074 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2075 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2076 | break; |
| 2077 | case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: |
| 2078 | case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: |
| 2079 | case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: |
| 2080 | case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: |
| 2081 | case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: |
| 2082 | case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: |
| 2083 | case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: |
| 2084 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: |
| 2085 | if (clientVersion < 3) |
| 2086 | { |
| 2087 | return gl::error(GL_INVALID_ENUM); |
| 2088 | } |
| 2089 | break; |
| 2090 | default: |
| 2091 | return gl::error(GL_INVALID_ENUM); |
| 2092 | } |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2093 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2094 | // Determine if the attachment is a valid enum |
| 2095 | switch (attachment) |
| 2096 | { |
| 2097 | case GL_BACK: |
| 2098 | case GL_FRONT: |
| 2099 | case GL_DEPTH: |
| 2100 | case GL_STENCIL: |
| 2101 | case GL_DEPTH_STENCIL_ATTACHMENT: |
| 2102 | if (clientVersion < 3) |
| 2103 | { |
| 2104 | return gl::error(GL_INVALID_ENUM); |
| 2105 | } |
| 2106 | break; |
| 2107 | |
| 2108 | case GL_DEPTH_ATTACHMENT: |
| 2109 | case GL_STENCIL_ATTACHMENT: |
| 2110 | break; |
| 2111 | |
| 2112 | default: |
| 2113 | if (attachment < GL_COLOR_ATTACHMENT0_EXT || |
| 2114 | (attachment - GL_COLOR_ATTACHMENT0_EXT) >= context->getCaps().maxColorAttachments) |
| 2115 | { |
| 2116 | return gl::error(GL_INVALID_ENUM); |
| 2117 | } |
| 2118 | break; |
| 2119 | } |
| 2120 | |
| 2121 | GLuint framebufferHandle = context->getState().getTargetFramebuffer(target)->id(); |
| 2122 | gl::Framebuffer *framebuffer = context->getFramebuffer(framebufferHandle); |
| 2123 | |
| 2124 | if (framebufferHandle == 0) |
| 2125 | { |
| 2126 | if (clientVersion < 3) |
| 2127 | { |
| 2128 | return gl::error(GL_INVALID_OPERATION); |
| 2129 | } |
| 2130 | |
| 2131 | switch (attachment) |
| 2132 | { |
| 2133 | case GL_BACK: |
| 2134 | case GL_DEPTH: |
| 2135 | case GL_STENCIL: |
| 2136 | break; |
| 2137 | default: |
| 2138 | return gl::error(GL_INVALID_OPERATION); |
| 2139 | } |
| 2140 | } |
| 2141 | else |
| 2142 | { |
| 2143 | if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT) |
| 2144 | { |
| 2145 | // Valid attachment query |
| 2146 | } |
| 2147 | else |
| 2148 | { |
| 2149 | switch (attachment) |
| 2150 | { |
| 2151 | case GL_DEPTH_ATTACHMENT: |
| 2152 | case GL_STENCIL_ATTACHMENT: |
| 2153 | break; |
| 2154 | case GL_DEPTH_STENCIL_ATTACHMENT: |
| 2155 | if (framebuffer->hasValidDepthStencil()) |
| 2156 | { |
| 2157 | return gl::error(GL_INVALID_OPERATION); |
| 2158 | } |
| 2159 | break; |
| 2160 | default: |
| 2161 | return gl::error(GL_INVALID_OPERATION); |
| 2162 | } |
| 2163 | } |
| 2164 | } |
| 2165 | |
| 2166 | GLenum attachmentType = GL_NONE; |
| 2167 | GLuint attachmentHandle = 0; |
| 2168 | GLuint attachmentLevel = 0; |
| 2169 | GLuint attachmentLayer = 0; |
| 2170 | |
| 2171 | const gl::FramebufferAttachment *attachmentObject = framebuffer->getAttachment(attachment); |
| 2172 | |
| 2173 | if (attachmentObject) |
| 2174 | { |
| 2175 | attachmentType = attachmentObject->type(); |
| 2176 | attachmentHandle = attachmentObject->id(); |
| 2177 | attachmentLevel = attachmentObject->mipLevel(); |
| 2178 | attachmentLayer = attachmentObject->layer(); |
| 2179 | } |
| 2180 | |
| 2181 | GLenum attachmentObjectType; // Type category |
| 2182 | if (framebufferHandle == 0) |
| 2183 | { |
| 2184 | attachmentObjectType = GL_FRAMEBUFFER_DEFAULT; |
| 2185 | } |
| 2186 | else if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER) |
| 2187 | { |
| 2188 | attachmentObjectType = attachmentType; |
| 2189 | } |
| 2190 | else if (gl::ValidTexture2DDestinationTarget(context, attachmentType)) |
| 2191 | { |
| 2192 | attachmentObjectType = GL_TEXTURE; |
| 2193 | } |
| 2194 | else |
| 2195 | { |
| 2196 | UNREACHABLE(); |
| 2197 | return; |
| 2198 | } |
| 2199 | |
| 2200 | if (attachmentObjectType == GL_NONE) |
| 2201 | { |
| 2202 | // ES 2.0.25 spec pg 127 states that if the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE |
| 2203 | // is NONE, then querying any other pname will generate INVALID_ENUM. |
| 2204 | |
| 2205 | // ES 3.0.2 spec pg 235 states that if the attachment type is none, |
| 2206 | // GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero and be an |
| 2207 | // INVALID_OPERATION for all other pnames |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 2208 | |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2209 | switch (pname) |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2210 | { |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2211 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2212 | *params = attachmentObjectType; |
| 2213 | break; |
| 2214 | |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2215 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
Geoff Lang | 05b0502 | 2014-06-11 15:31:45 -0400 | [diff] [blame] | 2216 | if (clientVersion < 3) |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2217 | { |
Geoff Lang | 05b0502 | 2014-06-11 15:31:45 -0400 | [diff] [blame] | 2218 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2219 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2220 | *params = 0; |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2221 | break; |
| 2222 | |
| 2223 | default: |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 2224 | if (clientVersion < 3) |
shannon.woods%transgaming.com@gtempaccount.com | 89ae113 | 2013-04-13 03:28:43 +0000 | [diff] [blame] | 2225 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2226 | return gl::error(GL_INVALID_ENUM); |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2227 | } |
| 2228 | else |
| 2229 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2230 | gl::error(GL_INVALID_OPERATION); |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2231 | } |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2232 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2233 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2234 | else |
| 2235 | { |
| 2236 | ASSERT(attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE || |
| 2237 | attachmentObjectType == GL_FRAMEBUFFER_DEFAULT); |
| 2238 | ASSERT(attachmentObject != NULL); |
| 2239 | |
| 2240 | switch (pname) |
| 2241 | { |
| 2242 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2243 | *params = attachmentObjectType; |
| 2244 | break; |
| 2245 | |
| 2246 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2247 | if (attachmentObjectType != GL_RENDERBUFFER && attachmentObjectType != GL_TEXTURE) |
| 2248 | { |
| 2249 | return gl::error(GL_INVALID_ENUM); |
| 2250 | } |
| 2251 | *params = attachmentHandle; |
| 2252 | break; |
| 2253 | |
| 2254 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| 2255 | if (attachmentObjectType != GL_TEXTURE) |
| 2256 | { |
| 2257 | return gl::error(GL_INVALID_ENUM); |
| 2258 | } |
| 2259 | *params = attachmentLevel; |
| 2260 | break; |
| 2261 | |
| 2262 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| 2263 | if (attachmentObjectType != GL_TEXTURE) |
| 2264 | { |
| 2265 | return gl::error(GL_INVALID_ENUM); |
| 2266 | } |
| 2267 | *params = gl::IsCubemapTextureTarget(attachmentType) ? attachmentType : 0; |
| 2268 | break; |
| 2269 | |
| 2270 | case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: |
| 2271 | *params = attachmentObject->getRedSize(); |
| 2272 | break; |
| 2273 | |
| 2274 | case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: |
| 2275 | *params = attachmentObject->getGreenSize(); |
| 2276 | break; |
| 2277 | |
| 2278 | case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: |
| 2279 | *params = attachmentObject->getBlueSize(); |
| 2280 | break; |
| 2281 | |
| 2282 | case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: |
| 2283 | *params = attachmentObject->getAlphaSize(); |
| 2284 | break; |
| 2285 | |
| 2286 | case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: |
| 2287 | *params = attachmentObject->getDepthSize(); |
| 2288 | break; |
| 2289 | |
| 2290 | case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: |
| 2291 | *params = attachmentObject->getStencilSize(); |
| 2292 | break; |
| 2293 | |
| 2294 | case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: |
| 2295 | if (attachment == GL_DEPTH_STENCIL) |
| 2296 | { |
| 2297 | gl::error(GL_INVALID_OPERATION); |
| 2298 | } |
| 2299 | *params = attachmentObject->getComponentType(); |
| 2300 | break; |
| 2301 | |
| 2302 | case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: |
| 2303 | *params = attachmentObject->getColorEncoding(); |
| 2304 | break; |
| 2305 | |
| 2306 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: |
| 2307 | if (attachmentObjectType != GL_TEXTURE) |
| 2308 | { |
| 2309 | return gl::error(GL_INVALID_ENUM); |
| 2310 | } |
| 2311 | *params = attachmentLayer; |
| 2312 | break; |
| 2313 | |
| 2314 | default: |
| 2315 | UNREACHABLE(); |
| 2316 | break; |
| 2317 | } |
| 2318 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2319 | } |
| 2320 | } |
| 2321 | |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2322 | GLenum __stdcall glGetGraphicsResetStatusEXT(void) |
| 2323 | { |
| 2324 | EVENT("()"); |
| 2325 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2326 | gl::Context *context = gl::getContext(); |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2327 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2328 | if (context) |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2329 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2330 | return context->getResetStatus(); |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2331 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2332 | |
| 2333 | return GL_NO_ERROR; |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2334 | } |
| 2335 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2336 | void __stdcall glGetIntegerv(GLenum pname, GLint* params) |
| 2337 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2338 | 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] | 2339 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2340 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2341 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2342 | if (context) |
| 2343 | { |
| 2344 | GLenum nativeType; |
| 2345 | unsigned int numParams = 0; |
| 2346 | |
| 2347 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2348 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2349 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2350 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2351 | |
| 2352 | if (nativeType == GL_INT) |
| 2353 | { |
| 2354 | context->getIntegerv(pname, params); |
| 2355 | } |
| 2356 | else |
| 2357 | { |
| 2358 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2359 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2360 | } |
| 2361 | } |
| 2362 | |
| 2363 | void __stdcall glGetProgramiv(GLuint program, GLenum pname, GLint* params) |
| 2364 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2365 | 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] | 2366 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2367 | gl::Context *context = gl::getNonLostContext(); |
| 2368 | |
| 2369 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2370 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2371 | gl::Program *programObject = context->getProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2372 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2373 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2374 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2375 | return gl::error(GL_INVALID_VALUE); |
| 2376 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2377 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2378 | if (context->getClientVersion() < 3) |
| 2379 | { |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2380 | switch (pname) |
| 2381 | { |
shannonwoods@chromium.org | e684b58 | 2013-05-30 00:07:42 +0000 | [diff] [blame] | 2382 | case GL_ACTIVE_UNIFORM_BLOCKS: |
shannonwoods@chromium.org | e684b58 | 2013-05-30 00:07:42 +0000 | [diff] [blame] | 2383 | case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2384 | case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2385 | case GL_TRANSFORM_FEEDBACK_VARYINGS: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2386 | case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 2387 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2388 | } |
| 2389 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2390 | |
| 2391 | switch (pname) |
| 2392 | { |
| 2393 | case GL_DELETE_STATUS: |
| 2394 | *params = programObject->isFlaggedForDeletion(); |
| 2395 | return; |
| 2396 | case GL_LINK_STATUS: |
| 2397 | *params = programObject->isLinked(); |
| 2398 | return; |
| 2399 | case GL_VALIDATE_STATUS: |
| 2400 | *params = programObject->isValidated(); |
| 2401 | return; |
| 2402 | case GL_INFO_LOG_LENGTH: |
| 2403 | *params = programObject->getInfoLogLength(); |
| 2404 | return; |
| 2405 | case GL_ATTACHED_SHADERS: |
| 2406 | *params = programObject->getAttachedShadersCount(); |
| 2407 | return; |
| 2408 | case GL_ACTIVE_ATTRIBUTES: |
| 2409 | *params = programObject->getActiveAttributeCount(); |
| 2410 | return; |
| 2411 | case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH: |
| 2412 | *params = programObject->getActiveAttributeMaxLength(); |
| 2413 | return; |
| 2414 | case GL_ACTIVE_UNIFORMS: |
| 2415 | *params = programObject->getActiveUniformCount(); |
| 2416 | return; |
| 2417 | case GL_ACTIVE_UNIFORM_MAX_LENGTH: |
| 2418 | *params = programObject->getActiveUniformMaxLength(); |
| 2419 | return; |
| 2420 | case GL_PROGRAM_BINARY_LENGTH_OES: |
| 2421 | *params = programObject->getProgramBinaryLength(); |
| 2422 | return; |
| 2423 | case GL_ACTIVE_UNIFORM_BLOCKS: |
| 2424 | *params = programObject->getActiveUniformBlockCount(); |
| 2425 | return; |
| 2426 | case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: |
| 2427 | *params = programObject->getActiveUniformBlockMaxLength(); |
| 2428 | break; |
| 2429 | case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: |
| 2430 | *params = programObject->getTransformFeedbackBufferMode(); |
| 2431 | break; |
| 2432 | case GL_TRANSFORM_FEEDBACK_VARYINGS: |
| 2433 | *params = programObject->getTransformFeedbackVaryingCount(); |
| 2434 | break; |
| 2435 | case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: |
| 2436 | *params = programObject->getTransformFeedbackVaryingMaxLength(); |
| 2437 | break; |
| 2438 | default: |
| 2439 | return gl::error(GL_INVALID_ENUM); |
| 2440 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2441 | } |
| 2442 | } |
| 2443 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 2444 | void __stdcall glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2445 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2446 | 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] | 2447 | program, bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2448 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2449 | if (bufsize < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2450 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2451 | return gl::error(GL_INVALID_VALUE); |
| 2452 | } |
| 2453 | |
| 2454 | gl::Context *context = gl::getNonLostContext(); |
| 2455 | |
| 2456 | if (context) |
| 2457 | { |
| 2458 | gl::Program *programObject = context->getProgram(program); |
| 2459 | |
| 2460 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2461 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 2462 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2463 | } |
| 2464 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2465 | programObject->getInfoLog(bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2466 | } |
| 2467 | } |
| 2468 | |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2469 | void __stdcall glGetQueryivEXT(GLenum target, GLenum pname, GLint *params) |
| 2470 | { |
| 2471 | EVENT("GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname, params); |
| 2472 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2473 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2474 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2475 | if (context) |
| 2476 | { |
| 2477 | if (!ValidQueryType(context, target)) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2478 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2479 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2480 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2481 | |
| 2482 | switch (pname) |
| 2483 | { |
| 2484 | case GL_CURRENT_QUERY_EXT: |
| 2485 | params[0] = context->getState().getActiveQueryId(target); |
| 2486 | break; |
| 2487 | |
| 2488 | default: |
| 2489 | return gl::error(GL_INVALID_ENUM); |
| 2490 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2491 | } |
| 2492 | } |
| 2493 | |
| 2494 | void __stdcall glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params) |
| 2495 | { |
| 2496 | EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)", id, pname, params); |
| 2497 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2498 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2499 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2500 | if (context) |
| 2501 | { |
| 2502 | gl::Query *queryObject = context->getQuery(id, false, GL_NONE); |
| 2503 | |
| 2504 | if (!queryObject) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2505 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2506 | return gl::error(GL_INVALID_OPERATION); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2507 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2508 | |
| 2509 | if (context->getState().getActiveQueryId(queryObject->getType()) == id) |
| 2510 | { |
| 2511 | return gl::error(GL_INVALID_OPERATION); |
| 2512 | } |
| 2513 | |
| 2514 | switch(pname) |
| 2515 | { |
| 2516 | case GL_QUERY_RESULT_EXT: |
| 2517 | params[0] = queryObject->getResult(); |
| 2518 | break; |
| 2519 | case GL_QUERY_RESULT_AVAILABLE_EXT: |
| 2520 | params[0] = queryObject->isResultAvailable(); |
| 2521 | break; |
| 2522 | default: |
| 2523 | return gl::error(GL_INVALID_ENUM); |
| 2524 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2525 | } |
| 2526 | } |
| 2527 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2528 | void __stdcall glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) |
| 2529 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2530 | 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] | 2531 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2532 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4901fca | 2010-04-20 18:52:41 +0000 | [diff] [blame] | 2533 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2534 | if (context) |
| 2535 | { |
| 2536 | if (target != GL_RENDERBUFFER) |
daniel@transgaming.com | 4901fca | 2010-04-20 18:52:41 +0000 | [diff] [blame] | 2537 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2538 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4901fca | 2010-04-20 18:52:41 +0000 | [diff] [blame] | 2539 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2540 | |
| 2541 | if (context->getState().getRenderbufferId() == 0) |
| 2542 | { |
| 2543 | return gl::error(GL_INVALID_OPERATION); |
| 2544 | } |
| 2545 | |
| 2546 | gl::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getState().getRenderbufferId()); |
| 2547 | |
| 2548 | switch (pname) |
| 2549 | { |
| 2550 | case GL_RENDERBUFFER_WIDTH: *params = renderbuffer->getWidth(); break; |
| 2551 | case GL_RENDERBUFFER_HEIGHT: *params = renderbuffer->getHeight(); break; |
| 2552 | case GL_RENDERBUFFER_INTERNAL_FORMAT: *params = renderbuffer->getInternalFormat(); break; |
| 2553 | case GL_RENDERBUFFER_RED_SIZE: *params = renderbuffer->getRedSize(); break; |
| 2554 | case GL_RENDERBUFFER_GREEN_SIZE: *params = renderbuffer->getGreenSize(); break; |
| 2555 | case GL_RENDERBUFFER_BLUE_SIZE: *params = renderbuffer->getBlueSize(); break; |
| 2556 | case GL_RENDERBUFFER_ALPHA_SIZE: *params = renderbuffer->getAlphaSize(); break; |
| 2557 | case GL_RENDERBUFFER_DEPTH_SIZE: *params = renderbuffer->getDepthSize(); break; |
| 2558 | case GL_RENDERBUFFER_STENCIL_SIZE: *params = renderbuffer->getStencilSize(); break; |
| 2559 | case GL_RENDERBUFFER_SAMPLES_ANGLE: |
| 2560 | if (!context->getExtensions().framebufferMultisample) |
| 2561 | { |
| 2562 | return gl::error(GL_INVALID_ENUM); |
| 2563 | } |
| 2564 | *params = renderbuffer->getSamples(); |
| 2565 | break; |
| 2566 | default: |
| 2567 | return gl::error(GL_INVALID_ENUM); |
| 2568 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2569 | } |
| 2570 | } |
| 2571 | |
| 2572 | void __stdcall glGetShaderiv(GLuint shader, GLenum pname, GLint* params) |
| 2573 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2574 | 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] | 2575 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2576 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2577 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2578 | if (context) |
| 2579 | { |
| 2580 | gl::Shader *shaderObject = context->getShader(shader); |
| 2581 | |
| 2582 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2583 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2584 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2585 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2586 | |
| 2587 | switch (pname) |
| 2588 | { |
| 2589 | case GL_SHADER_TYPE: |
| 2590 | *params = shaderObject->getType(); |
| 2591 | return; |
| 2592 | case GL_DELETE_STATUS: |
| 2593 | *params = shaderObject->isFlaggedForDeletion(); |
| 2594 | return; |
| 2595 | case GL_COMPILE_STATUS: |
| 2596 | *params = shaderObject->isCompiled() ? GL_TRUE : GL_FALSE; |
| 2597 | return; |
| 2598 | case GL_INFO_LOG_LENGTH: |
| 2599 | *params = shaderObject->getInfoLogLength(); |
| 2600 | return; |
| 2601 | case GL_SHADER_SOURCE_LENGTH: |
| 2602 | *params = shaderObject->getSourceLength(); |
| 2603 | return; |
| 2604 | case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: |
| 2605 | *params = shaderObject->getTranslatedSourceLength(); |
| 2606 | return; |
| 2607 | default: |
| 2608 | return gl::error(GL_INVALID_ENUM); |
| 2609 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2610 | } |
| 2611 | } |
| 2612 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 2613 | void __stdcall glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2614 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2615 | 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] | 2616 | shader, bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2617 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2618 | if (bufsize < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2619 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2620 | return gl::error(GL_INVALID_VALUE); |
| 2621 | } |
| 2622 | |
| 2623 | gl::Context *context = gl::getNonLostContext(); |
| 2624 | |
| 2625 | if (context) |
| 2626 | { |
| 2627 | gl::Shader *shaderObject = context->getShader(shader); |
| 2628 | |
| 2629 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2630 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 2631 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2632 | } |
| 2633 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2634 | shaderObject->getInfoLog(bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2635 | } |
| 2636 | } |
| 2637 | |
| 2638 | void __stdcall glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) |
| 2639 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2640 | 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] | 2641 | shadertype, precisiontype, range, precision); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2642 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2643 | switch (shadertype) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2644 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2645 | case GL_VERTEX_SHADER: |
| 2646 | case GL_FRAGMENT_SHADER: |
| 2647 | break; |
| 2648 | default: |
| 2649 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2650 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2651 | |
| 2652 | switch (precisiontype) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2653 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2654 | case GL_LOW_FLOAT: |
| 2655 | case GL_MEDIUM_FLOAT: |
| 2656 | case GL_HIGH_FLOAT: |
| 2657 | // Assume IEEE 754 precision |
| 2658 | range[0] = 127; |
| 2659 | range[1] = 127; |
| 2660 | *precision = 23; |
| 2661 | break; |
| 2662 | case GL_LOW_INT: |
| 2663 | case GL_MEDIUM_INT: |
| 2664 | case GL_HIGH_INT: |
| 2665 | // Some (most) hardware only supports single-precision floating-point numbers, |
| 2666 | // which can accurately represent integers up to +/-16777216 |
| 2667 | range[0] = 24; |
| 2668 | range[1] = 24; |
| 2669 | *precision = 0; |
| 2670 | break; |
| 2671 | default: |
| 2672 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2673 | } |
| 2674 | } |
| 2675 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 2676 | void __stdcall glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2677 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2678 | 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] | 2679 | shader, bufsize, length, source); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2680 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2681 | if (bufsize < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2682 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2683 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2684 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2685 | |
| 2686 | gl::Context *context = gl::getNonLostContext(); |
| 2687 | |
| 2688 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2689 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2690 | gl::Shader *shaderObject = context->getShader(shader); |
| 2691 | |
| 2692 | if (!shaderObject) |
| 2693 | { |
| 2694 | return gl::error(GL_INVALID_OPERATION); |
| 2695 | } |
| 2696 | |
| 2697 | shaderObject->getSource(bufsize, length, source); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2698 | } |
| 2699 | } |
| 2700 | |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2701 | void __stdcall glGetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) |
| 2702 | { |
| 2703 | EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)", |
| 2704 | shader, bufsize, length, source); |
| 2705 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2706 | if (bufsize < 0) |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2707 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2708 | return gl::error(GL_INVALID_VALUE); |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2709 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2710 | |
| 2711 | gl::Context *context = gl::getNonLostContext(); |
| 2712 | |
| 2713 | if (context) |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2714 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2715 | gl::Shader *shaderObject = context->getShader(shader); |
| 2716 | |
| 2717 | if (!shaderObject) |
| 2718 | { |
| 2719 | return gl::error(GL_INVALID_OPERATION); |
| 2720 | } |
| 2721 | |
| 2722 | shaderObject->getTranslatedSource(bufsize, length, source); |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2723 | } |
| 2724 | } |
| 2725 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2726 | const GLubyte* __stdcall glGetString(GLenum name) |
| 2727 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2728 | EVENT("(GLenum name = 0x%X)", name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2729 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2730 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 3e4c600 | 2010-05-05 18:50:13 +0000 | [diff] [blame] | 2731 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2732 | switch (name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2733 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2734 | case GL_VENDOR: |
| 2735 | return (GLubyte*)"Google Inc."; |
| 2736 | case GL_RENDERER: |
| 2737 | return (GLubyte*)((context != NULL) ? context->getRendererString().c_str() : "ANGLE"); |
| 2738 | case GL_VERSION: |
| 2739 | if (context->getClientVersion() == 2) |
| 2740 | { |
| 2741 | return (GLubyte*)"OpenGL ES 2.0 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2742 | } |
| 2743 | else |
| 2744 | { |
| 2745 | return (GLubyte*)"OpenGL ES 3.0 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2746 | } |
| 2747 | case GL_SHADING_LANGUAGE_VERSION: |
| 2748 | if (context->getClientVersion() == 2) |
| 2749 | { |
| 2750 | return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2751 | } |
| 2752 | else |
| 2753 | { |
| 2754 | return (GLubyte*)"OpenGL ES GLSL ES 3.00 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2755 | } |
| 2756 | case GL_EXTENSIONS: |
| 2757 | return (GLubyte*)((context != NULL) ? context->getExtensionString().c_str() : ""); |
| 2758 | default: |
| 2759 | return gl::error(GL_INVALID_ENUM, (GLubyte*)NULL); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2760 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2761 | } |
| 2762 | |
| 2763 | void __stdcall glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) |
| 2764 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2765 | 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] | 2766 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2767 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 2768 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2769 | if (context) |
| 2770 | { |
| 2771 | gl::Texture *texture = context->getTargetTexture(target); |
| 2772 | |
| 2773 | if (!texture) |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 2774 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2775 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 2776 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2777 | |
| 2778 | switch (pname) |
| 2779 | { |
| 2780 | case GL_TEXTURE_MAG_FILTER: |
| 2781 | *params = (GLfloat)texture->getSamplerState().magFilter; |
| 2782 | break; |
| 2783 | case GL_TEXTURE_MIN_FILTER: |
| 2784 | *params = (GLfloat)texture->getSamplerState().minFilter; |
| 2785 | break; |
| 2786 | case GL_TEXTURE_WRAP_S: |
| 2787 | *params = (GLfloat)texture->getSamplerState().wrapS; |
| 2788 | break; |
| 2789 | case GL_TEXTURE_WRAP_T: |
| 2790 | *params = (GLfloat)texture->getSamplerState().wrapT; |
| 2791 | break; |
| 2792 | case GL_TEXTURE_WRAP_R: |
| 2793 | if (context->getClientVersion() < 3) |
| 2794 | { |
| 2795 | return gl::error(GL_INVALID_ENUM); |
| 2796 | } |
| 2797 | *params = (GLfloat)texture->getSamplerState().wrapR; |
| 2798 | break; |
| 2799 | case GL_TEXTURE_IMMUTABLE_FORMAT: |
| 2800 | // Exposed to ES2.0 through EXT_texture_storage, no client version validation. |
| 2801 | *params = (GLfloat)(texture->isImmutable() ? GL_TRUE : GL_FALSE); |
| 2802 | break; |
| 2803 | case GL_TEXTURE_IMMUTABLE_LEVELS: |
| 2804 | if (context->getClientVersion() < 3) |
| 2805 | { |
| 2806 | return gl::error(GL_INVALID_ENUM); |
| 2807 | } |
| 2808 | *params = (GLfloat)texture->immutableLevelCount(); |
| 2809 | break; |
| 2810 | case GL_TEXTURE_USAGE_ANGLE: |
| 2811 | *params = (GLfloat)texture->getUsage(); |
| 2812 | break; |
| 2813 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
| 2814 | if (!context->getExtensions().textureFilterAnisotropic) |
| 2815 | { |
| 2816 | return gl::error(GL_INVALID_ENUM); |
| 2817 | } |
| 2818 | *params = (GLfloat)texture->getSamplerState().maxAnisotropy; |
| 2819 | break; |
| 2820 | case GL_TEXTURE_SWIZZLE_R: |
| 2821 | if (context->getClientVersion() < 3) |
| 2822 | { |
| 2823 | return gl::error(GL_INVALID_ENUM); |
| 2824 | } |
| 2825 | *params = (GLfloat)texture->getSamplerState().swizzleRed; |
| 2826 | break; |
| 2827 | case GL_TEXTURE_SWIZZLE_G: |
| 2828 | if (context->getClientVersion() < 3) |
| 2829 | { |
| 2830 | return gl::error(GL_INVALID_ENUM); |
| 2831 | } |
| 2832 | *params = (GLfloat)texture->getSamplerState().swizzleGreen; |
| 2833 | break; |
| 2834 | case GL_TEXTURE_SWIZZLE_B: |
| 2835 | if (context->getClientVersion() < 3) |
| 2836 | { |
| 2837 | return gl::error(GL_INVALID_ENUM); |
| 2838 | } |
| 2839 | *params = (GLfloat)texture->getSamplerState().swizzleBlue; |
| 2840 | break; |
| 2841 | case GL_TEXTURE_SWIZZLE_A: |
| 2842 | if (context->getClientVersion() < 3) |
| 2843 | { |
| 2844 | return gl::error(GL_INVALID_ENUM); |
| 2845 | } |
| 2846 | *params = (GLfloat)texture->getSamplerState().swizzleAlpha; |
| 2847 | break; |
| 2848 | case GL_TEXTURE_BASE_LEVEL: |
| 2849 | if (context->getClientVersion() < 3) |
| 2850 | { |
| 2851 | return gl::error(GL_INVALID_ENUM); |
| 2852 | } |
| 2853 | *params = (GLfloat)texture->getSamplerState().baseLevel; |
| 2854 | break; |
| 2855 | case GL_TEXTURE_MAX_LEVEL: |
| 2856 | if (context->getClientVersion() < 3) |
| 2857 | { |
| 2858 | return gl::error(GL_INVALID_ENUM); |
| 2859 | } |
| 2860 | *params = (GLfloat)texture->getSamplerState().maxLevel; |
| 2861 | break; |
| 2862 | case GL_TEXTURE_MIN_LOD: |
| 2863 | if (context->getClientVersion() < 3) |
| 2864 | { |
| 2865 | return gl::error(GL_INVALID_ENUM); |
| 2866 | } |
| 2867 | *params = texture->getSamplerState().minLod; |
| 2868 | break; |
| 2869 | case GL_TEXTURE_MAX_LOD: |
| 2870 | if (context->getClientVersion() < 3) |
| 2871 | { |
| 2872 | return gl::error(GL_INVALID_ENUM); |
| 2873 | } |
| 2874 | *params = texture->getSamplerState().maxLod; |
| 2875 | break; |
| 2876 | default: |
| 2877 | return gl::error(GL_INVALID_ENUM); |
| 2878 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2879 | } |
| 2880 | } |
| 2881 | |
| 2882 | void __stdcall glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) |
| 2883 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2884 | 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] | 2885 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2886 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 2887 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2888 | if (context) |
| 2889 | { |
| 2890 | gl::Texture *texture = context->getTargetTexture(target); |
| 2891 | |
| 2892 | if (!texture) |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 2893 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2894 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 2895 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2896 | |
| 2897 | switch (pname) |
| 2898 | { |
| 2899 | case GL_TEXTURE_MAG_FILTER: |
| 2900 | *params = texture->getSamplerState().magFilter; |
| 2901 | break; |
| 2902 | case GL_TEXTURE_MIN_FILTER: |
| 2903 | *params = texture->getSamplerState().minFilter; |
| 2904 | break; |
| 2905 | case GL_TEXTURE_WRAP_S: |
| 2906 | *params = texture->getSamplerState().wrapS; |
| 2907 | break; |
| 2908 | case GL_TEXTURE_WRAP_T: |
| 2909 | *params = texture->getSamplerState().wrapT; |
| 2910 | break; |
| 2911 | case GL_TEXTURE_WRAP_R: |
| 2912 | if (context->getClientVersion() < 3) |
| 2913 | { |
| 2914 | return gl::error(GL_INVALID_ENUM); |
| 2915 | } |
| 2916 | *params = texture->getSamplerState().wrapR; |
| 2917 | break; |
| 2918 | case GL_TEXTURE_IMMUTABLE_FORMAT: |
| 2919 | // Exposed to ES2.0 through EXT_texture_storage, no client version validation. |
| 2920 | *params = texture->isImmutable() ? GL_TRUE : GL_FALSE; |
| 2921 | break; |
| 2922 | case GL_TEXTURE_IMMUTABLE_LEVELS: |
| 2923 | if (context->getClientVersion() < 3) |
| 2924 | { |
| 2925 | return gl::error(GL_INVALID_ENUM); |
| 2926 | } |
| 2927 | *params = texture->immutableLevelCount(); |
| 2928 | break; |
| 2929 | case GL_TEXTURE_USAGE_ANGLE: |
| 2930 | *params = texture->getUsage(); |
| 2931 | break; |
| 2932 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
| 2933 | if (!context->getExtensions().textureFilterAnisotropic) |
| 2934 | { |
| 2935 | return gl::error(GL_INVALID_ENUM); |
| 2936 | } |
| 2937 | *params = (GLint)texture->getSamplerState().maxAnisotropy; |
| 2938 | break; |
| 2939 | case GL_TEXTURE_SWIZZLE_R: |
| 2940 | if (context->getClientVersion() < 3) |
| 2941 | { |
| 2942 | return gl::error(GL_INVALID_ENUM); |
| 2943 | } |
| 2944 | *params = texture->getSamplerState().swizzleRed; |
| 2945 | break; |
| 2946 | case GL_TEXTURE_SWIZZLE_G: |
| 2947 | if (context->getClientVersion() < 3) |
| 2948 | { |
| 2949 | return gl::error(GL_INVALID_ENUM); |
| 2950 | } |
| 2951 | *params = texture->getSamplerState().swizzleGreen; |
| 2952 | break; |
| 2953 | case GL_TEXTURE_SWIZZLE_B: |
| 2954 | if (context->getClientVersion() < 3) |
| 2955 | { |
| 2956 | return gl::error(GL_INVALID_ENUM); |
| 2957 | } |
| 2958 | *params = texture->getSamplerState().swizzleBlue; |
| 2959 | break; |
| 2960 | case GL_TEXTURE_SWIZZLE_A: |
| 2961 | if (context->getClientVersion() < 3) |
| 2962 | { |
| 2963 | return gl::error(GL_INVALID_ENUM); |
| 2964 | } |
| 2965 | *params = texture->getSamplerState().swizzleAlpha; |
| 2966 | break; |
| 2967 | case GL_TEXTURE_BASE_LEVEL: |
| 2968 | if (context->getClientVersion() < 3) |
| 2969 | { |
| 2970 | return gl::error(GL_INVALID_ENUM); |
| 2971 | } |
| 2972 | *params = texture->getSamplerState().baseLevel; |
| 2973 | break; |
| 2974 | case GL_TEXTURE_MAX_LEVEL: |
| 2975 | if (context->getClientVersion() < 3) |
| 2976 | { |
| 2977 | return gl::error(GL_INVALID_ENUM); |
| 2978 | } |
| 2979 | *params = texture->getSamplerState().maxLevel; |
| 2980 | break; |
| 2981 | case GL_TEXTURE_MIN_LOD: |
| 2982 | if (context->getClientVersion() < 3) |
| 2983 | { |
| 2984 | return gl::error(GL_INVALID_ENUM); |
| 2985 | } |
| 2986 | *params = (GLint)texture->getSamplerState().minLod; |
| 2987 | break; |
| 2988 | case GL_TEXTURE_MAX_LOD: |
| 2989 | if (context->getClientVersion() < 3) |
| 2990 | { |
| 2991 | return gl::error(GL_INVALID_ENUM); |
| 2992 | } |
| 2993 | *params = (GLint)texture->getSamplerState().maxLod; |
| 2994 | break; |
| 2995 | default: |
| 2996 | return gl::error(GL_INVALID_ENUM); |
| 2997 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2998 | } |
| 2999 | } |
| 3000 | |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3001 | void __stdcall glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat* params) |
| 3002 | { |
| 3003 | EVENT("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLfloat* params = 0x%0.8p)", |
| 3004 | program, location, bufSize, params); |
| 3005 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3006 | if (bufSize < 0) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3007 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3008 | return gl::error(GL_INVALID_VALUE); |
| 3009 | } |
| 3010 | |
| 3011 | gl::Context *context = gl::getNonLostContext(); |
| 3012 | |
| 3013 | if (context) |
| 3014 | { |
| 3015 | if (program == 0) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3016 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 3017 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3018 | } |
| 3019 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3020 | gl::Program *programObject = context->getProgram(program); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3021 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3022 | if (!programObject || !programObject->isLinked()) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3023 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3024 | return gl::error(GL_INVALID_OPERATION); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3025 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3026 | |
| 3027 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 3028 | if (!programBinary) |
| 3029 | { |
| 3030 | return gl::error(GL_INVALID_OPERATION); |
| 3031 | } |
| 3032 | |
| 3033 | if (!programBinary->getUniformfv(location, &bufSize, params)) |
| 3034 | { |
| 3035 | return gl::error(GL_INVALID_OPERATION); |
| 3036 | } |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3037 | } |
| 3038 | } |
| 3039 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3040 | void __stdcall glGetUniformfv(GLuint program, GLint location, GLfloat* params) |
| 3041 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3042 | 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] | 3043 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3044 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3045 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3046 | if (context) |
| 3047 | { |
| 3048 | if (program == 0) |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3049 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3050 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3051 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3052 | |
| 3053 | gl::Program *programObject = context->getProgram(program); |
| 3054 | |
| 3055 | if (!programObject || !programObject->isLinked()) |
| 3056 | { |
| 3057 | return gl::error(GL_INVALID_OPERATION); |
| 3058 | } |
| 3059 | |
| 3060 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 3061 | if (!programBinary) |
| 3062 | { |
| 3063 | return gl::error(GL_INVALID_OPERATION); |
| 3064 | } |
| 3065 | |
| 3066 | if (!programBinary->getUniformfv(location, NULL, params)) |
| 3067 | { |
| 3068 | return gl::error(GL_INVALID_OPERATION); |
| 3069 | } |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3070 | } |
| 3071 | } |
| 3072 | |
| 3073 | void __stdcall glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint* params) |
| 3074 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3075 | 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] | 3076 | program, location, bufSize, params); |
| 3077 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3078 | if (bufSize < 0) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3079 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3080 | return gl::error(GL_INVALID_VALUE); |
| 3081 | } |
| 3082 | |
| 3083 | gl::Context *context = gl::getNonLostContext(); |
| 3084 | |
| 3085 | if (context) |
| 3086 | { |
| 3087 | if (program == 0) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3088 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 3089 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3090 | } |
| 3091 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3092 | gl::Program *programObject = context->getProgram(program); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3093 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3094 | if (!programObject || !programObject->isLinked()) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3095 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3096 | return gl::error(GL_INVALID_OPERATION); |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3097 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3098 | |
| 3099 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 3100 | if (!programBinary) |
| 3101 | { |
| 3102 | return gl::error(GL_INVALID_OPERATION); |
| 3103 | } |
| 3104 | |
| 3105 | if (!programBinary->getUniformiv(location, &bufSize, params)) |
| 3106 | { |
| 3107 | return gl::error(GL_INVALID_OPERATION); |
| 3108 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3109 | } |
| 3110 | } |
| 3111 | |
| 3112 | void __stdcall glGetUniformiv(GLuint program, GLint location, GLint* params) |
| 3113 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3114 | 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] | 3115 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3116 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3117 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3118 | if (context) |
| 3119 | { |
| 3120 | if (program == 0) |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3121 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3122 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3123 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3124 | |
| 3125 | gl::Program *programObject = context->getProgram(program); |
| 3126 | |
| 3127 | if (!programObject || !programObject->isLinked()) |
| 3128 | { |
| 3129 | return gl::error(GL_INVALID_OPERATION); |
| 3130 | } |
| 3131 | |
| 3132 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 3133 | if (!programBinary) |
| 3134 | { |
| 3135 | return gl::error(GL_INVALID_OPERATION); |
| 3136 | } |
| 3137 | |
| 3138 | if (!programBinary->getUniformiv(location, NULL, params)) |
| 3139 | { |
| 3140 | return gl::error(GL_INVALID_OPERATION); |
| 3141 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3142 | } |
| 3143 | } |
| 3144 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 3145 | int __stdcall glGetUniformLocation(GLuint program, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3146 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3147 | 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] | 3148 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3149 | gl::Context *context = gl::getNonLostContext(); |
| 3150 | |
| 3151 | if (strstr(name, "gl_") == name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3152 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3153 | return -1; |
| 3154 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3155 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3156 | if (context) |
| 3157 | { |
| 3158 | gl::Program *programObject = context->getProgram(program); |
| 3159 | |
| 3160 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3161 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3162 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3163 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 3164 | return gl::error(GL_INVALID_OPERATION, -1); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3165 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3166 | else |
| 3167 | { |
| 3168 | return gl::error(GL_INVALID_VALUE, -1); |
| 3169 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3170 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3171 | |
| 3172 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 3173 | if (!programObject->isLinked() || !programBinary) |
| 3174 | { |
| 3175 | return gl::error(GL_INVALID_OPERATION, -1); |
| 3176 | } |
| 3177 | |
| 3178 | return programBinary->getUniformLocation(name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3179 | } |
| 3180 | |
| 3181 | return -1; |
| 3182 | } |
| 3183 | |
| 3184 | void __stdcall glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) |
| 3185 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3186 | 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] | 3187 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3188 | gl::Context *context = gl::getNonLostContext(); |
| 3189 | |
| 3190 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3191 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3192 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3193 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3194 | return gl::error(GL_INVALID_VALUE); |
| 3195 | } |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3196 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3197 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
| 3198 | if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion())) |
| 3199 | { |
| 3200 | return; |
| 3201 | } |
daniel@transgaming.com | 428d158 | 2010-05-04 03:35:25 +0000 | [diff] [blame] | 3202 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3203 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 3204 | { |
| 3205 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 3206 | for (int i = 0; i < 4; ++i) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3207 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3208 | params[i] = currentValueData.FloatValues[i]; |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3209 | } |
| 3210 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3211 | else |
| 3212 | { |
| 3213 | *params = gl::QuerySingleVertexAttributeParameter<GLfloat>(attribState, pname); |
| 3214 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3215 | } |
| 3216 | } |
| 3217 | |
| 3218 | void __stdcall glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) |
| 3219 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3220 | 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] | 3221 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3222 | gl::Context *context = gl::getNonLostContext(); |
| 3223 | |
| 3224 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3225 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3226 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3227 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3228 | return gl::error(GL_INVALID_VALUE); |
| 3229 | } |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3230 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3231 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
daniel@transgaming.com | 428d158 | 2010-05-04 03:35:25 +0000 | [diff] [blame] | 3232 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3233 | if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion())) |
| 3234 | { |
| 3235 | return; |
| 3236 | } |
Jamie Madill | aff7150 | 2013-07-02 11:57:05 -0400 | [diff] [blame] | 3237 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3238 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 3239 | { |
| 3240 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 3241 | for (int i = 0; i < 4; ++i) |
Jamie Madill | aff7150 | 2013-07-02 11:57:05 -0400 | [diff] [blame] | 3242 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3243 | float currentValue = currentValueData.FloatValues[i]; |
| 3244 | params[i] = gl::iround<GLint>(currentValue); |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3245 | } |
| 3246 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3247 | else |
| 3248 | { |
| 3249 | *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname); |
| 3250 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3251 | } |
| 3252 | } |
| 3253 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 3254 | void __stdcall glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3255 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3256 | 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] | 3257 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3258 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3259 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3260 | if (context) |
| 3261 | { |
| 3262 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3263 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3264 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3265 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3266 | |
| 3267 | if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER) |
| 3268 | { |
| 3269 | return gl::error(GL_INVALID_ENUM); |
| 3270 | } |
| 3271 | |
| 3272 | *pointer = const_cast<GLvoid*>(context->getState().getVertexAttribPointer(index)); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3273 | } |
| 3274 | } |
| 3275 | |
| 3276 | void __stdcall glHint(GLenum target, GLenum mode) |
| 3277 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3278 | EVENT("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3279 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3280 | switch (mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3281 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3282 | case GL_FASTEST: |
| 3283 | case GL_NICEST: |
| 3284 | case GL_DONT_CARE: |
| 3285 | break; |
| 3286 | default: |
| 3287 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3288 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3289 | |
| 3290 | gl::Context *context = gl::getNonLostContext(); |
| 3291 | switch (target) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3292 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3293 | case GL_GENERATE_MIPMAP_HINT: |
| 3294 | if (context) context->getState().setGenerateMipmapHint(mode); |
| 3295 | break; |
| 3296 | case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: |
| 3297 | if (context) context->getState().setFragmentShaderDerivativeHint(mode); |
| 3298 | break; |
| 3299 | default: |
| 3300 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3301 | } |
| 3302 | } |
| 3303 | |
| 3304 | GLboolean __stdcall glIsBuffer(GLuint buffer) |
| 3305 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3306 | EVENT("(GLuint buffer = %d)", buffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3307 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3308 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3309 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3310 | if (context && buffer) |
| 3311 | { |
| 3312 | gl::Buffer *bufferObject = context->getBuffer(buffer); |
| 3313 | |
| 3314 | if (bufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3315 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3316 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3317 | } |
| 3318 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3319 | |
| 3320 | return GL_FALSE; |
| 3321 | } |
| 3322 | |
| 3323 | GLboolean __stdcall glIsEnabled(GLenum cap) |
| 3324 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3325 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3326 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3327 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3328 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3329 | if (context) |
| 3330 | { |
| 3331 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3332 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3333 | return gl::error(GL_INVALID_ENUM, false); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3334 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3335 | |
| 3336 | return context->getState().getEnableFeature(cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3337 | } |
| 3338 | |
| 3339 | return false; |
| 3340 | } |
| 3341 | |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3342 | GLboolean __stdcall glIsFenceNV(GLuint fence) |
| 3343 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3344 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3345 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3346 | gl::Context *context = gl::getNonLostContext(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3347 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3348 | if (context) |
| 3349 | { |
| 3350 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 3351 | |
| 3352 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3353 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3354 | return GL_FALSE; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3355 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3356 | |
| 3357 | return fenceObject->isFence(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3358 | } |
| 3359 | |
| 3360 | return GL_FALSE; |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3361 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3362 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3363 | GLboolean __stdcall glIsFramebuffer(GLuint framebuffer) |
| 3364 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3365 | EVENT("(GLuint framebuffer = %d)", framebuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3366 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3367 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3368 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3369 | if (context && framebuffer) |
| 3370 | { |
| 3371 | gl::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer); |
| 3372 | |
| 3373 | if (framebufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3374 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3375 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3376 | } |
| 3377 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3378 | |
| 3379 | return GL_FALSE; |
| 3380 | } |
| 3381 | |
| 3382 | GLboolean __stdcall glIsProgram(GLuint program) |
| 3383 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3384 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3385 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3386 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3387 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3388 | if (context && program) |
| 3389 | { |
| 3390 | gl::Program *programObject = context->getProgram(program); |
| 3391 | |
| 3392 | if (programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3393 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3394 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3395 | } |
| 3396 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3397 | |
| 3398 | return GL_FALSE; |
| 3399 | } |
| 3400 | |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 3401 | GLboolean __stdcall glIsQueryEXT(GLuint id) |
| 3402 | { |
| 3403 | EVENT("(GLuint id = %d)", id); |
| 3404 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3405 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 3406 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3407 | if (context) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 3408 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3409 | 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] | 3410 | } |
| 3411 | |
| 3412 | return GL_FALSE; |
| 3413 | } |
| 3414 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3415 | GLboolean __stdcall glIsRenderbuffer(GLuint renderbuffer) |
| 3416 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3417 | EVENT("(GLuint renderbuffer = %d)", renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3418 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3419 | gl::Context *context = gl::getNonLostContext(); |
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 (context && renderbuffer) |
| 3422 | { |
| 3423 | gl::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer); |
| 3424 | |
| 3425 | if (renderbufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3426 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3427 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3428 | } |
| 3429 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3430 | |
| 3431 | return GL_FALSE; |
| 3432 | } |
| 3433 | |
| 3434 | GLboolean __stdcall glIsShader(GLuint shader) |
| 3435 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3436 | EVENT("(GLuint shader = %d)", shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3437 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3438 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3439 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3440 | if (context && shader) |
| 3441 | { |
| 3442 | gl::Shader *shaderObject = context->getShader(shader); |
| 3443 | |
| 3444 | if (shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3445 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3446 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3447 | } |
| 3448 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3449 | |
| 3450 | return GL_FALSE; |
| 3451 | } |
| 3452 | |
| 3453 | GLboolean __stdcall glIsTexture(GLuint texture) |
| 3454 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3455 | EVENT("(GLuint texture = %d)", texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3456 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3457 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3458 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3459 | if (context && texture) |
| 3460 | { |
| 3461 | gl::Texture *textureObject = context->getTexture(texture); |
| 3462 | |
| 3463 | if (textureObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3464 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3465 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3466 | } |
| 3467 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3468 | |
| 3469 | return GL_FALSE; |
| 3470 | } |
| 3471 | |
| 3472 | void __stdcall glLineWidth(GLfloat width) |
| 3473 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3474 | EVENT("(GLfloat width = %f)", width); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3475 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3476 | if (width <= 0.0f) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3477 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3478 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3479 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3480 | |
| 3481 | gl::Context *context = gl::getNonLostContext(); |
| 3482 | |
| 3483 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3484 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3485 | context->getState().setLineWidth(width); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3486 | } |
| 3487 | } |
| 3488 | |
| 3489 | void __stdcall glLinkProgram(GLuint program) |
| 3490 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3491 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3492 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3493 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3494 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3495 | if (context) |
| 3496 | { |
| 3497 | gl::Program *programObject = context->getProgram(program); |
| 3498 | |
| 3499 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3500 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3501 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3502 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3503 | return gl::error(GL_INVALID_OPERATION); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3504 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3505 | else |
| 3506 | { |
| 3507 | return gl::error(GL_INVALID_VALUE); |
| 3508 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3509 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3510 | |
| 3511 | context->linkProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3512 | } |
| 3513 | } |
| 3514 | |
| 3515 | void __stdcall glPixelStorei(GLenum pname, GLint param) |
| 3516 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3517 | EVENT("(GLenum pname = 0x%X, GLint param = %d)", pname, param); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3518 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3519 | gl::Context *context = gl::getNonLostContext(); |
| 3520 | |
| 3521 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3522 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3523 | switch (pname) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3524 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3525 | case GL_UNPACK_ALIGNMENT: |
| 3526 | if (param != 1 && param != 2 && param != 4 && param != 8) |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3527 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3528 | return gl::error(GL_INVALID_VALUE); |
| 3529 | } |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3530 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3531 | context->getState().setUnpackAlignment(param); |
| 3532 | break; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3533 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3534 | case GL_PACK_ALIGNMENT: |
| 3535 | if (param != 1 && param != 2 && param != 4 && param != 8) |
| 3536 | { |
| 3537 | return gl::error(GL_INVALID_VALUE); |
| 3538 | } |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3539 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3540 | context->getState().setPackAlignment(param); |
| 3541 | break; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3542 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3543 | case GL_PACK_REVERSE_ROW_ORDER_ANGLE: |
| 3544 | context->getState().setPackReverseRowOrder(param != 0); |
| 3545 | break; |
bsalomon@google.com | 56d46ab | 2011-11-23 14:53:10 +0000 | [diff] [blame] | 3546 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3547 | case GL_UNPACK_IMAGE_HEIGHT: |
| 3548 | case GL_UNPACK_SKIP_IMAGES: |
| 3549 | case GL_UNPACK_ROW_LENGTH: |
| 3550 | case GL_UNPACK_SKIP_ROWS: |
| 3551 | case GL_UNPACK_SKIP_PIXELS: |
| 3552 | case GL_PACK_ROW_LENGTH: |
| 3553 | case GL_PACK_SKIP_ROWS: |
| 3554 | case GL_PACK_SKIP_PIXELS: |
| 3555 | if (context->getClientVersion() < 3) |
| 3556 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 3557 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3558 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3559 | UNIMPLEMENTED(); |
| 3560 | break; |
| 3561 | |
| 3562 | default: |
| 3563 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3564 | } |
| 3565 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3566 | } |
| 3567 | |
| 3568 | void __stdcall glPolygonOffset(GLfloat factor, GLfloat units) |
| 3569 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3570 | EVENT("(GLfloat factor = %f, GLfloat units = %f)", factor, units); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3571 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3572 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | aede630 | 2010-04-29 03:35:48 +0000 | [diff] [blame] | 3573 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3574 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3575 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3576 | context->getState().setPolygonOffsetParams(factor, units); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3577 | } |
| 3578 | } |
| 3579 | |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3580 | void __stdcall glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, |
| 3581 | GLenum format, GLenum type, GLsizei bufSize, |
| 3582 | GLvoid *data) |
| 3583 | { |
| 3584 | EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, " |
| 3585 | "GLenum format = 0x%X, GLenum type = 0x%X, GLsizei bufSize = 0x%d, GLvoid *data = 0x%0.8p)", |
| 3586 | x, y, width, height, format, type, bufSize, data); |
| 3587 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3588 | if (width < 0 || height < 0 || bufSize < 0) |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3589 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3590 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3591 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3592 | |
| 3593 | gl::Context *context = gl::getNonLostContext(); |
| 3594 | |
| 3595 | if (context) |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3596 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3597 | if (!gl::ValidateReadPixelsParameters(context, x, y, width, height, |
| 3598 | format, type, &bufSize, data)) |
| 3599 | { |
| 3600 | return; |
| 3601 | } |
| 3602 | |
| 3603 | context->readPixels(x, y, width, height, format, type, &bufSize, data); |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3604 | } |
| 3605 | } |
| 3606 | |
| 3607 | void __stdcall glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, |
| 3608 | GLenum format, GLenum type, GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3609 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3610 | 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] | 3611 | "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] | 3612 | x, y, width, height, format, type, pixels); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3613 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3614 | if (width < 0 || height < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3615 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3616 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3617 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3618 | |
| 3619 | gl::Context *context = gl::getNonLostContext(); |
| 3620 | |
| 3621 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3622 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3623 | if (!gl::ValidateReadPixelsParameters(context, x, y, width, height, |
| 3624 | format, type, NULL, pixels)) |
| 3625 | { |
| 3626 | return; |
| 3627 | } |
| 3628 | |
| 3629 | context->readPixels(x, y, width, height, format, type, NULL, pixels); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3630 | } |
| 3631 | } |
| 3632 | |
| 3633 | void __stdcall glReleaseShaderCompiler(void) |
| 3634 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3635 | EVENT("()"); |
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::Shader::releaseCompiler(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3638 | } |
| 3639 | |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 3640 | void __stdcall glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3641 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3642 | 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] | 3643 | target, samples, internalformat, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3644 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3645 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3646 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3647 | if (context) |
| 3648 | { |
| 3649 | if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat, |
| 3650 | width, height, true)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3651 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3652 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3653 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3654 | |
| 3655 | context->setRenderbufferStorage(width, height, internalformat, samples); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3656 | } |
| 3657 | } |
| 3658 | |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 3659 | void __stdcall glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) |
| 3660 | { |
| 3661 | glRenderbufferStorageMultisampleANGLE(target, 0, internalformat, width, height); |
| 3662 | } |
| 3663 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3664 | void __stdcall glSampleCoverage(GLclampf value, GLboolean invert) |
| 3665 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 3666 | EVENT("(GLclampf value = %f, GLboolean invert = %u)", value, invert); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3667 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3668 | gl::Context* context = gl::getNonLostContext(); |
daniel@transgaming.com | fab5a1a | 2010-03-11 19:22:30 +0000 | [diff] [blame] | 3669 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3670 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3671 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3672 | context->getState().setSampleCoverageParams(gl::clamp01(value), invert == GL_TRUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3673 | } |
| 3674 | } |
| 3675 | |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3676 | void __stdcall glSetFenceNV(GLuint fence, GLenum condition) |
| 3677 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3678 | EVENT("(GLuint fence = %d, GLenum condition = 0x%X)", fence, condition); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3679 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3680 | if (condition != GL_ALL_COMPLETED_NV) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3681 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3682 | return gl::error(GL_INVALID_ENUM); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3683 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3684 | |
| 3685 | gl::Context *context = gl::getNonLostContext(); |
| 3686 | |
| 3687 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3688 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3689 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 3690 | |
| 3691 | if (fenceObject == NULL) |
| 3692 | { |
| 3693 | return gl::error(GL_INVALID_OPERATION); |
| 3694 | } |
| 3695 | |
| 3696 | fenceObject->setFence(condition); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3697 | } |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3698 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3699 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3700 | void __stdcall glScissor(GLint x, GLint y, GLsizei width, GLsizei height) |
| 3701 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3702 | 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] | 3703 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3704 | if (width < 0 || height < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3705 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3706 | return gl::error(GL_INVALID_VALUE); |
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 | |
| 3709 | gl::Context* context = gl::getNonLostContext(); |
| 3710 | |
| 3711 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3712 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3713 | context->getState().setScissorParams(x, y, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3714 | } |
| 3715 | } |
| 3716 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 3717 | void __stdcall 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] | 3718 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3719 | 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] | 3720 | "const GLvoid* binary = 0x%0.8p, GLsizei length = %d)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 3721 | n, shaders, binaryformat, binary, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3722 | |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame^] | 3723 | gl::Context* context = gl::getNonLostContext(); |
| 3724 | if (context) |
| 3725 | { |
| 3726 | const std::vector<GLenum> &shaderBinaryFormats = context->getCaps().shaderBinaryFormats; |
| 3727 | if (std::find(shaderBinaryFormats.begin(), shaderBinaryFormats.end(), binaryformat) == shaderBinaryFormats.end()) |
| 3728 | { |
| 3729 | return gl::error(GL_INVALID_ENUM); |
| 3730 | } |
| 3731 | |
| 3732 | // No binary shader formats are supported. |
| 3733 | UNIMPLEMENTED(); |
| 3734 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3735 | } |
| 3736 | |
shannon.woods%transgaming.com@gtempaccount.com | 5f33933 | 2013-04-13 03:29:02 +0000 | [diff] [blame] | 3737 | void __stdcall 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] | 3738 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3739 | 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] | 3740 | shader, count, string, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3741 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3742 | if (count < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3743 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3744 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3745 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3746 | |
| 3747 | gl::Context *context = gl::getNonLostContext(); |
| 3748 | |
| 3749 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3750 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3751 | gl::Shader *shaderObject = context->getShader(shader); |
| 3752 | |
| 3753 | if (!shaderObject) |
| 3754 | { |
| 3755 | if (context->getProgram(shader)) |
| 3756 | { |
| 3757 | return gl::error(GL_INVALID_OPERATION); |
| 3758 | } |
| 3759 | else |
| 3760 | { |
| 3761 | return gl::error(GL_INVALID_VALUE); |
| 3762 | } |
| 3763 | } |
| 3764 | |
| 3765 | shaderObject->setSource(count, string, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3766 | } |
| 3767 | } |
| 3768 | |
| 3769 | void __stdcall glStencilFunc(GLenum func, GLint ref, GLuint mask) |
| 3770 | { |
daniel@transgaming.com | fab5a1a | 2010-03-11 19:22:30 +0000 | [diff] [blame] | 3771 | glStencilFuncSeparate(GL_FRONT_AND_BACK, func, ref, mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3772 | } |
| 3773 | |
| 3774 | void __stdcall glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) |
| 3775 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3776 | 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] | 3777 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3778 | switch (face) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3779 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3780 | case GL_FRONT: |
| 3781 | case GL_BACK: |
| 3782 | case GL_FRONT_AND_BACK: |
| 3783 | break; |
| 3784 | default: |
| 3785 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3786 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3787 | |
| 3788 | switch (func) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3789 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3790 | case GL_NEVER: |
| 3791 | case GL_ALWAYS: |
| 3792 | case GL_LESS: |
| 3793 | case GL_LEQUAL: |
| 3794 | case GL_EQUAL: |
| 3795 | case GL_GEQUAL: |
| 3796 | case GL_GREATER: |
| 3797 | case GL_NOTEQUAL: |
| 3798 | break; |
| 3799 | default: |
| 3800 | return gl::error(GL_INVALID_ENUM); |
| 3801 | } |
| 3802 | |
| 3803 | gl::Context *context = gl::getNonLostContext(); |
| 3804 | |
| 3805 | if (context) |
| 3806 | { |
| 3807 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 3808 | { |
| 3809 | context->getState().setStencilParams(func, ref, mask); |
| 3810 | } |
| 3811 | |
| 3812 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 3813 | { |
| 3814 | context->getState().setStencilBackParams(func, ref, mask); |
| 3815 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3816 | } |
| 3817 | } |
| 3818 | |
| 3819 | void __stdcall glStencilMask(GLuint mask) |
| 3820 | { |
| 3821 | glStencilMaskSeparate(GL_FRONT_AND_BACK, mask); |
| 3822 | } |
| 3823 | |
| 3824 | void __stdcall glStencilMaskSeparate(GLenum face, GLuint mask) |
| 3825 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3826 | EVENT("(GLenum face = 0x%X, GLuint mask = %d)", face, mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3827 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3828 | switch (face) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3829 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3830 | case GL_FRONT: |
| 3831 | case GL_BACK: |
| 3832 | case GL_FRONT_AND_BACK: |
| 3833 | break; |
| 3834 | default: |
| 3835 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3836 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3837 | |
| 3838 | gl::Context *context = gl::getNonLostContext(); |
| 3839 | |
| 3840 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3841 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3842 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 3843 | { |
| 3844 | context->getState().setStencilWritemask(mask); |
| 3845 | } |
| 3846 | |
| 3847 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 3848 | { |
| 3849 | context->getState().setStencilBackWritemask(mask); |
| 3850 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3851 | } |
| 3852 | } |
| 3853 | |
| 3854 | void __stdcall glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) |
| 3855 | { |
| 3856 | glStencilOpSeparate(GL_FRONT_AND_BACK, fail, zfail, zpass); |
| 3857 | } |
| 3858 | |
| 3859 | void __stdcall glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) |
| 3860 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3861 | 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] | 3862 | face, fail, zfail, zpass); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3863 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3864 | switch (face) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3865 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3866 | case GL_FRONT: |
| 3867 | case GL_BACK: |
| 3868 | case GL_FRONT_AND_BACK: |
| 3869 | break; |
| 3870 | default: |
| 3871 | return gl::error(GL_INVALID_ENUM); |
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 | switch (fail) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3875 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3876 | case GL_ZERO: |
| 3877 | case GL_KEEP: |
| 3878 | case GL_REPLACE: |
| 3879 | case GL_INCR: |
| 3880 | case GL_DECR: |
| 3881 | case GL_INVERT: |
| 3882 | case GL_INCR_WRAP: |
| 3883 | case GL_DECR_WRAP: |
| 3884 | break; |
| 3885 | default: |
| 3886 | return gl::error(GL_INVALID_ENUM); |
| 3887 | } |
| 3888 | |
| 3889 | switch (zfail) |
| 3890 | { |
| 3891 | case GL_ZERO: |
| 3892 | case GL_KEEP: |
| 3893 | case GL_REPLACE: |
| 3894 | case GL_INCR: |
| 3895 | case GL_DECR: |
| 3896 | case GL_INVERT: |
| 3897 | case GL_INCR_WRAP: |
| 3898 | case GL_DECR_WRAP: |
| 3899 | break; |
| 3900 | default: |
| 3901 | return gl::error(GL_INVALID_ENUM); |
| 3902 | } |
| 3903 | |
| 3904 | switch (zpass) |
| 3905 | { |
| 3906 | case GL_ZERO: |
| 3907 | case GL_KEEP: |
| 3908 | case GL_REPLACE: |
| 3909 | case GL_INCR: |
| 3910 | case GL_DECR: |
| 3911 | case GL_INVERT: |
| 3912 | case GL_INCR_WRAP: |
| 3913 | case GL_DECR_WRAP: |
| 3914 | break; |
| 3915 | default: |
| 3916 | return gl::error(GL_INVALID_ENUM); |
| 3917 | } |
| 3918 | |
| 3919 | gl::Context *context = gl::getNonLostContext(); |
| 3920 | |
| 3921 | if (context) |
| 3922 | { |
| 3923 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 3924 | { |
| 3925 | context->getState().setStencilOperations(fail, zfail, zpass); |
| 3926 | } |
| 3927 | |
| 3928 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 3929 | { |
| 3930 | context->getState().setStencilBackOperations(fail, zfail, zpass); |
| 3931 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3932 | } |
| 3933 | } |
| 3934 | |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3935 | GLboolean __stdcall glTestFenceNV(GLuint fence) |
| 3936 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3937 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3938 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3939 | gl::Context *context = gl::getNonLostContext(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3940 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3941 | if (context) |
| 3942 | { |
| 3943 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 3944 | |
| 3945 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3946 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3947 | return gl::error(GL_INVALID_OPERATION, GL_TRUE); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3948 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3949 | |
| 3950 | if (fenceObject->isFence() != GL_TRUE) |
| 3951 | { |
| 3952 | return gl::error(GL_INVALID_OPERATION, GL_TRUE); |
| 3953 | } |
| 3954 | |
| 3955 | return fenceObject->testFence(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3956 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3957 | |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3958 | return GL_TRUE; |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3959 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3960 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 3961 | void __stdcall glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, |
| 3962 | GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3963 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3964 | 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] | 3965 | "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] | 3966 | target, level, internalformat, width, height, border, format, type, pixels); |
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(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3969 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3970 | if (context) |
| 3971 | { |
| 3972 | if (context->getClientVersion() < 3 && |
| 3973 | !ValidateES2TexImageParameters(context, target, level, internalformat, false, false, |
| 3974 | 0, 0, width, height, border, format, type, pixels)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3975 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3976 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3977 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3978 | |
| 3979 | if (context->getClientVersion() >= 3 && |
| 3980 | !ValidateES3TexImageParameters(context, target, level, internalformat, false, false, |
| 3981 | 0, 0, 0, width, height, 1, border, format, type, pixels)) |
| 3982 | { |
| 3983 | return; |
| 3984 | } |
| 3985 | |
| 3986 | switch (target) |
| 3987 | { |
| 3988 | case GL_TEXTURE_2D: |
| 3989 | { |
| 3990 | gl::Texture2D *texture = context->getTexture2D(); |
| 3991 | texture->setImage(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 3992 | } |
| 3993 | break; |
| 3994 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 3995 | { |
| 3996 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 3997 | texture->setImagePosX(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 3998 | } |
| 3999 | break; |
| 4000 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 4001 | { |
| 4002 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 4003 | texture->setImageNegX(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4004 | } |
| 4005 | break; |
| 4006 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 4007 | { |
| 4008 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 4009 | texture->setImagePosY(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4010 | } |
| 4011 | break; |
| 4012 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 4013 | { |
| 4014 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 4015 | texture->setImageNegY(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4016 | } |
| 4017 | break; |
| 4018 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 4019 | { |
| 4020 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 4021 | texture->setImagePosZ(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4022 | } |
| 4023 | break; |
| 4024 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 4025 | { |
| 4026 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 4027 | texture->setImageNegZ(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4028 | } |
| 4029 | break; |
| 4030 | default: UNREACHABLE(); |
| 4031 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4032 | } |
| 4033 | } |
| 4034 | |
| 4035 | void __stdcall glTexParameterf(GLenum target, GLenum pname, GLfloat param) |
| 4036 | { |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4037 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %f)", target, pname, param); |
| 4038 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4039 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4040 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4041 | if (context) |
| 4042 | { |
| 4043 | if (!ValidateTexParamParameters(context, pname, static_cast<GLint>(param))) |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4044 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4045 | return; |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4046 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4047 | |
| 4048 | gl::Texture *texture = context->getTargetTexture(target); |
| 4049 | |
| 4050 | if (!texture) |
| 4051 | { |
| 4052 | return gl::error(GL_INVALID_ENUM); |
| 4053 | } |
| 4054 | |
| 4055 | switch (pname) |
| 4056 | { |
| 4057 | case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = gl::uiround<GLenum>(param); break; |
| 4058 | case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = gl::uiround<GLenum>(param); break; |
| 4059 | case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = gl::uiround<GLenum>(param); break; |
| 4060 | case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = gl::uiround<GLenum>(param); break; |
| 4061 | case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = gl::uiround<GLenum>(param); break; |
| 4062 | case GL_TEXTURE_USAGE_ANGLE: texture->setUsage(gl::uiround<GLenum>(param)); break; |
| 4063 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min(param, context->getExtensions().maxTextureAnisotropy); break; |
| 4064 | case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = gl::uiround<GLenum>(param); break; |
| 4065 | case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = gl::uiround<GLenum>(param); break; |
| 4066 | case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = gl::uiround<GLenum>(param); break; |
| 4067 | case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = gl::uiround<GLenum>(param); break; |
| 4068 | case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = gl::uiround<GLenum>(param); break; |
| 4069 | case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = gl::uiround<GLenum>(param); break; |
| 4070 | case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = gl::iround<GLint>(param); break; |
| 4071 | case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = gl::iround<GLint>(param); break; |
| 4072 | case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = param; break; |
| 4073 | case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = param; break; |
| 4074 | default: UNREACHABLE(); break; |
| 4075 | } |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4076 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4077 | } |
| 4078 | |
| 4079 | void __stdcall glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) |
| 4080 | { |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4081 | glTexParameterf(target, pname, (GLfloat)*params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4082 | } |
| 4083 | |
| 4084 | void __stdcall glTexParameteri(GLenum target, GLenum pname, GLint param) |
| 4085 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4086 | 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] | 4087 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4088 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4089 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4090 | if (context) |
| 4091 | { |
| 4092 | if (!ValidateTexParamParameters(context, pname, param)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4093 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4094 | return; |
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 | |
| 4097 | gl::Texture *texture = context->getTargetTexture(target); |
| 4098 | |
| 4099 | if (!texture) |
| 4100 | { |
| 4101 | return gl::error(GL_INVALID_ENUM); |
| 4102 | } |
| 4103 | |
| 4104 | switch (pname) |
| 4105 | { |
| 4106 | case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = (GLenum)param; break; |
| 4107 | case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = (GLenum)param; break; |
| 4108 | case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = (GLenum)param; break; |
| 4109 | case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = (GLenum)param; break; |
| 4110 | case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = (GLenum)param; break; |
| 4111 | case GL_TEXTURE_USAGE_ANGLE: texture->setUsage((GLenum)param); break; |
| 4112 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min((float)param, context->getExtensions().maxTextureAnisotropy); break; |
| 4113 | case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = (GLenum)param; break; |
| 4114 | case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = (GLenum)param; break; |
| 4115 | case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = (GLenum)param; break; |
| 4116 | case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = (GLenum)param; break; |
| 4117 | case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = (GLenum)param; break; |
| 4118 | case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = (GLenum)param; break; |
| 4119 | case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = param; break; |
| 4120 | case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = param; break; |
| 4121 | case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = (GLfloat)param; break; |
| 4122 | case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = (GLfloat)param; break; |
| 4123 | default: UNREACHABLE(); break; |
| 4124 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4125 | } |
| 4126 | } |
| 4127 | |
| 4128 | void __stdcall glTexParameteriv(GLenum target, GLenum pname, const GLint* params) |
| 4129 | { |
| 4130 | glTexParameteri(target, pname, *params); |
| 4131 | } |
| 4132 | |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4133 | void __stdcall glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) |
| 4134 | { |
| 4135 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 4136 | target, levels, internalformat, width, height); |
| 4137 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4138 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4139 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4140 | if (context) |
| 4141 | { |
| 4142 | if (!context->getExtensions().textureStorage) |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4143 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4144 | return gl::error(GL_INVALID_OPERATION); |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4145 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4146 | |
| 4147 | if (context->getClientVersion() < 3 && |
| 4148 | !ValidateES2TexStorageParameters(context, target, levels, internalformat, width, height)) |
| 4149 | { |
| 4150 | return; |
| 4151 | } |
| 4152 | |
| 4153 | if (context->getClientVersion() >= 3 && |
| 4154 | !ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1)) |
| 4155 | { |
| 4156 | return; |
| 4157 | } |
| 4158 | |
| 4159 | switch (target) |
| 4160 | { |
| 4161 | case GL_TEXTURE_2D: |
| 4162 | { |
| 4163 | gl::Texture2D *texture2d = context->getTexture2D(); |
| 4164 | texture2d->storage(levels, internalformat, width, height); |
| 4165 | } |
| 4166 | break; |
| 4167 | |
| 4168 | case GL_TEXTURE_CUBE_MAP: |
| 4169 | { |
| 4170 | gl::TextureCubeMap *textureCube = context->getTextureCubeMap(); |
| 4171 | textureCube->storage(levels, internalformat, width); |
| 4172 | } |
| 4173 | break; |
| 4174 | |
| 4175 | default: |
| 4176 | return gl::error(GL_INVALID_ENUM); |
| 4177 | } |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4178 | } |
| 4179 | } |
| 4180 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 4181 | void __stdcall glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, |
| 4182 | GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4183 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4184 | 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] | 4185 | "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] | 4186 | "const GLvoid* pixels = 0x%0.8p)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4187 | target, level, xoffset, yoffset, width, height, format, type, pixels); |
| 4188 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4189 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 00c7596 | 2010-03-11 20:36:15 +0000 | [diff] [blame] | 4190 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4191 | if (context) |
| 4192 | { |
| 4193 | if (context->getClientVersion() < 3 && |
| 4194 | !ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true, |
| 4195 | xoffset, yoffset, width, height, 0, format, type, pixels)) |
daniel@transgaming.com | 00c7596 | 2010-03-11 20:36:15 +0000 | [diff] [blame] | 4196 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4197 | return; |
daniel@transgaming.com | 00c7596 | 2010-03-11 20:36:15 +0000 | [diff] [blame] | 4198 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4199 | |
| 4200 | if (context->getClientVersion() >= 3 && |
| 4201 | !ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true, |
| 4202 | xoffset, yoffset, 0, width, height, 1, 0, format, type, pixels)) |
| 4203 | { |
| 4204 | return; |
| 4205 | } |
| 4206 | |
| 4207 | // Zero sized uploads are valid but no-ops |
| 4208 | if (width == 0 || height == 0) |
| 4209 | { |
| 4210 | return; |
| 4211 | } |
| 4212 | |
| 4213 | switch (target) |
| 4214 | { |
| 4215 | case GL_TEXTURE_2D: |
| 4216 | { |
| 4217 | gl::Texture2D *texture = context->getTexture2D(); |
| 4218 | texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels); |
| 4219 | } |
| 4220 | break; |
| 4221 | |
| 4222 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 4223 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 4224 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 4225 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 4226 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 4227 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 4228 | { |
| 4229 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 4230 | texture->subImage(target, level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels); |
| 4231 | } |
| 4232 | break; |
| 4233 | |
| 4234 | default: |
| 4235 | UNREACHABLE(); |
| 4236 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4237 | } |
| 4238 | } |
| 4239 | |
| 4240 | void __stdcall glUniform1f(GLint location, GLfloat x) |
| 4241 | { |
| 4242 | glUniform1fv(location, 1, &x); |
| 4243 | } |
| 4244 | |
| 4245 | void __stdcall glUniform1fv(GLint location, GLsizei count, const GLfloat* v) |
| 4246 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4247 | 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] | 4248 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4249 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4250 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4251 | if (context) |
| 4252 | { |
| 4253 | if (!ValidateUniform(context, GL_FLOAT, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4254 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4255 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4256 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4257 | |
| 4258 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4259 | programBinary->setUniform1fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4260 | } |
| 4261 | } |
| 4262 | |
| 4263 | void __stdcall glUniform1i(GLint location, GLint x) |
| 4264 | { |
| 4265 | glUniform1iv(location, 1, &x); |
| 4266 | } |
| 4267 | |
| 4268 | void __stdcall glUniform1iv(GLint location, GLsizei count, const GLint* v) |
| 4269 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4270 | 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] | 4271 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4272 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4273 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4274 | if (context) |
| 4275 | { |
| 4276 | if (!ValidateUniform(context, GL_INT, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4277 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4278 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4279 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4280 | |
| 4281 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4282 | programBinary->setUniform1iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4283 | } |
| 4284 | } |
| 4285 | |
| 4286 | void __stdcall glUniform2f(GLint location, GLfloat x, GLfloat y) |
| 4287 | { |
| 4288 | GLfloat xy[2] = {x, y}; |
| 4289 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4290 | glUniform2fv(location, 1, xy); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4291 | } |
| 4292 | |
| 4293 | void __stdcall glUniform2fv(GLint location, GLsizei count, const GLfloat* v) |
| 4294 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4295 | 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] | 4296 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4297 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4298 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4299 | if (context) |
| 4300 | { |
| 4301 | if (!ValidateUniform(context, GL_FLOAT_VEC2, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4302 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4303 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4304 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4305 | |
| 4306 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4307 | programBinary->setUniform2fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4308 | } |
| 4309 | } |
| 4310 | |
| 4311 | void __stdcall glUniform2i(GLint location, GLint x, GLint y) |
| 4312 | { |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4313 | GLint xy[2] = {x, y}; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4314 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4315 | glUniform2iv(location, 1, xy); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4316 | } |
| 4317 | |
| 4318 | void __stdcall glUniform2iv(GLint location, GLsizei count, const GLint* v) |
| 4319 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4320 | 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] | 4321 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4322 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4323 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4324 | if (context) |
| 4325 | { |
| 4326 | if (!ValidateUniform(context, GL_INT_VEC2, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4327 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4328 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4329 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4330 | |
| 4331 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4332 | programBinary->setUniform2iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4333 | } |
| 4334 | } |
| 4335 | |
| 4336 | void __stdcall glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) |
| 4337 | { |
| 4338 | GLfloat xyz[3] = {x, y, z}; |
| 4339 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4340 | glUniform3fv(location, 1, xyz); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4341 | } |
| 4342 | |
| 4343 | void __stdcall glUniform3fv(GLint location, GLsizei count, const GLfloat* v) |
| 4344 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4345 | 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] | 4346 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4347 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4348 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4349 | if (context) |
| 4350 | { |
| 4351 | if (!ValidateUniform(context, GL_FLOAT_VEC3, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4352 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4353 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4354 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4355 | |
| 4356 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4357 | programBinary->setUniform3fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4358 | } |
| 4359 | } |
| 4360 | |
| 4361 | void __stdcall glUniform3i(GLint location, GLint x, GLint y, GLint z) |
| 4362 | { |
| 4363 | GLint xyz[3] = {x, y, z}; |
| 4364 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4365 | glUniform3iv(location, 1, xyz); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4366 | } |
| 4367 | |
| 4368 | void __stdcall glUniform3iv(GLint location, GLsizei count, const GLint* v) |
| 4369 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4370 | 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] | 4371 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4372 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4373 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4374 | if (context) |
| 4375 | { |
| 4376 | if (!ValidateUniform(context, GL_INT_VEC3, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4377 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4378 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4379 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4380 | |
| 4381 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4382 | programBinary->setUniform3iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4383 | } |
| 4384 | } |
| 4385 | |
| 4386 | void __stdcall glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
| 4387 | { |
| 4388 | GLfloat xyzw[4] = {x, y, z, w}; |
| 4389 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4390 | glUniform4fv(location, 1, xyzw); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4391 | } |
| 4392 | |
| 4393 | void __stdcall glUniform4fv(GLint location, GLsizei count, const GLfloat* v) |
| 4394 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4395 | 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] | 4396 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4397 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4398 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4399 | if (context) |
| 4400 | { |
| 4401 | if (!ValidateUniform(context, GL_FLOAT_VEC4, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4402 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4403 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4404 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4405 | |
| 4406 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4407 | programBinary->setUniform4fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4408 | } |
| 4409 | } |
| 4410 | |
| 4411 | void __stdcall glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) |
| 4412 | { |
| 4413 | GLint xyzw[4] = {x, y, z, w}; |
| 4414 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4415 | glUniform4iv(location, 1, xyzw); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4416 | } |
| 4417 | |
| 4418 | void __stdcall glUniform4iv(GLint location, GLsizei count, const GLint* v) |
| 4419 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4420 | 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] | 4421 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4422 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4423 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4424 | if (context) |
| 4425 | { |
| 4426 | if (!ValidateUniform(context, GL_INT_VEC4, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4427 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4428 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4429 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4430 | |
| 4431 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4432 | programBinary->setUniform4iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4433 | } |
| 4434 | } |
| 4435 | |
| 4436 | void __stdcall glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 4437 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4438 | 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] | 4439 | location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4440 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4441 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4442 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4443 | if (context) |
| 4444 | { |
| 4445 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4446 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4447 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4448 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4449 | |
| 4450 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4451 | programBinary->setUniformMatrix2fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4452 | } |
| 4453 | } |
| 4454 | |
| 4455 | void __stdcall glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 4456 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4457 | 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] | 4458 | location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4459 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4460 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4461 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4462 | if (context) |
| 4463 | { |
| 4464 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4465 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4466 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4467 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4468 | |
| 4469 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4470 | programBinary->setUniformMatrix3fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4471 | } |
| 4472 | } |
| 4473 | |
| 4474 | void __stdcall glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 4475 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4476 | 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] | 4477 | location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4478 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4479 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4480 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4481 | if (context) |
| 4482 | { |
| 4483 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4484 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4485 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4486 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4487 | |
| 4488 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4489 | programBinary->setUniformMatrix4fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4490 | } |
| 4491 | } |
| 4492 | |
| 4493 | void __stdcall glUseProgram(GLuint program) |
| 4494 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4495 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4496 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4497 | gl::Context *context = gl::getNonLostContext(); |
| 4498 | |
| 4499 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4500 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4501 | gl::Program *programObject = context->getProgram(program); |
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 | if (!programObject && program != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4504 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4505 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4506 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 4507 | return gl::error(GL_INVALID_OPERATION); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4508 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4509 | else |
| 4510 | { |
| 4511 | return gl::error(GL_INVALID_VALUE); |
| 4512 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4513 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4514 | |
| 4515 | if (program != 0 && !programObject->isLinked()) |
| 4516 | { |
| 4517 | return gl::error(GL_INVALID_OPERATION); |
| 4518 | } |
| 4519 | |
| 4520 | context->useProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4521 | } |
| 4522 | } |
| 4523 | |
| 4524 | void __stdcall glValidateProgram(GLuint program) |
| 4525 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4526 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4527 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4528 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4529 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4530 | if (context) |
| 4531 | { |
| 4532 | gl::Program *programObject = context->getProgram(program); |
| 4533 | |
| 4534 | if (!programObject) |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4535 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4536 | if (context->getShader(program)) |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4537 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4538 | return gl::error(GL_INVALID_OPERATION); |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4539 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4540 | else |
| 4541 | { |
| 4542 | return gl::error(GL_INVALID_VALUE); |
| 4543 | } |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4544 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4545 | |
| 4546 | programObject->validate(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4547 | } |
| 4548 | } |
| 4549 | |
| 4550 | void __stdcall glVertexAttrib1f(GLuint index, GLfloat x) |
| 4551 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4552 | EVENT("(GLuint index = %d, GLfloat x = %f)", index, x); |
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 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
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 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4557 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4558 | |
| 4559 | gl::Context *context = gl::getNonLostContext(); |
| 4560 | |
| 4561 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4562 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4563 | GLfloat vals[4] = { x, 0, 0, 1 }; |
| 4564 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4565 | } |
| 4566 | } |
| 4567 | |
| 4568 | void __stdcall glVertexAttrib1fv(GLuint index, const GLfloat* values) |
| 4569 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4570 | 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] | 4571 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4572 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4573 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4574 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4575 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4576 | |
| 4577 | gl::Context *context = gl::getNonLostContext(); |
| 4578 | |
| 4579 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4580 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4581 | GLfloat vals[4] = { values[0], 0, 0, 1 }; |
| 4582 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4583 | } |
| 4584 | } |
| 4585 | |
| 4586 | void __stdcall glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y) |
| 4587 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4588 | 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] | 4589 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4590 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4591 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4592 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4593 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4594 | |
| 4595 | gl::Context *context = gl::getNonLostContext(); |
| 4596 | |
| 4597 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4598 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4599 | GLfloat vals[4] = { x, y, 0, 1 }; |
| 4600 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4601 | } |
| 4602 | } |
| 4603 | |
| 4604 | void __stdcall glVertexAttrib2fv(GLuint index, const GLfloat* values) |
| 4605 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4606 | 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] | 4607 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4608 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4609 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4610 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4611 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4612 | |
| 4613 | gl::Context *context = gl::getNonLostContext(); |
| 4614 | |
| 4615 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4616 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4617 | GLfloat vals[4] = { values[0], values[1], 0, 1 }; |
| 4618 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4619 | } |
| 4620 | } |
| 4621 | |
| 4622 | void __stdcall glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z) |
| 4623 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4624 | 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] | 4625 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4626 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4627 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4628 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4629 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4630 | |
| 4631 | gl::Context *context = gl::getNonLostContext(); |
| 4632 | |
| 4633 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4634 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4635 | GLfloat vals[4] = { x, y, z, 1 }; |
| 4636 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4637 | } |
| 4638 | } |
| 4639 | |
| 4640 | void __stdcall glVertexAttrib3fv(GLuint index, const GLfloat* values) |
| 4641 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4642 | 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] | 4643 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4644 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4645 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4646 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4647 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4648 | |
| 4649 | gl::Context *context = gl::getNonLostContext(); |
| 4650 | |
| 4651 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4652 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4653 | GLfloat vals[4] = { values[0], values[1], values[2], 1 }; |
| 4654 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4655 | } |
| 4656 | } |
| 4657 | |
| 4658 | void __stdcall glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
| 4659 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4660 | 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] | 4661 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4662 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4663 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4664 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4665 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4666 | |
| 4667 | gl::Context *context = gl::getNonLostContext(); |
| 4668 | |
| 4669 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4670 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4671 | GLfloat vals[4] = { x, y, z, w }; |
| 4672 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4673 | } |
| 4674 | } |
| 4675 | |
| 4676 | void __stdcall glVertexAttrib4fv(GLuint index, const GLfloat* values) |
| 4677 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4678 | 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] | 4679 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4680 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4681 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4682 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4683 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4684 | |
| 4685 | gl::Context *context = gl::getNonLostContext(); |
| 4686 | |
| 4687 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4688 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4689 | context->getState().setVertexAttribf(index, values); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4690 | } |
| 4691 | } |
| 4692 | |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4693 | void __stdcall glVertexAttribDivisorANGLE(GLuint index, GLuint divisor) |
| 4694 | { |
| 4695 | EVENT("(GLuint index = %d, GLuint divisor = %d)", index, divisor); |
| 4696 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4697 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4698 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4699 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4700 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4701 | |
| 4702 | gl::Context *context = gl::getNonLostContext(); |
| 4703 | |
| 4704 | if (context) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4705 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4706 | context->setVertexAttribDivisor(index, divisor); |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4707 | } |
| 4708 | } |
| 4709 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 4710 | void __stdcall 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] | 4711 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4712 | 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] | 4713 | "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] | 4714 | index, size, type, normalized, stride, ptr); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4715 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4716 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4717 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4718 | return gl::error(GL_INVALID_VALUE); |
| 4719 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4720 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4721 | if (size < 1 || size > 4) |
| 4722 | { |
| 4723 | return gl::error(GL_INVALID_VALUE); |
| 4724 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4725 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4726 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | 1a4e09a | 2013-04-13 03:33:30 +0000 | [diff] [blame] | 4727 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4728 | switch (type) |
| 4729 | { |
| 4730 | case GL_BYTE: |
| 4731 | case GL_UNSIGNED_BYTE: |
| 4732 | case GL_SHORT: |
| 4733 | case GL_UNSIGNED_SHORT: |
| 4734 | case GL_FIXED: |
| 4735 | case GL_FLOAT: |
| 4736 | break; |
| 4737 | case GL_HALF_FLOAT: |
| 4738 | case GL_INT: |
| 4739 | case GL_UNSIGNED_INT: |
| 4740 | case GL_INT_2_10_10_10_REV: |
| 4741 | case GL_UNSIGNED_INT_2_10_10_10_REV: |
| 4742 | if (context && context->getClientVersion() < 3) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4743 | { |
shannon.woods@transgaming.com | 779aa26 | 2013-02-28 23:04:58 +0000 | [diff] [blame] | 4744 | return gl::error(GL_INVALID_ENUM); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4745 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4746 | else |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4747 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4748 | break; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4749 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4750 | default: |
| 4751 | return gl::error(GL_INVALID_ENUM); |
| 4752 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4753 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4754 | if (stride < 0) |
| 4755 | { |
| 4756 | return gl::error(GL_INVALID_VALUE); |
| 4757 | } |
| 4758 | |
| 4759 | if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4) |
| 4760 | { |
| 4761 | return gl::error(GL_INVALID_OPERATION); |
| 4762 | } |
| 4763 | |
| 4764 | if (context) |
| 4765 | { |
| 4766 | // [OpenGL ES 3.0.2] Section 2.8 page 24: |
| 4767 | // An INVALID_OPERATION error is generated when a non-zero vertex array object |
| 4768 | // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point, |
| 4769 | // and the pointer argument is not NULL. |
| 4770 | 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] | 4771 | { |
| 4772 | return gl::error(GL_INVALID_OPERATION); |
| 4773 | } |
| 4774 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4775 | context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type, |
| 4776 | normalized == GL_TRUE, false, stride, ptr); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4777 | } |
| 4778 | } |
| 4779 | |
| 4780 | void __stdcall glViewport(GLint x, GLint y, GLsizei width, GLsizei height) |
| 4781 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4782 | 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] | 4783 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4784 | if (width < 0 || height < 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4785 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4786 | return gl::error(GL_INVALID_VALUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4787 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4788 | |
| 4789 | gl::Context *context = gl::getNonLostContext(); |
| 4790 | |
| 4791 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4792 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4793 | context->getState().setViewportParams(x, y, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4794 | } |
| 4795 | } |
| 4796 | |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4797 | // OpenGL ES 3.0 functions |
| 4798 | |
| 4799 | void __stdcall glReadBuffer(GLenum mode) |
| 4800 | { |
| 4801 | EVENT("(GLenum mode = 0x%X)", mode); |
| 4802 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4803 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4804 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4805 | if (context) |
| 4806 | { |
| 4807 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4808 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4809 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 4810 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4811 | |
| 4812 | // glReadBuffer |
| 4813 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4814 | } |
| 4815 | } |
| 4816 | |
| 4817 | void __stdcall glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices) |
| 4818 | { |
| 4819 | EVENT("(GLenum mode = 0x%X, GLuint start = %u, GLuint end = %u, GLsizei count = %d, GLenum type = 0x%X, " |
| 4820 | "const GLvoid* indices = 0x%0.8p)", mode, start, end, count, type, indices); |
| 4821 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4822 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4823 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4824 | if (context) |
| 4825 | { |
| 4826 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4827 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4828 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 4829 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4830 | |
| 4831 | // glDrawRangeElements |
| 4832 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4833 | } |
| 4834 | } |
| 4835 | |
| 4836 | void __stdcall glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
| 4837 | { |
| 4838 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, " |
| 4839 | "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLenum format = 0x%X, " |
| 4840 | "GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", |
| 4841 | target, level, internalformat, width, height, depth, border, format, type, pixels); |
| 4842 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4843 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4844 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4845 | if (context) |
| 4846 | { |
| 4847 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4848 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4849 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 4850 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4851 | |
| 4852 | // validateES3TexImageFormat sets the error code if there is an error |
| 4853 | if (!ValidateES3TexImageParameters(context, target, level, internalformat, false, false, |
| 4854 | 0, 0, 0, width, height, depth, border, format, type, pixels)) |
| 4855 | { |
| 4856 | return; |
| 4857 | } |
| 4858 | |
| 4859 | switch(target) |
| 4860 | { |
| 4861 | case GL_TEXTURE_3D: |
| 4862 | { |
| 4863 | gl::Texture3D *texture = context->getTexture3D(); |
| 4864 | texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4865 | } |
| 4866 | break; |
| 4867 | |
| 4868 | case GL_TEXTURE_2D_ARRAY: |
| 4869 | { |
| 4870 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
| 4871 | texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4872 | } |
| 4873 | break; |
| 4874 | |
| 4875 | default: |
| 4876 | return gl::error(GL_INVALID_ENUM); |
| 4877 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4878 | } |
| 4879 | } |
| 4880 | |
| 4881 | void __stdcall glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) |
| 4882 | { |
| 4883 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 4884 | "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, " |
| 4885 | "GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", |
| 4886 | target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); |
| 4887 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4888 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4889 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4890 | if (context) |
| 4891 | { |
| 4892 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4893 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4894 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 4895 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4896 | |
| 4897 | // validateES3TexImageFormat sets the error code if there is an error |
| 4898 | if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true, |
| 4899 | xoffset, yoffset, zoffset, width, height, depth, 0, |
| 4900 | format, type, pixels)) |
| 4901 | { |
| 4902 | return; |
| 4903 | } |
| 4904 | |
| 4905 | // Zero sized uploads are valid but no-ops |
| 4906 | if (width == 0 || height == 0 || depth == 0) |
| 4907 | { |
| 4908 | return; |
| 4909 | } |
| 4910 | |
| 4911 | switch(target) |
| 4912 | { |
| 4913 | case GL_TEXTURE_3D: |
| 4914 | { |
| 4915 | gl::Texture3D *texture = context->getTexture3D(); |
| 4916 | texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels); |
| 4917 | } |
| 4918 | break; |
| 4919 | |
| 4920 | case GL_TEXTURE_2D_ARRAY: |
| 4921 | { |
| 4922 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
| 4923 | texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels); |
| 4924 | } |
| 4925 | break; |
| 4926 | |
| 4927 | default: |
| 4928 | return gl::error(GL_INVALID_ENUM); |
| 4929 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4930 | } |
| 4931 | } |
| 4932 | |
| 4933 | void __stdcall glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
| 4934 | { |
| 4935 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 4936 | "GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", |
| 4937 | target, level, xoffset, yoffset, zoffset, x, y, width, height); |
| 4938 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4939 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4940 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4941 | if (context) |
| 4942 | { |
| 4943 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4944 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4945 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 4946 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4947 | |
| 4948 | if (!ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true, xoffset, yoffset, zoffset, |
| 4949 | x, y, width, height, 0)) |
| 4950 | { |
| 4951 | return; |
| 4952 | } |
| 4953 | |
| 4954 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 4955 | gl::Texture *texture = NULL; |
| 4956 | switch (target) |
| 4957 | { |
| 4958 | case GL_TEXTURE_3D: |
| 4959 | texture = context->getTexture3D(); |
| 4960 | break; |
| 4961 | |
| 4962 | case GL_TEXTURE_2D_ARRAY: |
| 4963 | texture = context->getTexture2DArray(); |
| 4964 | break; |
| 4965 | |
| 4966 | default: |
| 4967 | return gl::error(GL_INVALID_ENUM); |
| 4968 | } |
| 4969 | |
| 4970 | texture->copySubImage(target, level, xoffset, yoffset, zoffset, x, y, width, height, framebuffer); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4971 | } |
| 4972 | } |
| 4973 | |
| 4974 | void __stdcall glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) |
| 4975 | { |
Geoff Lang | eef52cc | 2013-10-16 15:07:39 -0400 | [diff] [blame] | 4976 | 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] | 4977 | "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLsizei imageSize = %d, " |
| 4978 | "const GLvoid* data = 0x%0.8p)", |
| 4979 | target, level, internalformat, width, height, depth, border, imageSize, data); |
| 4980 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4981 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4982 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4983 | if (context) |
| 4984 | { |
| 4985 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4986 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4987 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 4988 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4989 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 4990 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat); |
| 4991 | 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] | 4992 | { |
| 4993 | return gl::error(GL_INVALID_VALUE); |
| 4994 | } |
| 4995 | |
| 4996 | // validateES3TexImageFormat sets the error code if there is an error |
| 4997 | if (!ValidateES3TexImageParameters(context, target, level, internalformat, true, false, |
| 4998 | 0, 0, 0, width, height, depth, border, GL_NONE, GL_NONE, data)) |
| 4999 | { |
| 5000 | return; |
| 5001 | } |
| 5002 | |
| 5003 | switch(target) |
| 5004 | { |
| 5005 | case GL_TEXTURE_3D: |
| 5006 | { |
| 5007 | gl::Texture3D *texture = context->getTexture3D(); |
| 5008 | texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, data); |
| 5009 | } |
| 5010 | break; |
| 5011 | |
| 5012 | case GL_TEXTURE_2D_ARRAY: |
| 5013 | { |
| 5014 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
| 5015 | texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, data); |
| 5016 | } |
| 5017 | break; |
| 5018 | |
| 5019 | default: |
| 5020 | return gl::error(GL_INVALID_ENUM); |
| 5021 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5022 | } |
| 5023 | } |
| 5024 | |
| 5025 | void __stdcall glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) |
| 5026 | { |
| 5027 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5028 | "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, " |
| 5029 | "GLenum format = 0x%X, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
| 5030 | target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); |
| 5031 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5032 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5033 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5034 | if (context) |
| 5035 | { |
| 5036 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5037 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5038 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5039 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5040 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 5041 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format); |
| 5042 | 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] | 5043 | { |
| 5044 | return gl::error(GL_INVALID_VALUE); |
| 5045 | } |
| 5046 | |
| 5047 | if (!data) |
| 5048 | { |
| 5049 | return gl::error(GL_INVALID_VALUE); |
| 5050 | } |
| 5051 | |
| 5052 | // validateES3TexImageFormat sets the error code if there is an error |
| 5053 | if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true, |
| 5054 | 0, 0, 0, width, height, depth, 0, GL_NONE, GL_NONE, data)) |
| 5055 | { |
| 5056 | return; |
| 5057 | } |
| 5058 | |
| 5059 | // Zero sized uploads are valid but no-ops |
| 5060 | if (width == 0 || height == 0) |
| 5061 | { |
| 5062 | return; |
| 5063 | } |
| 5064 | |
| 5065 | switch(target) |
| 5066 | { |
| 5067 | case GL_TEXTURE_3D: |
| 5068 | { |
| 5069 | gl::Texture3D *texture = context->getTexture3D(); |
| 5070 | texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, |
| 5071 | format, imageSize, data); |
| 5072 | } |
| 5073 | break; |
| 5074 | |
| 5075 | case GL_TEXTURE_2D_ARRAY: |
| 5076 | { |
| 5077 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
| 5078 | texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, |
| 5079 | format, imageSize, data); |
| 5080 | } |
| 5081 | break; |
| 5082 | |
| 5083 | default: |
| 5084 | return gl::error(GL_INVALID_ENUM); |
| 5085 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5086 | } |
| 5087 | } |
| 5088 | |
| 5089 | void __stdcall glGenQueries(GLsizei n, GLuint* ids) |
| 5090 | { |
| 5091 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 5092 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5093 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5094 | |
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 | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5099 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5100 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5101 | |
| 5102 | if (n < 0) |
| 5103 | { |
| 5104 | return gl::error(GL_INVALID_VALUE); |
| 5105 | } |
| 5106 | |
| 5107 | for (GLsizei i = 0; i < n; i++) |
| 5108 | { |
| 5109 | ids[i] = context->createQuery(); |
| 5110 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5111 | } |
| 5112 | } |
| 5113 | |
| 5114 | void __stdcall glDeleteQueries(GLsizei n, const GLuint* ids) |
| 5115 | { |
| 5116 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 5117 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5118 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5119 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5120 | if (context) |
| 5121 | { |
| 5122 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5123 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5124 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5125 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5126 | |
| 5127 | if (n < 0) |
| 5128 | { |
| 5129 | return gl::error(GL_INVALID_VALUE); |
| 5130 | } |
| 5131 | |
| 5132 | for (GLsizei i = 0; i < n; i++) |
| 5133 | { |
| 5134 | context->deleteQuery(ids[i]); |
| 5135 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5136 | } |
| 5137 | } |
| 5138 | |
| 5139 | GLboolean __stdcall glIsQuery(GLuint id) |
| 5140 | { |
| 5141 | EVENT("(GLuint id = %u)", id); |
| 5142 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5143 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5144 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5145 | if (context) |
| 5146 | { |
| 5147 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5148 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5149 | return gl::error(GL_INVALID_OPERATION, GL_FALSE); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5150 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5151 | |
| 5152 | 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] | 5153 | } |
| 5154 | |
| 5155 | return GL_FALSE; |
| 5156 | } |
| 5157 | |
| 5158 | void __stdcall glBeginQuery(GLenum target, GLuint id) |
| 5159 | { |
| 5160 | EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id); |
| 5161 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5162 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5163 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5164 | if (context) |
| 5165 | { |
| 5166 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5167 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5168 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5169 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5170 | |
| 5171 | if (!ValidateBeginQuery(context, target, id)) |
| 5172 | { |
| 5173 | return; |
| 5174 | } |
| 5175 | context->beginQuery(target, id); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5176 | } |
| 5177 | } |
| 5178 | |
| 5179 | void __stdcall glEndQuery(GLenum target) |
| 5180 | { |
| 5181 | EVENT("(GLenum target = 0x%X)", target); |
| 5182 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5183 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5184 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5185 | if (context) |
| 5186 | { |
| 5187 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5188 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5189 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5190 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5191 | |
| 5192 | if (!ValidateEndQuery(context, target)) |
| 5193 | { |
| 5194 | return; |
| 5195 | } |
| 5196 | |
| 5197 | context->endQuery(target); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5198 | } |
| 5199 | } |
| 5200 | |
| 5201 | void __stdcall glGetQueryiv(GLenum target, GLenum pname, GLint* params) |
| 5202 | { |
| 5203 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params); |
| 5204 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5205 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5206 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5207 | if (context) |
| 5208 | { |
| 5209 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5210 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5211 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5212 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5213 | |
| 5214 | if (!ValidQueryType(context, target)) |
| 5215 | { |
| 5216 | return gl::error(GL_INVALID_ENUM); |
| 5217 | } |
| 5218 | |
| 5219 | switch (pname) |
| 5220 | { |
| 5221 | case GL_CURRENT_QUERY: |
| 5222 | params[0] = static_cast<GLint>(context->getState().getActiveQueryId(target)); |
| 5223 | break; |
| 5224 | |
| 5225 | default: |
| 5226 | return gl::error(GL_INVALID_ENUM); |
| 5227 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5228 | } |
| 5229 | } |
| 5230 | |
| 5231 | void __stdcall glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) |
| 5232 | { |
| 5233 | EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", id, pname, params); |
| 5234 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5235 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5236 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5237 | if (context) |
| 5238 | { |
| 5239 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5240 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5241 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5242 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5243 | |
| 5244 | gl::Query *queryObject = context->getQuery(id, false, GL_NONE); |
| 5245 | |
| 5246 | if (!queryObject) |
| 5247 | { |
| 5248 | return gl::error(GL_INVALID_OPERATION); |
| 5249 | } |
| 5250 | |
| 5251 | if (context->getState().getActiveQueryId(queryObject->getType()) == id) |
| 5252 | { |
| 5253 | return gl::error(GL_INVALID_OPERATION); |
| 5254 | } |
| 5255 | |
| 5256 | switch(pname) |
| 5257 | { |
| 5258 | case GL_QUERY_RESULT: |
| 5259 | params[0] = queryObject->getResult(); |
| 5260 | break; |
| 5261 | case GL_QUERY_RESULT_AVAILABLE: |
| 5262 | params[0] = queryObject->isResultAvailable(); |
| 5263 | break; |
| 5264 | default: |
| 5265 | return gl::error(GL_INVALID_ENUM); |
| 5266 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5267 | } |
| 5268 | } |
| 5269 | |
| 5270 | GLboolean __stdcall glUnmapBuffer(GLenum target) |
| 5271 | { |
| 5272 | EVENT("(GLenum target = 0x%X)", target); |
| 5273 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5274 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5275 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5276 | if (context) |
| 5277 | { |
| 5278 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5279 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5280 | return gl::error(GL_INVALID_OPERATION, GL_FALSE); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5281 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5282 | |
| 5283 | return glUnmapBufferOES(target); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5284 | } |
| 5285 | |
| 5286 | return GL_FALSE; |
| 5287 | } |
| 5288 | |
| 5289 | void __stdcall glGetBufferPointerv(GLenum target, GLenum pname, GLvoid** params) |
| 5290 | { |
| 5291 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params); |
| 5292 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5293 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5294 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5295 | if (context) |
| 5296 | { |
| 5297 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5298 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5299 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5300 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5301 | |
| 5302 | glGetBufferPointervOES(target, pname, params); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5303 | } |
| 5304 | } |
| 5305 | |
| 5306 | void __stdcall glDrawBuffers(GLsizei n, const GLenum* bufs) |
| 5307 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5308 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5309 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5310 | if (context) |
| 5311 | { |
| 5312 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5313 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5314 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | 7948c5f | 2013-04-13 03:38:58 +0000 | [diff] [blame] | 5315 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5316 | |
| 5317 | glDrawBuffersEXT(n, bufs); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5318 | } |
| 5319 | } |
| 5320 | |
| 5321 | void __stdcall glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 5322 | { |
| 5323 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5324 | location, count, transpose, value); |
| 5325 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5326 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5327 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5328 | if (context) |
| 5329 | { |
| 5330 | 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] | 5331 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5332 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5333 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5334 | |
| 5335 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5336 | programBinary->setUniformMatrix2x3fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5337 | } |
| 5338 | } |
| 5339 | |
| 5340 | void __stdcall glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 5341 | { |
| 5342 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5343 | location, count, transpose, value); |
| 5344 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5345 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5346 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5347 | if (context) |
| 5348 | { |
| 5349 | 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] | 5350 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5351 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5352 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5353 | |
| 5354 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5355 | programBinary->setUniformMatrix3x2fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5356 | } |
| 5357 | } |
| 5358 | |
| 5359 | void __stdcall glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 5360 | { |
| 5361 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5362 | location, count, transpose, value); |
| 5363 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5364 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5365 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5366 | if (context) |
| 5367 | { |
| 5368 | 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] | 5369 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5370 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5371 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5372 | |
| 5373 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5374 | programBinary->setUniformMatrix2x4fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5375 | } |
| 5376 | } |
| 5377 | |
| 5378 | void __stdcall glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 5379 | { |
| 5380 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5381 | location, count, transpose, value); |
| 5382 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5383 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5384 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5385 | if (context) |
| 5386 | { |
| 5387 | 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] | 5388 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5389 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5390 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5391 | |
| 5392 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5393 | programBinary->setUniformMatrix4x2fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5394 | } |
| 5395 | } |
| 5396 | |
| 5397 | void __stdcall glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 5398 | { |
| 5399 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5400 | location, count, transpose, value); |
| 5401 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5402 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5403 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5404 | if (context) |
| 5405 | { |
| 5406 | 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] | 5407 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5408 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5409 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5410 | |
| 5411 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5412 | programBinary->setUniformMatrix3x4fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5413 | } |
| 5414 | } |
| 5415 | |
| 5416 | void __stdcall glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 5417 | { |
| 5418 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5419 | location, count, transpose, value); |
| 5420 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5421 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5422 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5423 | if (context) |
| 5424 | { |
| 5425 | 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] | 5426 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5427 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5428 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5429 | |
| 5430 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5431 | programBinary->setUniformMatrix4x3fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5432 | } |
| 5433 | } |
| 5434 | |
| 5435 | void __stdcall glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) |
| 5436 | { |
| 5437 | EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, GLint dstX0 = %d, " |
| 5438 | "GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, GLbitfield mask = 0x%X, GLenum filter = 0x%X)", |
| 5439 | srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 5440 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5441 | gl::Context *context = gl::getNonLostContext(); |
| 5442 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5443 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5444 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5445 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5446 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5447 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5448 | |
| 5449 | if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, |
| 5450 | dstX0, dstY0, dstX1, dstY1, mask, filter, |
| 5451 | false)) |
| 5452 | { |
| 5453 | return; |
| 5454 | } |
| 5455 | |
| 5456 | context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, |
| 5457 | mask, filter); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5458 | } |
| 5459 | } |
| 5460 | |
| 5461 | void __stdcall glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) |
| 5462 | { |
| 5463 | EVENT("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 5464 | target, samples, internalformat, width, height); |
| 5465 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5466 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5467 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5468 | if (context) |
| 5469 | { |
| 5470 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5471 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5472 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5473 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5474 | |
| 5475 | if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat, |
| 5476 | width, height, false)) |
| 5477 | { |
| 5478 | return; |
| 5479 | } |
| 5480 | |
| 5481 | context->setRenderbufferStorage(width, height, internalformat, samples); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5482 | } |
| 5483 | } |
| 5484 | |
| 5485 | void __stdcall glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) |
| 5486 | { |
| 5487 | EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d, GLint layer = %d)", |
| 5488 | target, attachment, texture, level, layer); |
| 5489 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5490 | gl::Context *context = gl::getNonLostContext(); |
| 5491 | |
| 5492 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5493 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5494 | if (!ValidateFramebufferTextureLayer(context, target, attachment, texture, |
| 5495 | level, layer)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5496 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5497 | return; |
| 5498 | } |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5499 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5500 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 5501 | ASSERT(framebuffer); |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5502 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5503 | gl::Texture *textureObject = context->getTexture(texture); |
| 5504 | GLenum textarget = textureObject ? textureObject->getTarget() : GL_NONE; |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5505 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5506 | if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT) |
| 5507 | { |
| 5508 | const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT); |
| 5509 | framebuffer->setColorbuffer(colorAttachment, textarget, texture, level, layer); |
| 5510 | } |
| 5511 | else |
| 5512 | { |
| 5513 | switch (attachment) |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5514 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5515 | case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level, layer); break; |
| 5516 | case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level, layer); break; |
| 5517 | case GL_DEPTH_STENCIL_ATTACHMENT: framebuffer->setDepthStencilBuffer(textarget, texture, level, layer); break; |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5518 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5519 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5520 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5521 | } |
| 5522 | |
| 5523 | GLvoid* __stdcall glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) |
| 5524 | { |
| 5525 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)", |
| 5526 | target, offset, length, access); |
| 5527 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5528 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5529 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5530 | if (context) |
| 5531 | { |
| 5532 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5533 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5534 | return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL)); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5535 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5536 | |
| 5537 | return glMapBufferRangeEXT(target, offset, length, access); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5538 | } |
| 5539 | |
| 5540 | return NULL; |
| 5541 | } |
| 5542 | |
| 5543 | void __stdcall glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) |
| 5544 | { |
| 5545 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length); |
| 5546 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5547 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5548 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5549 | if (context) |
| 5550 | { |
| 5551 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5552 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5553 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5554 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5555 | |
| 5556 | glFlushMappedBufferRangeEXT(target, offset, length); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5557 | } |
| 5558 | } |
| 5559 | |
| 5560 | void __stdcall glBindVertexArray(GLuint array) |
| 5561 | { |
| 5562 | EVENT("(GLuint array = %u)", array); |
| 5563 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5564 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5565 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5566 | if (context) |
| 5567 | { |
| 5568 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5569 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5570 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5571 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5572 | |
| 5573 | gl::VertexArray *vao = context->getVertexArray(array); |
| 5574 | |
| 5575 | if (!vao) |
| 5576 | { |
| 5577 | // The default VAO should always exist |
| 5578 | ASSERT(array != 0); |
| 5579 | return gl::error(GL_INVALID_OPERATION); |
| 5580 | } |
| 5581 | |
| 5582 | context->bindVertexArray(array); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5583 | } |
| 5584 | } |
| 5585 | |
| 5586 | void __stdcall glDeleteVertexArrays(GLsizei n, const GLuint* arrays) |
| 5587 | { |
| 5588 | EVENT("(GLsizei n = %d, const GLuint* arrays = 0x%0.8p)", n, arrays); |
| 5589 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5590 | gl::Context *context = gl::getNonLostContext(); |
| 5591 | |
| 5592 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5593 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5594 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5595 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5596 | return gl::error(GL_INVALID_OPERATION); |
| 5597 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5598 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5599 | if (n < 0) |
| 5600 | { |
| 5601 | return gl::error(GL_INVALID_VALUE); |
| 5602 | } |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5603 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5604 | for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) |
| 5605 | { |
| 5606 | if (arrays[arrayIndex] != 0) |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5607 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5608 | context->deleteVertexArray(arrays[arrayIndex]); |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5609 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5610 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5611 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5612 | } |
| 5613 | |
| 5614 | void __stdcall glGenVertexArrays(GLsizei n, GLuint* arrays) |
| 5615 | { |
| 5616 | EVENT("(GLsizei n = %d, GLuint* arrays = 0x%0.8p)", n, arrays); |
| 5617 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5618 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5619 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5620 | if (context) |
| 5621 | { |
| 5622 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5623 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5624 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5625 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5626 | |
| 5627 | if (n < 0) |
| 5628 | { |
| 5629 | return gl::error(GL_INVALID_VALUE); |
| 5630 | } |
| 5631 | |
| 5632 | for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) |
| 5633 | { |
| 5634 | arrays[arrayIndex] = context->createVertexArray(); |
| 5635 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5636 | } |
| 5637 | } |
| 5638 | |
| 5639 | GLboolean __stdcall glIsVertexArray(GLuint array) |
| 5640 | { |
| 5641 | EVENT("(GLuint array = %u)", array); |
| 5642 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5643 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5644 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5645 | if (context) |
| 5646 | { |
| 5647 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5648 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5649 | return gl::error(GL_INVALID_OPERATION, GL_FALSE); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5650 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5651 | |
| 5652 | if (array == 0) |
| 5653 | { |
| 5654 | return GL_FALSE; |
| 5655 | } |
| 5656 | |
| 5657 | gl::VertexArray *vao = context->getVertexArray(array); |
| 5658 | |
| 5659 | return (vao != NULL ? GL_TRUE : GL_FALSE); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5660 | } |
| 5661 | |
| 5662 | return GL_FALSE; |
| 5663 | } |
| 5664 | |
| 5665 | void __stdcall glGetIntegeri_v(GLenum target, GLuint index, GLint* data) |
| 5666 | { |
| 5667 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint* data = 0x%0.8p)", |
| 5668 | target, index, data); |
| 5669 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5670 | gl::Context *context = gl::getNonLostContext(); |
| 5671 | |
| 5672 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5673 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5674 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5675 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5676 | return gl::error(GL_INVALID_OPERATION); |
| 5677 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5678 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5679 | switch (target) |
| 5680 | { |
| 5681 | case GL_TRANSFORM_FEEDBACK_BUFFER_START: |
| 5682 | case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: |
| 5683 | case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: |
| 5684 | if (index >= context->getMaxTransformFeedbackBufferBindings()) |
| 5685 | return gl::error(GL_INVALID_VALUE); |
| 5686 | break; |
| 5687 | case GL_UNIFORM_BUFFER_START: |
| 5688 | case GL_UNIFORM_BUFFER_SIZE: |
| 5689 | case GL_UNIFORM_BUFFER_BINDING: |
| 5690 | if (index >= context->getMaximumCombinedUniformBufferBindings()) |
| 5691 | return gl::error(GL_INVALID_VALUE); |
| 5692 | break; |
| 5693 | default: |
| 5694 | return gl::error(GL_INVALID_ENUM); |
| 5695 | } |
| 5696 | |
| 5697 | if (!(context->getIndexedIntegerv(target, index, data))) |
| 5698 | { |
| 5699 | GLenum nativeType; |
| 5700 | unsigned int numParams = 0; |
| 5701 | if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams)) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 5702 | return gl::error(GL_INVALID_ENUM); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 5703 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5704 | if (numParams == 0) |
| 5705 | return; // it is known that pname is valid, but there are no parameters to return |
| 5706 | |
| 5707 | if (nativeType == GL_INT_64_ANGLEX) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 5708 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5709 | GLint64 minIntValue = static_cast<GLint64>(std::numeric_limits<int>::min()); |
| 5710 | GLint64 maxIntValue = static_cast<GLint64>(std::numeric_limits<int>::max()); |
| 5711 | GLint64 *int64Params = new GLint64[numParams]; |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 5712 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5713 | context->getIndexedInteger64v(target, index, int64Params); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 5714 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5715 | for (unsigned int i = 0; i < numParams; ++i) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 5716 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5717 | GLint64 clampedValue = std::max(std::min(int64Params[i], maxIntValue), minIntValue); |
| 5718 | data[i] = static_cast<GLint>(clampedValue); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 5719 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5720 | |
| 5721 | delete [] int64Params; |
| 5722 | } |
| 5723 | else |
| 5724 | { |
| 5725 | UNREACHABLE(); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 5726 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5727 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5728 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5729 | } |
| 5730 | |
| 5731 | void __stdcall glBeginTransformFeedback(GLenum primitiveMode) |
| 5732 | { |
| 5733 | EVENT("(GLenum primitiveMode = 0x%X)", primitiveMode); |
| 5734 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5735 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5736 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5737 | if (context) |
| 5738 | { |
| 5739 | if (context->getClientVersion() < 3) |
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 gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5742 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5743 | |
| 5744 | switch (primitiveMode) |
| 5745 | { |
| 5746 | case GL_TRIANGLES: |
| 5747 | case GL_LINES: |
| 5748 | case GL_POINTS: |
| 5749 | break; |
| 5750 | default: |
| 5751 | return gl::error(GL_INVALID_ENUM); |
| 5752 | } |
| 5753 | |
| 5754 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 5755 | ASSERT(transformFeedback != NULL); |
| 5756 | |
| 5757 | if (transformFeedback->isStarted()) |
| 5758 | { |
| 5759 | return gl::error(GL_INVALID_OPERATION); |
| 5760 | } |
| 5761 | |
| 5762 | if (transformFeedback->isPaused()) |
| 5763 | { |
| 5764 | transformFeedback->resume(); |
| 5765 | } |
| 5766 | else |
| 5767 | { |
| 5768 | transformFeedback->start(primitiveMode); |
| 5769 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5770 | } |
| 5771 | } |
| 5772 | |
| 5773 | void __stdcall glEndTransformFeedback(void) |
| 5774 | { |
| 5775 | EVENT("(void)"); |
| 5776 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5777 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5778 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5779 | if (context) |
| 5780 | { |
| 5781 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5782 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5783 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5784 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5785 | |
| 5786 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 5787 | ASSERT(transformFeedback != NULL); |
| 5788 | |
| 5789 | if (!transformFeedback->isStarted()) |
| 5790 | { |
| 5791 | return gl::error(GL_INVALID_OPERATION); |
| 5792 | } |
| 5793 | |
| 5794 | transformFeedback->stop(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5795 | } |
| 5796 | } |
| 5797 | |
| 5798 | void __stdcall glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) |
| 5799 | { |
| 5800 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u, GLintptr offset = %d, GLsizeiptr size = %d)", |
| 5801 | target, index, buffer, offset, size); |
| 5802 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5803 | gl::Context *context = gl::getNonLostContext(); |
| 5804 | |
| 5805 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5806 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5807 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5808 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5809 | return gl::error(GL_INVALID_OPERATION); |
| 5810 | } |
| 5811 | |
| 5812 | switch (target) |
| 5813 | { |
| 5814 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 5815 | if (index >= context->getMaxTransformFeedbackBufferBindings()) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5816 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5817 | return gl::error(GL_INVALID_VALUE); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5818 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5819 | break; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5820 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5821 | case GL_UNIFORM_BUFFER: |
| 5822 | if (index >= context->getMaximumCombinedUniformBufferBindings()) |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 5823 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5824 | return gl::error(GL_INVALID_VALUE); |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 5825 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5826 | break; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 5827 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5828 | default: |
| 5829 | return gl::error(GL_INVALID_ENUM); |
| 5830 | } |
| 5831 | |
| 5832 | if (buffer != 0 && size <= 0) |
| 5833 | { |
| 5834 | return gl::error(GL_INVALID_VALUE); |
| 5835 | } |
| 5836 | |
| 5837 | switch (target) |
| 5838 | { |
| 5839 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 5840 | |
| 5841 | // size and offset must be a multiple of 4 |
| 5842 | 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] | 5843 | { |
| 5844 | return gl::error(GL_INVALID_VALUE); |
| 5845 | } |
| 5846 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5847 | context->bindIndexedTransformFeedbackBuffer(buffer, index, offset, size); |
| 5848 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 5849 | break; |
| 5850 | |
| 5851 | case GL_UNIFORM_BUFFER: |
| 5852 | |
| 5853 | // it is an error to bind an offset not a multiple of the alignment |
| 5854 | if (buffer != 0 && (offset % context->getUniformBufferOffsetAlignment()) != 0) |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 5855 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5856 | return gl::error(GL_INVALID_VALUE); |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 5857 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5858 | |
| 5859 | context->bindIndexedUniformBuffer(buffer, index, offset, size); |
| 5860 | context->bindGenericUniformBuffer(buffer); |
| 5861 | break; |
| 5862 | |
| 5863 | default: |
| 5864 | UNREACHABLE(); |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 5865 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5866 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5867 | } |
| 5868 | |
| 5869 | void __stdcall glBindBufferBase(GLenum target, GLuint index, GLuint buffer) |
| 5870 | { |
| 5871 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u)", |
| 5872 | target, index, buffer); |
| 5873 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5874 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5875 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5876 | if (context) |
| 5877 | { |
| 5878 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5879 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5880 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 5881 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5882 | |
| 5883 | switch (target) |
| 5884 | { |
| 5885 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 5886 | if (index >= context->getMaxTransformFeedbackBufferBindings()) |
| 5887 | { |
| 5888 | return gl::error(GL_INVALID_VALUE); |
| 5889 | } |
| 5890 | break; |
| 5891 | |
| 5892 | case GL_UNIFORM_BUFFER: |
| 5893 | if (index >= context->getMaximumCombinedUniformBufferBindings()) |
| 5894 | { |
| 5895 | return gl::error(GL_INVALID_VALUE); |
| 5896 | } |
| 5897 | break; |
| 5898 | |
| 5899 | default: |
| 5900 | return gl::error(GL_INVALID_ENUM); |
| 5901 | } |
| 5902 | |
| 5903 | switch (target) |
| 5904 | { |
| 5905 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 5906 | context->bindIndexedTransformFeedbackBuffer(buffer, index, 0, 0); |
| 5907 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 5908 | break; |
| 5909 | |
| 5910 | case GL_UNIFORM_BUFFER: |
| 5911 | context->bindIndexedUniformBuffer(buffer, index, 0, 0); |
| 5912 | context->bindGenericUniformBuffer(buffer); |
| 5913 | break; |
| 5914 | |
| 5915 | default: |
| 5916 | UNREACHABLE(); |
| 5917 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5918 | } |
| 5919 | } |
| 5920 | |
| 5921 | void __stdcall glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode) |
| 5922 | { |
| 5923 | EVENT("(GLuint program = %u, GLsizei count = %d, const GLchar* const* varyings = 0x%0.8p, GLenum bufferMode = 0x%X)", |
| 5924 | program, count, varyings, bufferMode); |
| 5925 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5926 | gl::Context *context = gl::getNonLostContext(); |
| 5927 | |
| 5928 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5929 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5930 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5931 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5932 | return gl::error(GL_INVALID_OPERATION); |
| 5933 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5934 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5935 | if (count < 0) |
| 5936 | { |
| 5937 | return gl::error(GL_INVALID_VALUE); |
| 5938 | } |
| 5939 | |
| 5940 | switch (bufferMode) |
| 5941 | { |
| 5942 | case GL_INTERLEAVED_ATTRIBS: |
| 5943 | break; |
| 5944 | case GL_SEPARATE_ATTRIBS: |
| 5945 | if (static_cast<GLuint>(count) > context->getMaxTransformFeedbackBufferBindings()) |
Geoff Lang | 48dcae7 | 2014-02-05 16:28:24 -0500 | [diff] [blame] | 5946 | { |
| 5947 | return gl::error(GL_INVALID_VALUE); |
| 5948 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5949 | break; |
| 5950 | default: |
| 5951 | return gl::error(GL_INVALID_ENUM); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5952 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5953 | |
| 5954 | if (!gl::ValidProgram(context, program)) |
| 5955 | { |
| 5956 | return; |
| 5957 | } |
| 5958 | |
| 5959 | gl::Program *programObject = context->getProgram(program); |
| 5960 | ASSERT(programObject); |
| 5961 | |
| 5962 | programObject->setTransformFeedbackVaryings(count, varyings, bufferMode); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5963 | } |
| 5964 | } |
| 5965 | |
| 5966 | void __stdcall glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name) |
| 5967 | { |
| 5968 | EVENT("(GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, " |
| 5969 | "GLsizei* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)", |
| 5970 | program, index, bufSize, length, size, type, name); |
| 5971 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5972 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5973 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5974 | if (context) |
| 5975 | { |
| 5976 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5977 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5978 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5979 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5980 | |
| 5981 | if (bufSize < 0) |
| 5982 | { |
| 5983 | return gl::error(GL_INVALID_VALUE); |
| 5984 | } |
| 5985 | |
| 5986 | if (!gl::ValidProgram(context, program)) |
| 5987 | { |
| 5988 | return; |
| 5989 | } |
| 5990 | |
| 5991 | gl::Program *programObject = context->getProgram(program); |
| 5992 | ASSERT(programObject); |
| 5993 | |
| 5994 | if (index >= static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount())) |
| 5995 | { |
| 5996 | return gl::error(GL_INVALID_VALUE); |
| 5997 | } |
| 5998 | |
| 5999 | programObject->getTransformFeedbackVarying(index, bufSize, length, size, type, name); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6000 | } |
| 6001 | } |
| 6002 | |
| 6003 | void __stdcall glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) |
| 6004 | { |
| 6005 | EVENT("(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid* pointer = 0x%0.8p)", |
| 6006 | index, size, type, stride, pointer); |
| 6007 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6008 | gl::Context *context = gl::getNonLostContext(); |
| 6009 | |
| 6010 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6011 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6012 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6013 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6014 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6015 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6016 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6017 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6018 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6019 | { |
| 6020 | return gl::error(GL_INVALID_VALUE); |
| 6021 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6022 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6023 | if (size < 1 || size > 4) |
| 6024 | { |
| 6025 | return gl::error(GL_INVALID_VALUE); |
| 6026 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6027 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6028 | switch (type) |
| 6029 | { |
| 6030 | case GL_BYTE: |
| 6031 | case GL_UNSIGNED_BYTE: |
| 6032 | case GL_SHORT: |
| 6033 | case GL_UNSIGNED_SHORT: |
| 6034 | case GL_INT: |
| 6035 | case GL_UNSIGNED_INT: |
| 6036 | case GL_INT_2_10_10_10_REV: |
| 6037 | case GL_UNSIGNED_INT_2_10_10_10_REV: |
| 6038 | break; |
| 6039 | default: |
| 6040 | return gl::error(GL_INVALID_ENUM); |
| 6041 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6042 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6043 | if (stride < 0) |
| 6044 | { |
| 6045 | return gl::error(GL_INVALID_VALUE); |
| 6046 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6047 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6048 | if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4) |
| 6049 | { |
| 6050 | return gl::error(GL_INVALID_OPERATION); |
| 6051 | } |
| 6052 | |
| 6053 | if (context) |
| 6054 | { |
| 6055 | // [OpenGL ES 3.0.2] Section 2.8 page 24: |
| 6056 | // An INVALID_OPERATION error is generated when a non-zero vertex array object |
| 6057 | // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point, |
| 6058 | // and the pointer argument is not NULL. |
| 6059 | 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] | 6060 | { |
| 6061 | return gl::error(GL_INVALID_OPERATION); |
| 6062 | } |
| 6063 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6064 | context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type, false, true, |
| 6065 | stride, pointer); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6066 | } |
| 6067 | } |
| 6068 | |
| 6069 | void __stdcall glGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) |
| 6070 | { |
| 6071 | EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 6072 | index, pname, params); |
| 6073 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6074 | gl::Context *context = gl::getNonLostContext(); |
| 6075 | |
| 6076 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6077 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6078 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6079 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6080 | return gl::error(GL_INVALID_OPERATION); |
| 6081 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6082 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6083 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6084 | { |
| 6085 | return gl::error(GL_INVALID_VALUE); |
| 6086 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6087 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6088 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6089 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6090 | if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion())) |
| 6091 | { |
| 6092 | return; |
| 6093 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6094 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6095 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 6096 | { |
| 6097 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 6098 | for (int i = 0; i < 4; ++i) |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6099 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6100 | params[i] = currentValueData.IntValues[i]; |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6101 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6102 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6103 | else |
| 6104 | { |
| 6105 | *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname); |
| 6106 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6107 | } |
| 6108 | } |
| 6109 | |
| 6110 | void __stdcall glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) |
| 6111 | { |
| 6112 | EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLuint* params = 0x%0.8p)", |
| 6113 | index, pname, params); |
| 6114 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6115 | gl::Context *context = gl::getNonLostContext(); |
| 6116 | |
| 6117 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6118 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6119 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6120 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6121 | return gl::error(GL_INVALID_OPERATION); |
| 6122 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6123 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6124 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6125 | { |
| 6126 | return gl::error(GL_INVALID_VALUE); |
| 6127 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6128 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6129 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6130 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6131 | if (!gl::ValidateGetVertexAttribParameters(pname, context->getClientVersion())) |
| 6132 | { |
| 6133 | return; |
| 6134 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6135 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6136 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 6137 | { |
| 6138 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 6139 | for (int i = 0; i < 4; ++i) |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6140 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6141 | params[i] = currentValueData.UnsignedIntValues[i]; |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6142 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6143 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6144 | else |
| 6145 | { |
| 6146 | *params = gl::QuerySingleVertexAttributeParameter<GLuint>(attribState, pname); |
| 6147 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6148 | } |
| 6149 | } |
| 6150 | |
| 6151 | void __stdcall glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) |
| 6152 | { |
| 6153 | EVENT("(GLuint index = %u, GLint x = %d, GLint y = %d, GLint z = %d, GLint w = %d)", |
| 6154 | index, x, y, z, w); |
| 6155 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6156 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6157 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6158 | if (context) |
| 6159 | { |
| 6160 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6161 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6162 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6163 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6164 | |
| 6165 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6166 | { |
| 6167 | return gl::error(GL_INVALID_VALUE); |
| 6168 | } |
| 6169 | |
| 6170 | GLint vals[4] = { x, y, z, w }; |
| 6171 | context->getState().setVertexAttribi(index, vals); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6172 | } |
| 6173 | } |
| 6174 | |
| 6175 | void __stdcall glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) |
| 6176 | { |
| 6177 | EVENT("(GLuint index = %u, GLuint x = %u, GLuint y = %u, GLuint z = %u, GLuint w = %u)", |
| 6178 | index, x, y, z, w); |
| 6179 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6180 | gl::Context *context = gl::getNonLostContext(); |
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 | if (context) |
| 6183 | { |
| 6184 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6185 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6186 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6187 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6188 | |
| 6189 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6190 | { |
| 6191 | return gl::error(GL_INVALID_VALUE); |
| 6192 | } |
| 6193 | |
| 6194 | GLuint vals[4] = { x, y, z, w }; |
| 6195 | context->getState().setVertexAttribu(index, vals); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6196 | } |
| 6197 | } |
| 6198 | |
| 6199 | void __stdcall glVertexAttribI4iv(GLuint index, const GLint* v) |
| 6200 | { |
| 6201 | EVENT("(GLuint index = %u, const GLint* v = 0x%0.8p)", index, v); |
| 6202 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6203 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6204 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6205 | if (context) |
| 6206 | { |
| 6207 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6208 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6209 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6210 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6211 | |
| 6212 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6213 | { |
| 6214 | return gl::error(GL_INVALID_VALUE); |
| 6215 | } |
| 6216 | |
| 6217 | context->getState().setVertexAttribi(index, v); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6218 | } |
| 6219 | } |
| 6220 | |
| 6221 | void __stdcall glVertexAttribI4uiv(GLuint index, const GLuint* v) |
| 6222 | { |
| 6223 | EVENT("(GLuint index = %u, const GLuint* v = 0x%0.8p)", index, v); |
| 6224 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6225 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6226 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6227 | if (context) |
| 6228 | { |
| 6229 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6230 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6231 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6232 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6233 | |
| 6234 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6235 | { |
| 6236 | return gl::error(GL_INVALID_VALUE); |
| 6237 | } |
| 6238 | |
| 6239 | context->getState().setVertexAttribu(index, v); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6240 | } |
| 6241 | } |
| 6242 | |
| 6243 | void __stdcall glGetUniformuiv(GLuint program, GLint location, GLuint* params) |
| 6244 | { |
| 6245 | EVENT("(GLuint program = %u, GLint location = %d, GLuint* params = 0x%0.8p)", |
| 6246 | program, location, params); |
| 6247 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6248 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6249 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6250 | if (context) |
| 6251 | { |
| 6252 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6253 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6254 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | e229012 | 2013-04-13 03:41:07 +0000 | [diff] [blame] | 6255 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6256 | |
| 6257 | if (program == 0) |
| 6258 | { |
| 6259 | return gl::error(GL_INVALID_VALUE); |
| 6260 | } |
| 6261 | |
| 6262 | gl::Program *programObject = context->getProgram(program); |
| 6263 | |
| 6264 | if (!programObject || !programObject->isLinked()) |
| 6265 | { |
| 6266 | return gl::error(GL_INVALID_OPERATION); |
| 6267 | } |
| 6268 | |
| 6269 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 6270 | if (!programBinary) |
| 6271 | { |
| 6272 | return gl::error(GL_INVALID_OPERATION); |
| 6273 | } |
| 6274 | |
| 6275 | if (!programBinary->getUniformuiv(location, NULL, params)) |
| 6276 | { |
| 6277 | return gl::error(GL_INVALID_OPERATION); |
| 6278 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6279 | } |
| 6280 | } |
| 6281 | |
| 6282 | GLint __stdcall glGetFragDataLocation(GLuint program, const GLchar *name) |
| 6283 | { |
| 6284 | EVENT("(GLuint program = %u, const GLchar *name = 0x%0.8p)", |
| 6285 | program, name); |
| 6286 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6287 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6288 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6289 | if (context) |
| 6290 | { |
| 6291 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6292 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6293 | return gl::error(GL_INVALID_OPERATION, -1); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6294 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6295 | |
| 6296 | if (program == 0) |
| 6297 | { |
| 6298 | return gl::error(GL_INVALID_VALUE, -1); |
| 6299 | } |
| 6300 | |
| 6301 | gl::Program *programObject = context->getProgram(program); |
| 6302 | |
| 6303 | if (!programObject || !programObject->isLinked()) |
| 6304 | { |
| 6305 | return gl::error(GL_INVALID_OPERATION, -1); |
| 6306 | } |
| 6307 | |
| 6308 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 6309 | if (!programBinary) |
| 6310 | { |
| 6311 | return gl::error(GL_INVALID_OPERATION, -1); |
| 6312 | } |
| 6313 | |
| 6314 | return programBinary->getFragDataLocation(name); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6315 | } |
| 6316 | |
| 6317 | return 0; |
| 6318 | } |
| 6319 | |
| 6320 | void __stdcall glUniform1ui(GLint location, GLuint v0) |
| 6321 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6322 | glUniform1uiv(location, 1, &v0); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6323 | } |
| 6324 | |
| 6325 | void __stdcall glUniform2ui(GLint location, GLuint v0, GLuint v1) |
| 6326 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6327 | const GLuint xy[] = { v0, v1 }; |
| 6328 | glUniform2uiv(location, 1, xy); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6329 | } |
| 6330 | |
| 6331 | void __stdcall glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) |
| 6332 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6333 | const GLuint xyz[] = { v0, v1, v2 }; |
| 6334 | glUniform3uiv(location, 1, xyz); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6335 | } |
| 6336 | |
| 6337 | void __stdcall glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) |
| 6338 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6339 | const GLuint xyzw[] = { v0, v1, v2, v3 }; |
| 6340 | glUniform4uiv(location, 1, xyzw); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6341 | } |
| 6342 | |
| 6343 | void __stdcall glUniform1uiv(GLint location, GLsizei count, const GLuint* value) |
| 6344 | { |
| 6345 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6346 | location, count, value); |
| 6347 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6348 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6349 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6350 | if (context) |
| 6351 | { |
| 6352 | if (!ValidateUniform(context, GL_UNSIGNED_INT, location, count)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6353 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6354 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6355 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6356 | |
| 6357 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6358 | programBinary->setUniform1uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6359 | } |
| 6360 | } |
| 6361 | |
| 6362 | void __stdcall glUniform2uiv(GLint location, GLsizei count, const GLuint* value) |
| 6363 | { |
| 6364 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6365 | location, count, value); |
| 6366 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6367 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6368 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6369 | if (context) |
| 6370 | { |
| 6371 | 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] | 6372 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6373 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6374 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6375 | |
| 6376 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6377 | programBinary->setUniform2uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6378 | } |
| 6379 | } |
| 6380 | |
| 6381 | void __stdcall glUniform3uiv(GLint location, GLsizei count, const GLuint* value) |
| 6382 | { |
| 6383 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value)", |
| 6384 | location, count, value); |
| 6385 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6386 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6387 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6388 | if (context) |
| 6389 | { |
| 6390 | 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] | 6391 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6392 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6393 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6394 | |
| 6395 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6396 | programBinary->setUniform3uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6397 | } |
| 6398 | } |
| 6399 | |
| 6400 | void __stdcall glUniform4uiv(GLint location, GLsizei count, const GLuint* value) |
| 6401 | { |
| 6402 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6403 | location, count, value); |
| 6404 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6405 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6406 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6407 | if (context) |
| 6408 | { |
| 6409 | 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] | 6410 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6411 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6412 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6413 | |
| 6414 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6415 | programBinary->setUniform4uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6416 | } |
| 6417 | } |
| 6418 | |
| 6419 | void __stdcall glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value) |
| 6420 | { |
| 6421 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint* value = 0x%0.8p)", |
| 6422 | buffer, drawbuffer, value); |
| 6423 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6424 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6425 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6426 | if (context) |
| 6427 | { |
| 6428 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6429 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6430 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6431 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6432 | |
| 6433 | switch (buffer) |
| 6434 | { |
| 6435 | case GL_COLOR: |
| 6436 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6437 | { |
| 6438 | return gl::error(GL_INVALID_VALUE); |
| 6439 | } |
| 6440 | break; |
| 6441 | case GL_STENCIL: |
| 6442 | if (drawbuffer != 0) |
| 6443 | { |
| 6444 | return gl::error(GL_INVALID_VALUE); |
| 6445 | } |
| 6446 | break; |
| 6447 | default: |
| 6448 | return gl::error(GL_INVALID_ENUM); |
| 6449 | } |
| 6450 | |
| 6451 | context->clearBufferiv(buffer, drawbuffer, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6452 | } |
| 6453 | } |
| 6454 | |
| 6455 | void __stdcall glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value) |
| 6456 | { |
| 6457 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint* value = 0x%0.8p)", |
| 6458 | buffer, drawbuffer, value); |
| 6459 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6460 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6461 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6462 | if (context) |
| 6463 | { |
| 6464 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6465 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6466 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6467 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6468 | |
| 6469 | switch (buffer) |
| 6470 | { |
| 6471 | case GL_COLOR: |
| 6472 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6473 | { |
| 6474 | return gl::error(GL_INVALID_VALUE); |
| 6475 | } |
| 6476 | break; |
| 6477 | default: |
| 6478 | return gl::error(GL_INVALID_ENUM); |
| 6479 | } |
| 6480 | |
| 6481 | context->clearBufferuiv(buffer, drawbuffer, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6482 | } |
| 6483 | } |
| 6484 | |
| 6485 | void __stdcall glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value) |
| 6486 | { |
| 6487 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat* value = 0x%0.8p)", |
| 6488 | buffer, drawbuffer, value); |
| 6489 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6490 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6491 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6492 | if (context) |
| 6493 | { |
| 6494 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6495 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6496 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6497 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6498 | |
| 6499 | switch (buffer) |
| 6500 | { |
| 6501 | case GL_COLOR: |
| 6502 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6503 | { |
| 6504 | return gl::error(GL_INVALID_VALUE); |
| 6505 | } |
| 6506 | break; |
| 6507 | case GL_DEPTH: |
| 6508 | if (drawbuffer != 0) |
| 6509 | { |
| 6510 | return gl::error(GL_INVALID_VALUE); |
| 6511 | } |
| 6512 | break; |
| 6513 | default: |
| 6514 | return gl::error(GL_INVALID_ENUM); |
| 6515 | } |
| 6516 | |
| 6517 | context->clearBufferfv(buffer, drawbuffer, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6518 | } |
| 6519 | } |
| 6520 | |
| 6521 | void __stdcall glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) |
| 6522 | { |
| 6523 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth, GLint stencil = %d)", |
| 6524 | buffer, drawbuffer, depth, stencil); |
| 6525 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6526 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6527 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6528 | if (context) |
| 6529 | { |
| 6530 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6531 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6532 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6533 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6534 | |
| 6535 | switch (buffer) |
| 6536 | { |
| 6537 | case GL_DEPTH_STENCIL: |
| 6538 | if (drawbuffer != 0) |
| 6539 | { |
| 6540 | return gl::error(GL_INVALID_VALUE); |
| 6541 | } |
| 6542 | break; |
| 6543 | default: |
| 6544 | return gl::error(GL_INVALID_ENUM); |
| 6545 | } |
| 6546 | |
| 6547 | context->clearBufferfi(buffer, drawbuffer, depth, stencil); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6548 | } |
| 6549 | } |
| 6550 | |
| 6551 | const GLubyte* __stdcall glGetStringi(GLenum name, GLuint index) |
| 6552 | { |
| 6553 | EVENT("(GLenum name = 0x%X, GLuint index = %u)", name, index); |
| 6554 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6555 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6556 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6557 | if (context) |
| 6558 | { |
| 6559 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6560 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6561 | return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLubyte*>(NULL)); |
shannonwoods@chromium.org | 302df74 | 2013-05-30 00:05:54 +0000 | [diff] [blame] | 6562 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6563 | |
| 6564 | if (name != GL_EXTENSIONS) |
| 6565 | { |
| 6566 | return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLubyte*>(NULL)); |
| 6567 | } |
| 6568 | |
| 6569 | if (index >= context->getExtensionStringCount()) |
| 6570 | { |
| 6571 | return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLubyte*>(NULL)); |
| 6572 | } |
| 6573 | |
| 6574 | 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] | 6575 | } |
| 6576 | |
| 6577 | return NULL; |
| 6578 | } |
| 6579 | |
| 6580 | void __stdcall glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) |
| 6581 | { |
| 6582 | EVENT("(GLenum readTarget = 0x%X, GLenum writeTarget = 0x%X, GLintptr readOffset = %d, GLintptr writeOffset = %d, GLsizeiptr size = %d)", |
| 6583 | readTarget, writeTarget, readOffset, writeOffset, size); |
| 6584 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6585 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6586 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6587 | if (context) |
| 6588 | { |
| 6589 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6590 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6591 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | 296c3f2 | 2013-04-13 03:39:39 +0000 | [diff] [blame] | 6592 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6593 | |
| 6594 | if (!gl::ValidBufferTarget(context, readTarget) || !gl::ValidBufferTarget(context, readTarget)) |
| 6595 | { |
| 6596 | return gl::error(GL_INVALID_ENUM); |
| 6597 | } |
| 6598 | |
| 6599 | gl::Buffer *readBuffer = context->getState().getTargetBuffer(readTarget); |
| 6600 | gl::Buffer *writeBuffer = context->getState().getTargetBuffer(writeTarget); |
| 6601 | |
| 6602 | if (!readBuffer || !writeBuffer) |
| 6603 | { |
| 6604 | return gl::error(GL_INVALID_OPERATION); |
| 6605 | } |
| 6606 | |
Jamie Madill | cfaaf72 | 2014-07-31 10:47:54 -0400 | [diff] [blame] | 6607 | // Verify that readBuffer and writeBuffer are not currently mapped |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6608 | if (readBuffer->isMapped() || writeBuffer->isMapped()) |
| 6609 | { |
| 6610 | return gl::error(GL_INVALID_OPERATION); |
| 6611 | } |
| 6612 | |
| 6613 | if (readOffset < 0 || writeOffset < 0 || size < 0 || |
| 6614 | static_cast<unsigned int>(readOffset + size) > readBuffer->getSize() || |
| 6615 | static_cast<unsigned int>(writeOffset + size) > writeBuffer->getSize()) |
| 6616 | { |
| 6617 | return gl::error(GL_INVALID_VALUE); |
| 6618 | } |
| 6619 | |
| 6620 | if (readBuffer == writeBuffer && abs(readOffset - writeOffset) < size) |
| 6621 | { |
| 6622 | return gl::error(GL_INVALID_VALUE); |
| 6623 | } |
| 6624 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6625 | // if size is zero, the copy is a successful no-op |
| 6626 | if (size > 0) |
| 6627 | { |
| 6628 | writeBuffer->copyBufferSubData(readBuffer, readOffset, writeOffset, size); |
| 6629 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6630 | } |
| 6631 | } |
| 6632 | |
| 6633 | void __stdcall glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices) |
| 6634 | { |
| 6635 | EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLchar* const* uniformNames = 0x%0.8p, GLuint* uniformIndices = 0x%0.8p)", |
| 6636 | program, uniformCount, uniformNames, uniformIndices); |
| 6637 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6638 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6639 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6640 | if (context) |
| 6641 | { |
| 6642 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6643 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6644 | return gl::error(GL_INVALID_OPERATION); |
| 6645 | } |
| 6646 | |
| 6647 | if (uniformCount < 0) |
| 6648 | { |
| 6649 | return gl::error(GL_INVALID_VALUE); |
| 6650 | } |
| 6651 | |
| 6652 | gl::Program *programObject = context->getProgram(program); |
| 6653 | |
| 6654 | if (!programObject) |
| 6655 | { |
| 6656 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6657 | { |
| 6658 | return gl::error(GL_INVALID_OPERATION); |
| 6659 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6660 | else |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 6661 | { |
| 6662 | return gl::error(GL_INVALID_VALUE); |
| 6663 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6664 | } |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 6665 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6666 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 6667 | if (!programObject->isLinked() || !programBinary) |
| 6668 | { |
| 6669 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 6670 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6671 | uniformIndices[uniformId] = GL_INVALID_INDEX; |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 6672 | } |
| 6673 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6674 | else |
| 6675 | { |
| 6676 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 6677 | { |
| 6678 | uniformIndices[uniformId] = programBinary->getUniformIndex(uniformNames[uniformId]); |
| 6679 | } |
| 6680 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6681 | } |
| 6682 | } |
| 6683 | |
| 6684 | void __stdcall glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) |
| 6685 | { |
| 6686 | EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLuint* uniformIndices = 0x%0.8p, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 6687 | program, uniformCount, uniformIndices, pname, params); |
| 6688 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6689 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6690 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6691 | if (context) |
| 6692 | { |
| 6693 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6694 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6695 | return gl::error(GL_INVALID_OPERATION); |
| 6696 | } |
| 6697 | |
| 6698 | if (uniformCount < 0) |
| 6699 | { |
| 6700 | return gl::error(GL_INVALID_VALUE); |
| 6701 | } |
| 6702 | |
| 6703 | gl::Program *programObject = context->getProgram(program); |
| 6704 | |
| 6705 | if (!programObject) |
| 6706 | { |
| 6707 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6708 | { |
| 6709 | return gl::error(GL_INVALID_OPERATION); |
| 6710 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6711 | else |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 6712 | { |
| 6713 | return gl::error(GL_INVALID_VALUE); |
| 6714 | } |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 6715 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6716 | |
| 6717 | switch (pname) |
| 6718 | { |
| 6719 | case GL_UNIFORM_TYPE: |
| 6720 | case GL_UNIFORM_SIZE: |
| 6721 | case GL_UNIFORM_NAME_LENGTH: |
| 6722 | case GL_UNIFORM_BLOCK_INDEX: |
| 6723 | case GL_UNIFORM_OFFSET: |
| 6724 | case GL_UNIFORM_ARRAY_STRIDE: |
| 6725 | case GL_UNIFORM_MATRIX_STRIDE: |
| 6726 | case GL_UNIFORM_IS_ROW_MAJOR: |
| 6727 | break; |
| 6728 | default: |
| 6729 | return gl::error(GL_INVALID_ENUM); |
| 6730 | } |
| 6731 | |
| 6732 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 6733 | |
| 6734 | if (!programBinary && uniformCount > 0) |
| 6735 | { |
| 6736 | return gl::error(GL_INVALID_VALUE); |
| 6737 | } |
| 6738 | |
| 6739 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 6740 | { |
| 6741 | const GLuint index = uniformIndices[uniformId]; |
| 6742 | |
| 6743 | if (index >= (GLuint)programBinary->getActiveUniformCount()) |
| 6744 | { |
| 6745 | return gl::error(GL_INVALID_VALUE); |
| 6746 | } |
| 6747 | } |
| 6748 | |
| 6749 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 6750 | { |
| 6751 | const GLuint index = uniformIndices[uniformId]; |
| 6752 | params[uniformId] = programBinary->getActiveUniformi(index, pname); |
| 6753 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6754 | } |
| 6755 | } |
| 6756 | |
| 6757 | GLuint __stdcall glGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) |
| 6758 | { |
| 6759 | EVENT("(GLuint program = %u, const GLchar* uniformBlockName = 0x%0.8p)", program, uniformBlockName); |
| 6760 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6761 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6762 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6763 | if (context) |
| 6764 | { |
| 6765 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6766 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6767 | return gl::error(GL_INVALID_OPERATION, GL_INVALID_INDEX); |
| 6768 | } |
| 6769 | |
| 6770 | gl::Program *programObject = context->getProgram(program); |
| 6771 | |
| 6772 | if (!programObject) |
| 6773 | { |
| 6774 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6775 | { |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 6776 | return gl::error(GL_INVALID_OPERATION, GL_INVALID_INDEX); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6777 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6778 | else |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 6779 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6780 | return gl::error(GL_INVALID_VALUE, GL_INVALID_INDEX); |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 6781 | } |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 6782 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6783 | |
| 6784 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 6785 | if (!programBinary) |
| 6786 | { |
| 6787 | return GL_INVALID_INDEX; |
| 6788 | } |
| 6789 | |
| 6790 | return programBinary->getUniformBlockIndex(uniformBlockName); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6791 | } |
| 6792 | |
| 6793 | return 0; |
| 6794 | } |
| 6795 | |
| 6796 | void __stdcall glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) |
| 6797 | { |
| 6798 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 6799 | program, uniformBlockIndex, pname, params); |
| 6800 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6801 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6802 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6803 | if (context) |
| 6804 | { |
| 6805 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6806 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6807 | return gl::error(GL_INVALID_OPERATION); |
| 6808 | } |
| 6809 | gl::Program *programObject = context->getProgram(program); |
| 6810 | |
| 6811 | if (!programObject) |
| 6812 | { |
| 6813 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6814 | { |
| 6815 | return gl::error(GL_INVALID_OPERATION); |
| 6816 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6817 | else |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 6818 | { |
| 6819 | return gl::error(GL_INVALID_VALUE); |
| 6820 | } |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 6821 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6822 | |
| 6823 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 6824 | |
| 6825 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 6826 | { |
| 6827 | return gl::error(GL_INVALID_VALUE); |
| 6828 | } |
| 6829 | |
| 6830 | switch (pname) |
| 6831 | { |
| 6832 | case GL_UNIFORM_BLOCK_BINDING: |
| 6833 | *params = static_cast<GLint>(programObject->getUniformBlockBinding(uniformBlockIndex)); |
| 6834 | break; |
| 6835 | |
| 6836 | case GL_UNIFORM_BLOCK_DATA_SIZE: |
| 6837 | case GL_UNIFORM_BLOCK_NAME_LENGTH: |
| 6838 | case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS: |
| 6839 | case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: |
| 6840 | case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: |
| 6841 | case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: |
| 6842 | programBinary->getActiveUniformBlockiv(uniformBlockIndex, pname, params); |
| 6843 | break; |
| 6844 | |
| 6845 | default: |
| 6846 | return gl::error(GL_INVALID_ENUM); |
| 6847 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6848 | } |
| 6849 | } |
| 6850 | |
| 6851 | void __stdcall glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName) |
| 6852 | { |
| 6853 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLchar* uniformBlockName = 0x%0.8p)", |
| 6854 | program, uniformBlockIndex, bufSize, length, uniformBlockName); |
| 6855 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6856 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6857 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6858 | if (context) |
| 6859 | { |
| 6860 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6861 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6862 | return gl::error(GL_INVALID_OPERATION); |
| 6863 | } |
| 6864 | |
| 6865 | gl::Program *programObject = context->getProgram(program); |
| 6866 | |
| 6867 | if (!programObject) |
| 6868 | { |
| 6869 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6870 | { |
| 6871 | return gl::error(GL_INVALID_OPERATION); |
| 6872 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6873 | else |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 6874 | { |
| 6875 | return gl::error(GL_INVALID_VALUE); |
| 6876 | } |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 6877 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6878 | |
| 6879 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 6880 | |
| 6881 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 6882 | { |
| 6883 | return gl::error(GL_INVALID_VALUE); |
| 6884 | } |
| 6885 | |
| 6886 | programBinary->getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6887 | } |
| 6888 | } |
| 6889 | |
| 6890 | void __stdcall glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) |
| 6891 | { |
| 6892 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLuint uniformBlockBinding = %u)", |
| 6893 | program, uniformBlockIndex, uniformBlockBinding); |
| 6894 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6895 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6896 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6897 | if (context) |
| 6898 | { |
| 6899 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6900 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6901 | return gl::error(GL_INVALID_OPERATION); |
| 6902 | } |
| 6903 | |
| 6904 | if (uniformBlockBinding >= context->getMaximumCombinedUniformBufferBindings()) |
| 6905 | { |
| 6906 | return gl::error(GL_INVALID_VALUE); |
| 6907 | } |
| 6908 | |
| 6909 | gl::Program *programObject = context->getProgram(program); |
| 6910 | |
| 6911 | if (!programObject) |
| 6912 | { |
| 6913 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6914 | { |
| 6915 | return gl::error(GL_INVALID_OPERATION); |
| 6916 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6917 | else |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 6918 | { |
| 6919 | return gl::error(GL_INVALID_VALUE); |
| 6920 | } |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 6921 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6922 | |
| 6923 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 6924 | |
| 6925 | // if never linked, there won't be any uniform blocks |
| 6926 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 6927 | { |
| 6928 | return gl::error(GL_INVALID_VALUE); |
| 6929 | } |
| 6930 | |
| 6931 | programObject->bindUniformBlock(uniformBlockIndex, uniformBlockBinding); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6932 | } |
| 6933 | } |
| 6934 | |
| 6935 | void __stdcall glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount) |
| 6936 | { |
| 6937 | EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei instanceCount = %d)", |
| 6938 | mode, first, count, instanceCount); |
| 6939 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6940 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6941 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6942 | if (context) |
| 6943 | { |
| 6944 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6945 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6946 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6947 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6948 | |
| 6949 | // glDrawArraysInstanced |
| 6950 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6951 | } |
| 6952 | } |
| 6953 | |
| 6954 | void __stdcall glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount) |
| 6955 | { |
| 6956 | EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei instanceCount = %d)", |
| 6957 | mode, count, type, indices, instanceCount); |
| 6958 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6959 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6960 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6961 | if (context) |
| 6962 | { |
| 6963 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6964 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6965 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6966 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6967 | |
| 6968 | // glDrawElementsInstanced |
| 6969 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6970 | } |
| 6971 | } |
| 6972 | |
| 6973 | GLsync __stdcall glFenceSync(GLenum condition, GLbitfield flags) |
| 6974 | { |
| 6975 | EVENT("(GLenum condition = 0x%X, GLbitfield flags = 0x%X)", condition, flags); |
| 6976 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6977 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6978 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6979 | if (context) |
| 6980 | { |
| 6981 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6982 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6983 | return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLsync>(0)); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6984 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6985 | |
| 6986 | if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) |
| 6987 | { |
| 6988 | return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLsync>(0)); |
| 6989 | } |
| 6990 | |
| 6991 | if (flags != 0) |
| 6992 | { |
| 6993 | return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLsync>(0)); |
| 6994 | } |
| 6995 | |
| 6996 | return context->createFenceSync(condition); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6997 | } |
| 6998 | |
| 6999 | return NULL; |
| 7000 | } |
| 7001 | |
| 7002 | GLboolean __stdcall glIsSync(GLsync sync) |
| 7003 | { |
| 7004 | EVENT("(GLsync sync = 0x%0.8p)", sync); |
| 7005 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7006 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7007 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7008 | if (context) |
| 7009 | { |
| 7010 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7011 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7012 | return gl::error(GL_INVALID_OPERATION, GL_FALSE); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7013 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7014 | |
| 7015 | return (context->getFenceSync(sync) != NULL); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7016 | } |
| 7017 | |
| 7018 | return GL_FALSE; |
| 7019 | } |
| 7020 | |
| 7021 | void __stdcall glDeleteSync(GLsync sync) |
| 7022 | { |
| 7023 | EVENT("(GLsync sync = 0x%0.8p)", sync); |
| 7024 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7025 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7026 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7027 | if (context) |
| 7028 | { |
| 7029 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7030 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7031 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7032 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7033 | |
| 7034 | if (sync != static_cast<GLsync>(0) && !context->getFenceSync(sync)) |
| 7035 | { |
| 7036 | return gl::error(GL_INVALID_VALUE); |
| 7037 | } |
| 7038 | |
| 7039 | context->deleteFenceSync(sync); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7040 | } |
| 7041 | } |
| 7042 | |
| 7043 | GLenum __stdcall glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) |
| 7044 | { |
| 7045 | EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", |
| 7046 | sync, flags, timeout); |
| 7047 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7048 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7049 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7050 | if (context) |
| 7051 | { |
| 7052 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7053 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7054 | return gl::error(GL_INVALID_OPERATION, GL_WAIT_FAILED); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7055 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7056 | |
| 7057 | if ((flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0) |
| 7058 | { |
| 7059 | return gl::error(GL_INVALID_VALUE, GL_WAIT_FAILED); |
| 7060 | } |
| 7061 | |
| 7062 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7063 | |
| 7064 | if (!fenceSync) |
| 7065 | { |
| 7066 | return gl::error(GL_INVALID_VALUE, GL_WAIT_FAILED); |
| 7067 | } |
| 7068 | |
| 7069 | return fenceSync->clientWait(flags, timeout); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7070 | } |
| 7071 | |
| 7072 | return GL_FALSE; |
| 7073 | } |
| 7074 | |
| 7075 | void __stdcall glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) |
| 7076 | { |
| 7077 | EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", |
| 7078 | sync, flags, timeout); |
| 7079 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7080 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7081 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7082 | if (context) |
| 7083 | { |
| 7084 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7085 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7086 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7087 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7088 | |
| 7089 | if (flags != 0) |
| 7090 | { |
| 7091 | return gl::error(GL_INVALID_VALUE); |
| 7092 | } |
| 7093 | |
| 7094 | if (timeout != GL_TIMEOUT_IGNORED) |
| 7095 | { |
| 7096 | return gl::error(GL_INVALID_VALUE); |
| 7097 | } |
| 7098 | |
| 7099 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7100 | |
| 7101 | if (!fenceSync) |
| 7102 | { |
| 7103 | return gl::error(GL_INVALID_VALUE); |
| 7104 | } |
| 7105 | |
| 7106 | fenceSync->serverWait(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7107 | } |
| 7108 | } |
| 7109 | |
| 7110 | void __stdcall glGetInteger64v(GLenum pname, GLint64* params) |
| 7111 | { |
| 7112 | EVENT("(GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", |
| 7113 | pname, params); |
| 7114 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7115 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7116 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7117 | if (context) |
| 7118 | { |
| 7119 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7120 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7121 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7122 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7123 | |
| 7124 | GLenum nativeType; |
| 7125 | unsigned int numParams = 0; |
| 7126 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
| 7127 | { |
| 7128 | return; |
| 7129 | } |
| 7130 | |
| 7131 | if (nativeType == GL_INT_64_ANGLEX) |
| 7132 | { |
| 7133 | context->getInteger64v(pname, params); |
| 7134 | } |
| 7135 | else |
| 7136 | { |
| 7137 | CastStateValues(context, nativeType, pname, numParams, params); |
| 7138 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7139 | } |
| 7140 | } |
| 7141 | |
| 7142 | void __stdcall glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) |
| 7143 | { |
| 7144 | EVENT("(GLsync sync = 0x%0.8p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLint* values = 0x%0.8p)", |
| 7145 | sync, pname, bufSize, length, values); |
| 7146 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7147 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7148 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7149 | if (context) |
| 7150 | { |
| 7151 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7152 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7153 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7154 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7155 | |
| 7156 | if (bufSize < 0) |
| 7157 | { |
| 7158 | return gl::error(GL_INVALID_VALUE); |
| 7159 | } |
| 7160 | |
| 7161 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7162 | |
| 7163 | if (!fenceSync) |
| 7164 | { |
| 7165 | return gl::error(GL_INVALID_VALUE); |
| 7166 | } |
| 7167 | |
| 7168 | switch (pname) |
| 7169 | { |
| 7170 | case GL_OBJECT_TYPE: values[0] = static_cast<GLint>(GL_SYNC_FENCE); break; |
| 7171 | case GL_SYNC_STATUS: values[0] = static_cast<GLint>(fenceSync->getStatus()); break; |
| 7172 | case GL_SYNC_CONDITION: values[0] = static_cast<GLint>(fenceSync->getCondition()); break; |
| 7173 | case GL_SYNC_FLAGS: values[0] = 0; break; |
| 7174 | |
| 7175 | default: |
| 7176 | return gl::error(GL_INVALID_ENUM); |
| 7177 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7178 | } |
| 7179 | } |
| 7180 | |
| 7181 | void __stdcall glGetInteger64i_v(GLenum target, GLuint index, GLint64* data) |
| 7182 | { |
| 7183 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint64* data = 0x%0.8p)", |
| 7184 | target, index, data); |
| 7185 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7186 | gl::Context *context = gl::getNonLostContext(); |
| 7187 | |
| 7188 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7189 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7190 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7191 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7192 | return gl::error(GL_INVALID_OPERATION); |
| 7193 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7194 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7195 | switch (target) |
| 7196 | { |
| 7197 | case GL_TRANSFORM_FEEDBACK_BUFFER_START: |
| 7198 | case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: |
| 7199 | case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: |
| 7200 | if (index >= context->getMaxTransformFeedbackBufferBindings()) |
| 7201 | return gl::error(GL_INVALID_VALUE); |
| 7202 | break; |
| 7203 | case GL_UNIFORM_BUFFER_START: |
| 7204 | case GL_UNIFORM_BUFFER_SIZE: |
| 7205 | case GL_UNIFORM_BUFFER_BINDING: |
| 7206 | if (index >= context->getMaximumCombinedUniformBufferBindings()) |
| 7207 | return gl::error(GL_INVALID_VALUE); |
| 7208 | break; |
| 7209 | default: |
| 7210 | return gl::error(GL_INVALID_ENUM); |
| 7211 | } |
| 7212 | |
| 7213 | if (!(context->getIndexedInteger64v(target, index, data))) |
| 7214 | { |
| 7215 | GLenum nativeType; |
| 7216 | unsigned int numParams = 0; |
| 7217 | if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams)) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7218 | return gl::error(GL_INVALID_ENUM); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7219 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7220 | if (numParams == 0) |
| 7221 | return; // it is known that pname is valid, but there are no parameters to return |
| 7222 | |
| 7223 | if (nativeType == GL_INT) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7224 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7225 | GLint *intParams = new GLint[numParams]; |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7226 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7227 | context->getIndexedIntegerv(target, index, intParams); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7228 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7229 | for (unsigned int i = 0; i < numParams; ++i) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7230 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7231 | data[i] = static_cast<GLint64>(intParams[i]); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7232 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7233 | |
| 7234 | delete [] intParams; |
| 7235 | } |
| 7236 | else |
| 7237 | { |
| 7238 | UNREACHABLE(); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7239 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7240 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7241 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7242 | } |
| 7243 | |
| 7244 | void __stdcall glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) |
| 7245 | { |
| 7246 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", |
| 7247 | target, pname, params); |
| 7248 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7249 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7250 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7251 | if (context) |
| 7252 | { |
| 7253 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7254 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7255 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7256 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7257 | |
| 7258 | if (!gl::ValidBufferTarget(context, target)) |
| 7259 | { |
| 7260 | return gl::error(GL_INVALID_ENUM); |
| 7261 | } |
| 7262 | |
| 7263 | if (!gl::ValidBufferParameter(context, pname)) |
| 7264 | { |
| 7265 | return gl::error(GL_INVALID_ENUM); |
| 7266 | } |
| 7267 | |
| 7268 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 7269 | |
| 7270 | if (!buffer) |
| 7271 | { |
| 7272 | // A null buffer means that "0" is bound to the requested buffer target |
| 7273 | return gl::error(GL_INVALID_OPERATION); |
| 7274 | } |
| 7275 | |
| 7276 | switch (pname) |
| 7277 | { |
| 7278 | case GL_BUFFER_USAGE: |
| 7279 | *params = static_cast<GLint64>(buffer->getUsage()); |
| 7280 | break; |
| 7281 | case GL_BUFFER_SIZE: |
| 7282 | *params = buffer->getSize(); |
| 7283 | break; |
| 7284 | case GL_BUFFER_ACCESS_FLAGS: |
| 7285 | *params = static_cast<GLint64>(buffer->getAccessFlags()); |
| 7286 | break; |
| 7287 | case GL_BUFFER_MAPPED: |
| 7288 | *params = static_cast<GLint64>(buffer->isMapped()); |
| 7289 | break; |
| 7290 | case GL_BUFFER_MAP_OFFSET: |
| 7291 | *params = buffer->getMapOffset(); |
| 7292 | break; |
| 7293 | case GL_BUFFER_MAP_LENGTH: |
| 7294 | *params = buffer->getMapLength(); |
| 7295 | break; |
| 7296 | default: UNREACHABLE(); break; |
| 7297 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7298 | } |
| 7299 | } |
| 7300 | |
| 7301 | void __stdcall glGenSamplers(GLsizei count, GLuint* samplers) |
| 7302 | { |
| 7303 | EVENT("(GLsizei count = %d, GLuint* samplers = 0x%0.8p)", count, samplers); |
| 7304 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7305 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7306 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7307 | if (context) |
| 7308 | { |
| 7309 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7310 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7311 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7312 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7313 | |
| 7314 | if (count < 0) |
| 7315 | { |
| 7316 | return gl::error(GL_INVALID_VALUE); |
| 7317 | } |
| 7318 | |
| 7319 | for (int i = 0; i < count; i++) |
| 7320 | { |
| 7321 | samplers[i] = context->createSampler(); |
| 7322 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7323 | } |
| 7324 | } |
| 7325 | |
| 7326 | void __stdcall glDeleteSamplers(GLsizei count, const GLuint* samplers) |
| 7327 | { |
| 7328 | EVENT("(GLsizei count = %d, const GLuint* samplers = 0x%0.8p)", count, samplers); |
| 7329 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7330 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7331 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7332 | if (context) |
| 7333 | { |
| 7334 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7335 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7336 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7337 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7338 | |
| 7339 | if (count < 0) |
| 7340 | { |
| 7341 | return gl::error(GL_INVALID_VALUE); |
| 7342 | } |
| 7343 | |
| 7344 | for (int i = 0; i < count; i++) |
| 7345 | { |
| 7346 | context->deleteSampler(samplers[i]); |
| 7347 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7348 | } |
| 7349 | } |
| 7350 | |
| 7351 | GLboolean __stdcall glIsSampler(GLuint sampler) |
| 7352 | { |
| 7353 | EVENT("(GLuint sampler = %u)", sampler); |
| 7354 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7355 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7356 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7357 | if (context) |
| 7358 | { |
| 7359 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7360 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7361 | return gl::error(GL_INVALID_OPERATION, GL_FALSE); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7362 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7363 | |
| 7364 | return context->isSampler(sampler); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7365 | } |
| 7366 | |
| 7367 | return GL_FALSE; |
| 7368 | } |
| 7369 | |
| 7370 | void __stdcall glBindSampler(GLuint unit, GLuint sampler) |
| 7371 | { |
| 7372 | EVENT("(GLuint unit = %u, GLuint sampler = %u)", unit, sampler); |
| 7373 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7374 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7375 | |
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 | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7380 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7381 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7382 | |
| 7383 | if (sampler != 0 && !context->isSampler(sampler)) |
| 7384 | { |
| 7385 | return gl::error(GL_INVALID_OPERATION); |
| 7386 | } |
| 7387 | |
| 7388 | if (unit >= context->getMaximumCombinedTextureImageUnits()) |
| 7389 | { |
| 7390 | return gl::error(GL_INVALID_VALUE); |
| 7391 | } |
| 7392 | |
| 7393 | context->bindSampler(unit, sampler); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7394 | } |
| 7395 | } |
| 7396 | |
| 7397 | void __stdcall glSamplerParameteri(GLuint sampler, GLenum pname, GLint param) |
| 7398 | { |
| 7399 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint param = %d)", sampler, pname, param); |
| 7400 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7401 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7402 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7403 | if (context) |
| 7404 | { |
| 7405 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7406 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7407 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7408 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7409 | |
| 7410 | if (!gl::ValidateSamplerObjectParameter(pname)) |
| 7411 | { |
| 7412 | return; |
| 7413 | } |
| 7414 | |
| 7415 | if (!gl::ValidateTexParamParameters(context, pname, param)) |
| 7416 | { |
| 7417 | return; |
| 7418 | } |
| 7419 | |
| 7420 | if (!context->isSampler(sampler)) |
| 7421 | { |
| 7422 | return gl::error(GL_INVALID_OPERATION); |
| 7423 | } |
| 7424 | |
| 7425 | context->samplerParameteri(sampler, pname, param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7426 | } |
| 7427 | } |
| 7428 | |
| 7429 | void __stdcall glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param) |
| 7430 | { |
Jamie Madill | f6cc8cc | 2013-07-03 12:44:15 -0400 | [diff] [blame] | 7431 | glSamplerParameteri(sampler, pname, *param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7432 | } |
| 7433 | |
| 7434 | void __stdcall glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) |
| 7435 | { |
| 7436 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat param = %g)", sampler, pname, param); |
| 7437 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7438 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7439 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7440 | if (context) |
| 7441 | { |
| 7442 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7443 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7444 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7445 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7446 | |
| 7447 | if (!gl::ValidateSamplerObjectParameter(pname)) |
| 7448 | { |
| 7449 | return; |
| 7450 | } |
| 7451 | |
| 7452 | if (!gl::ValidateTexParamParameters(context, pname, static_cast<GLint>(param))) |
| 7453 | { |
| 7454 | return; |
| 7455 | } |
| 7456 | |
| 7457 | if (!context->isSampler(sampler)) |
| 7458 | { |
| 7459 | return gl::error(GL_INVALID_OPERATION); |
| 7460 | } |
| 7461 | |
| 7462 | context->samplerParameterf(sampler, pname, param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7463 | } |
| 7464 | } |
| 7465 | |
| 7466 | void __stdcall glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param) |
| 7467 | { |
Jamie Madill | f6cc8cc | 2013-07-03 12:44:15 -0400 | [diff] [blame] | 7468 | glSamplerParameterf(sampler, pname, *param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7469 | } |
| 7470 | |
| 7471 | void __stdcall glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params) |
| 7472 | { |
| 7473 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", sampler, pname, params); |
| 7474 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7475 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7476 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7477 | if (context) |
| 7478 | { |
| 7479 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7480 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7481 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7482 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7483 | |
| 7484 | if (!gl::ValidateSamplerObjectParameter(pname)) |
| 7485 | { |
| 7486 | return; |
| 7487 | } |
| 7488 | |
| 7489 | if (!context->isSampler(sampler)) |
| 7490 | { |
| 7491 | return gl::error(GL_INVALID_OPERATION); |
| 7492 | } |
| 7493 | |
| 7494 | *params = context->getSamplerParameteri(sampler, pname); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7495 | } |
| 7496 | } |
| 7497 | |
| 7498 | void __stdcall glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params) |
| 7499 | { |
| 7500 | EVENT("(GLuint sample = %ur, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", sampler, pname, params); |
| 7501 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7502 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7503 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7504 | if (context) |
| 7505 | { |
| 7506 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7507 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7508 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7509 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7510 | |
| 7511 | if (!gl::ValidateSamplerObjectParameter(pname)) |
| 7512 | { |
| 7513 | return; |
| 7514 | } |
| 7515 | |
| 7516 | if (!context->isSampler(sampler)) |
| 7517 | { |
| 7518 | return gl::error(GL_INVALID_OPERATION); |
| 7519 | } |
| 7520 | |
| 7521 | *params = context->getSamplerParameterf(sampler, pname); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7522 | } |
| 7523 | } |
| 7524 | |
| 7525 | void __stdcall glVertexAttribDivisor(GLuint index, GLuint divisor) |
| 7526 | { |
| 7527 | EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor); |
| 7528 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7529 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7530 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7531 | return gl::error(GL_INVALID_VALUE); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7532 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7533 | |
| 7534 | gl::Context *context = gl::getNonLostContext(); |
| 7535 | |
| 7536 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7537 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7538 | if (context->getClientVersion() < 3) |
| 7539 | { |
| 7540 | return gl::error(GL_INVALID_OPERATION); |
| 7541 | } |
| 7542 | |
| 7543 | context->setVertexAttribDivisor(index, divisor); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7544 | } |
| 7545 | } |
| 7546 | |
| 7547 | void __stdcall glBindTransformFeedback(GLenum target, GLuint id) |
| 7548 | { |
| 7549 | EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id); |
| 7550 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7551 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7552 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7553 | if (context) |
| 7554 | { |
| 7555 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7556 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7557 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7558 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7559 | |
| 7560 | switch (target) |
| 7561 | { |
| 7562 | case GL_TRANSFORM_FEEDBACK: |
| 7563 | { |
| 7564 | // Cannot bind a transform feedback object if the current one is started and not paused (3.0.2 pg 85 section 2.14.1) |
| 7565 | gl::TransformFeedback *curTransformFeedback = context->getState().getCurrentTransformFeedback(); |
| 7566 | if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused()) |
| 7567 | { |
| 7568 | return gl::error(GL_INVALID_OPERATION); |
| 7569 | } |
| 7570 | |
| 7571 | // Cannot bind a transform feedback object that does not exist (3.0.2 pg 85 section 2.14.1) |
| 7572 | if (context->getTransformFeedback(id) == NULL) |
| 7573 | { |
| 7574 | return gl::error(GL_INVALID_OPERATION); |
| 7575 | } |
| 7576 | |
| 7577 | context->bindTransformFeedback(id); |
| 7578 | } |
| 7579 | break; |
| 7580 | |
| 7581 | default: |
| 7582 | return gl::error(GL_INVALID_ENUM); |
| 7583 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7584 | } |
| 7585 | } |
| 7586 | |
| 7587 | void __stdcall glDeleteTransformFeedbacks(GLsizei n, const GLuint* ids) |
| 7588 | { |
| 7589 | EVENT("(GLsizei n = %d, const GLuint* ids = 0x%0.8p)", n, ids); |
| 7590 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7591 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7592 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7593 | if (context) |
| 7594 | { |
| 7595 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7596 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7597 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7598 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7599 | |
| 7600 | for (int i = 0; i < n; i++) |
| 7601 | { |
| 7602 | context->deleteTransformFeedback(ids[i]); |
| 7603 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7604 | } |
| 7605 | } |
| 7606 | |
| 7607 | void __stdcall glGenTransformFeedbacks(GLsizei n, GLuint* ids) |
| 7608 | { |
| 7609 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 7610 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7611 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7612 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7613 | if (context) |
| 7614 | { |
| 7615 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7616 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7617 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7618 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7619 | |
| 7620 | for (int i = 0; i < n; i++) |
| 7621 | { |
| 7622 | ids[i] = context->createTransformFeedback(); |
| 7623 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7624 | } |
| 7625 | } |
| 7626 | |
| 7627 | GLboolean __stdcall glIsTransformFeedback(GLuint id) |
| 7628 | { |
| 7629 | EVENT("(GLuint id = %u)", id); |
| 7630 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7631 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7632 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7633 | if (context) |
| 7634 | { |
| 7635 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7636 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7637 | return gl::error(GL_INVALID_OPERATION, GL_FALSE); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7638 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7639 | |
| 7640 | 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] | 7641 | } |
| 7642 | |
| 7643 | return GL_FALSE; |
| 7644 | } |
| 7645 | |
| 7646 | void __stdcall glPauseTransformFeedback(void) |
| 7647 | { |
| 7648 | EVENT("(void)"); |
| 7649 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7650 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7651 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7652 | if (context) |
| 7653 | { |
| 7654 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7655 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7656 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7657 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7658 | |
| 7659 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 7660 | ASSERT(transformFeedback != NULL); |
| 7661 | |
| 7662 | // Current transform feedback must be started and not paused in order to pause (3.0.2 pg 86) |
| 7663 | if (!transformFeedback->isStarted() || transformFeedback->isPaused()) |
| 7664 | { |
| 7665 | return gl::error(GL_INVALID_OPERATION); |
| 7666 | } |
| 7667 | |
| 7668 | transformFeedback->pause(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7669 | } |
| 7670 | } |
| 7671 | |
| 7672 | void __stdcall glResumeTransformFeedback(void) |
| 7673 | { |
| 7674 | EVENT("(void)"); |
| 7675 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7676 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7677 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7678 | if (context) |
| 7679 | { |
| 7680 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7681 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7682 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7683 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7684 | |
| 7685 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 7686 | ASSERT(transformFeedback != NULL); |
| 7687 | |
| 7688 | // Current transform feedback must be started and paused in order to resume (3.0.2 pg 86) |
| 7689 | if (!transformFeedback->isStarted() || !transformFeedback->isPaused()) |
| 7690 | { |
| 7691 | return gl::error(GL_INVALID_OPERATION); |
| 7692 | } |
| 7693 | |
| 7694 | transformFeedback->resume(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7695 | } |
| 7696 | } |
| 7697 | |
| 7698 | void __stdcall glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary) |
| 7699 | { |
| 7700 | EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLenum* binaryFormat = 0x%0.8p, GLvoid* binary = 0x%0.8p)", |
| 7701 | program, bufSize, length, binaryFormat, binary); |
| 7702 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7703 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7704 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7705 | if (context) |
| 7706 | { |
| 7707 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7708 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7709 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7710 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7711 | |
| 7712 | // glGetProgramBinary |
| 7713 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7714 | } |
| 7715 | } |
| 7716 | |
| 7717 | void __stdcall glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length) |
| 7718 | { |
| 7719 | EVENT("(GLuint program = %u, GLenum binaryFormat = 0x%X, const GLvoid* binary = 0x%0.8p, GLsizei length = %d)", |
| 7720 | program, binaryFormat, binary, length); |
| 7721 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7722 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7723 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7724 | if (context) |
| 7725 | { |
| 7726 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7727 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7728 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7729 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7730 | |
| 7731 | // glProgramBinary |
| 7732 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7733 | } |
| 7734 | } |
| 7735 | |
| 7736 | void __stdcall glProgramParameteri(GLuint program, GLenum pname, GLint value) |
| 7737 | { |
| 7738 | EVENT("(GLuint program = %u, GLenum pname = 0x%X, GLint value = %d)", |
| 7739 | program, pname, value); |
| 7740 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7741 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7742 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7743 | if (context) |
| 7744 | { |
| 7745 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7746 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7747 | return gl::error(GL_INVALID_OPERATION); |
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 | // glProgramParameteri |
| 7751 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7752 | } |
| 7753 | } |
| 7754 | |
| 7755 | void __stdcall glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments) |
| 7756 | { |
| 7757 | EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p)", |
| 7758 | target, numAttachments, attachments); |
| 7759 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7760 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7761 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7762 | if (context) |
| 7763 | { |
| 7764 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7765 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7766 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | d63ef89 | 2013-05-30 00:10:56 +0000 | [diff] [blame] | 7767 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7768 | |
| 7769 | if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments)) |
| 7770 | { |
| 7771 | return; |
| 7772 | } |
| 7773 | |
| 7774 | GLuint maxDimension = context->getCaps().maxRenderbufferSize; |
| 7775 | context->invalidateFrameBuffer(target, numAttachments, attachments, 0, 0, maxDimension, maxDimension); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7776 | } |
| 7777 | } |
| 7778 | |
| 7779 | void __stdcall glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) |
| 7780 | { |
| 7781 | EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p, GLint x = %d, " |
| 7782 | "GLint y = %d, GLsizei width = %d, GLsizei height = %d)", |
| 7783 | target, numAttachments, attachments, x, y, width, height); |
| 7784 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7785 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7786 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7787 | if (context) |
| 7788 | { |
| 7789 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7790 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7791 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | d63ef89 | 2013-05-30 00:10:56 +0000 | [diff] [blame] | 7792 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7793 | |
| 7794 | if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments)) |
| 7795 | { |
| 7796 | return; |
| 7797 | } |
| 7798 | |
| 7799 | context->invalidateFrameBuffer(target, numAttachments, attachments, x, y, width, height); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7800 | } |
| 7801 | } |
| 7802 | |
| 7803 | void __stdcall glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) |
| 7804 | { |
| 7805 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 7806 | target, levels, internalformat, width, height); |
| 7807 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7808 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7809 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7810 | if (context) |
| 7811 | { |
| 7812 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7813 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7814 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 8757c06 | 2013-05-30 00:14:24 +0000 | [diff] [blame] | 7815 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7816 | |
| 7817 | if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1)) |
| 7818 | { |
| 7819 | return; |
| 7820 | } |
| 7821 | |
| 7822 | switch (target) |
| 7823 | { |
| 7824 | case GL_TEXTURE_2D: |
| 7825 | { |
| 7826 | gl::Texture2D *texture2d = context->getTexture2D(); |
| 7827 | texture2d->storage(levels, internalformat, width, height); |
| 7828 | } |
| 7829 | break; |
| 7830 | |
| 7831 | case GL_TEXTURE_CUBE_MAP: |
| 7832 | { |
| 7833 | gl::TextureCubeMap *textureCube = context->getTextureCubeMap(); |
| 7834 | textureCube->storage(levels, internalformat, width); |
| 7835 | } |
| 7836 | break; |
| 7837 | |
| 7838 | default: |
| 7839 | return gl::error(GL_INVALID_ENUM); |
| 7840 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7841 | } |
| 7842 | } |
| 7843 | |
| 7844 | void __stdcall glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) |
| 7845 | { |
| 7846 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " |
| 7847 | "GLsizei height = %d, GLsizei depth = %d)", |
| 7848 | target, levels, internalformat, width, height, depth); |
| 7849 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7850 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7851 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7852 | if (context) |
| 7853 | { |
| 7854 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7855 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7856 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | 14eb55e | 2013-04-13 03:35:06 +0000 | [diff] [blame] | 7857 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7858 | |
| 7859 | if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, depth)) |
| 7860 | { |
| 7861 | return; |
| 7862 | } |
| 7863 | |
| 7864 | switch (target) |
| 7865 | { |
| 7866 | case GL_TEXTURE_3D: |
| 7867 | { |
| 7868 | gl::Texture3D *texture3d = context->getTexture3D(); |
| 7869 | texture3d->storage(levels, internalformat, width, height, depth); |
| 7870 | } |
| 7871 | break; |
| 7872 | |
| 7873 | case GL_TEXTURE_2D_ARRAY: |
| 7874 | { |
| 7875 | gl::Texture2DArray *texture2darray = context->getTexture2DArray(); |
| 7876 | texture2darray->storage(levels, internalformat, width, height, depth); |
| 7877 | } |
| 7878 | break; |
| 7879 | |
| 7880 | default: |
| 7881 | UNREACHABLE(); |
| 7882 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7883 | } |
| 7884 | } |
| 7885 | |
| 7886 | void __stdcall glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) |
| 7887 | { |
| 7888 | EVENT("(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, " |
| 7889 | "GLint* params = 0x%0.8p)", |
| 7890 | target, internalformat, pname, bufSize, params); |
| 7891 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7892 | gl::Context *context = gl::getNonLostContext(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7893 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7894 | if (context) |
| 7895 | { |
| 7896 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7897 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7898 | return gl::error(GL_INVALID_OPERATION); |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7899 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7900 | |
| 7901 | const gl::TextureCaps &formatCaps = context->getTextureCaps().get(internalformat); |
| 7902 | if (!formatCaps.renderable) |
| 7903 | { |
| 7904 | return gl::error(GL_INVALID_ENUM); |
| 7905 | } |
| 7906 | |
| 7907 | if (target != GL_RENDERBUFFER) |
| 7908 | { |
| 7909 | return gl::error(GL_INVALID_ENUM); |
| 7910 | } |
| 7911 | |
| 7912 | if (bufSize < 0) |
| 7913 | { |
| 7914 | return gl::error(GL_INVALID_VALUE); |
| 7915 | } |
| 7916 | |
| 7917 | switch (pname) |
| 7918 | { |
| 7919 | case GL_NUM_SAMPLE_COUNTS: |
| 7920 | if (bufSize != 0) |
Geoff Lang | 5f4c463 | 2014-07-03 13:46:52 -0400 | [diff] [blame] | 7921 | { |
| 7922 | *params = formatCaps.sampleCounts.size(); |
| 7923 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7924 | break; |
| 7925 | case GL_SAMPLES: |
Geoff Lang | 5f4c463 | 2014-07-03 13:46:52 -0400 | [diff] [blame] | 7926 | 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] | 7927 | break; |
| 7928 | default: |
| 7929 | return gl::error(GL_INVALID_ENUM); |
| 7930 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7931 | } |
| 7932 | } |
| 7933 | |
| 7934 | // Extension functions |
| 7935 | |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 7936 | void __stdcall glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, |
| 7937 | GLbitfield mask, GLenum filter) |
| 7938 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 7939 | 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] | 7940 | "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, " |
| 7941 | "GLbitfield mask = 0x%X, GLenum filter = 0x%X)", |
| 7942 | srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 7943 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7944 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 7945 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7946 | if (context) |
| 7947 | { |
| 7948 | if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, |
| 7949 | dstX0, dstY0, dstX1, dstY1, mask, filter, |
| 7950 | true)) |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 7951 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7952 | return; |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 7953 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7954 | |
| 7955 | context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, |
| 7956 | mask, filter); |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 7957 | } |
| 7958 | } |
| 7959 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 7960 | void __stdcall glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, |
| 7961 | GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 7962 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 7963 | 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] | 7964 | "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] | 7965 | "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] | 7966 | target, level, internalformat, width, height, depth, border, format, type, pixels); |
| 7967 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7968 | UNIMPLEMENTED(); // FIXME |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 7969 | } |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 7970 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7971 | void __stdcall glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 7972 | GLenum *binaryFormat, void *binary) |
| 7973 | { |
apatrick@chromium.org | 90080e3 | 2012-07-09 22:15:33 +0000 | [diff] [blame] | 7974 | 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] | 7975 | program, bufSize, length, binaryFormat, binary); |
| 7976 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7977 | gl::Context *context = gl::getNonLostContext(); |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 7978 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7979 | if (context) |
| 7980 | { |
| 7981 | gl::Program *programObject = context->getProgram(program); |
| 7982 | |
| 7983 | if (!programObject || !programObject->isLinked()) |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 7984 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7985 | return gl::error(GL_INVALID_OPERATION); |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 7986 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7987 | |
| 7988 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7989 | |
| 7990 | if (!programBinary) |
| 7991 | { |
| 7992 | return gl::error(GL_INVALID_OPERATION); |
| 7993 | } |
| 7994 | |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame^] | 7995 | if (!programBinary->save(binaryFormat, binary, bufSize, length)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7996 | { |
| 7997 | return gl::error(GL_INVALID_OPERATION); |
| 7998 | } |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 7999 | } |
| 8000 | } |
| 8001 | |
| 8002 | void __stdcall glProgramBinaryOES(GLuint program, GLenum binaryFormat, |
| 8003 | const void *binary, GLint length) |
| 8004 | { |
| 8005 | EVENT("(GLenum program = 0x%X, binaryFormat = 0x%x, binary = 0x%0.8p, length = %d)", |
| 8006 | program, binaryFormat, binary, length); |
| 8007 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8008 | gl::Context *context = gl::getNonLostContext(); |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8009 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8010 | if (context) |
| 8011 | { |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame^] | 8012 | const std::vector<GLenum> &programBinaryFormats = context->getCaps().programBinaryFormats; |
| 8013 | if (std::find(programBinaryFormats.begin(), programBinaryFormats.end(), binaryFormat) == programBinaryFormats.end()) |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8014 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8015 | return gl::error(GL_INVALID_ENUM); |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8016 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8017 | |
| 8018 | gl::Program *programObject = context->getProgram(program); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8019 | if (!programObject) |
| 8020 | { |
| 8021 | return gl::error(GL_INVALID_OPERATION); |
| 8022 | } |
| 8023 | |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame^] | 8024 | context->setProgramBinary(program, binaryFormat, binary, length); |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8025 | } |
| 8026 | } |
| 8027 | |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8028 | void __stdcall glDrawBuffersEXT(GLsizei n, const GLenum *bufs) |
| 8029 | { |
| 8030 | EVENT("(GLenum n = %d, bufs = 0x%0.8p)", n, bufs); |
| 8031 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8032 | gl::Context *context = gl::getNonLostContext(); |
| 8033 | |
| 8034 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8035 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8036 | 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] | 8037 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8038 | return gl::error(GL_INVALID_VALUE); |
| 8039 | } |
| 8040 | |
| 8041 | if (context->getState().getDrawFramebuffer()->id() == 0) |
| 8042 | { |
| 8043 | if (n != 1) |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8044 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8045 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8046 | } |
| 8047 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8048 | 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] | 8049 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8050 | return gl::error(GL_INVALID_OPERATION); |
shannon.woods%transgaming.com@gtempaccount.com | 2fa73c5 | 2013-04-13 03:37:20 +0000 | [diff] [blame] | 8051 | } |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8052 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8053 | else |
| 8054 | { |
| 8055 | for (int colorAttachment = 0; colorAttachment < n; colorAttachment++) |
| 8056 | { |
| 8057 | const GLenum attachment = GL_COLOR_ATTACHMENT0_EXT + colorAttachment; |
| 8058 | if (bufs[colorAttachment] != GL_NONE && bufs[colorAttachment] != attachment) |
| 8059 | { |
| 8060 | return gl::error(GL_INVALID_OPERATION); |
| 8061 | } |
| 8062 | } |
| 8063 | } |
| 8064 | |
| 8065 | gl::Framebuffer *framebuffer = context->getState().getDrawFramebuffer(); |
| 8066 | |
| 8067 | for (unsigned int colorAttachment = 0; colorAttachment < static_cast<unsigned int>(n); colorAttachment++) |
| 8068 | { |
| 8069 | framebuffer->setDrawBufferState(colorAttachment, bufs[colorAttachment]); |
| 8070 | } |
| 8071 | |
| 8072 | for (unsigned int colorAttachment = n; colorAttachment < context->getCaps().maxDrawBuffers; colorAttachment++) |
| 8073 | { |
| 8074 | framebuffer->setDrawBufferState(colorAttachment, GL_NONE); |
| 8075 | } |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8076 | } |
| 8077 | } |
| 8078 | |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8079 | void __stdcall glGetBufferPointervOES(GLenum target, GLenum pname, void** params) |
| 8080 | { |
| 8081 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params); |
| 8082 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8083 | gl::Context *context = gl::getNonLostContext(); |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8084 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8085 | if (context) |
| 8086 | { |
| 8087 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8088 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8089 | return gl::error(GL_INVALID_ENUM); |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8090 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8091 | |
| 8092 | if (pname != GL_BUFFER_MAP_POINTER) |
| 8093 | { |
| 8094 | return gl::error(GL_INVALID_ENUM); |
| 8095 | } |
| 8096 | |
| 8097 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8098 | |
| 8099 | if (!buffer || !buffer->isMapped()) |
| 8100 | { |
| 8101 | *params = NULL; |
| 8102 | } |
| 8103 | else |
| 8104 | { |
| 8105 | *params = buffer->getMapPointer(); |
| 8106 | } |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8107 | } |
| 8108 | } |
| 8109 | |
| 8110 | void * __stdcall glMapBufferOES(GLenum target, GLenum access) |
| 8111 | { |
| 8112 | EVENT("(GLenum target = 0x%X, GLbitfield access = 0x%X)", target, access); |
| 8113 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8114 | gl::Context *context = gl::getNonLostContext(); |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8115 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8116 | if (context) |
| 8117 | { |
| 8118 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8119 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8120 | return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLvoid*>(NULL)); |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8121 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8122 | |
| 8123 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8124 | |
| 8125 | if (buffer == NULL) |
| 8126 | { |
| 8127 | return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL)); |
| 8128 | } |
| 8129 | |
| 8130 | if (access != GL_WRITE_ONLY_OES) |
| 8131 | { |
| 8132 | return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLvoid*>(NULL)); |
| 8133 | } |
| 8134 | |
| 8135 | if (buffer->isMapped()) |
| 8136 | { |
| 8137 | return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL)); |
| 8138 | } |
| 8139 | |
| 8140 | return buffer->mapRange(0, buffer->getSize(), GL_MAP_WRITE_BIT); |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8141 | } |
| 8142 | |
| 8143 | return NULL; |
| 8144 | } |
| 8145 | |
| 8146 | GLboolean __stdcall glUnmapBufferOES(GLenum target) |
| 8147 | { |
| 8148 | EVENT("(GLenum target = 0x%X)", target); |
| 8149 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8150 | gl::Context *context = gl::getNonLostContext(); |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8151 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8152 | if (context) |
| 8153 | { |
| 8154 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8155 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8156 | return gl::error(GL_INVALID_ENUM, GL_FALSE); |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8157 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8158 | |
| 8159 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8160 | |
| 8161 | if (buffer == NULL || !buffer->isMapped()) |
| 8162 | { |
| 8163 | return gl::error(GL_INVALID_OPERATION, GL_FALSE); |
| 8164 | } |
| 8165 | |
| 8166 | // TODO: detect if we had corruption. if so, throw an error and return false. |
| 8167 | |
| 8168 | buffer->unmap(); |
| 8169 | |
| 8170 | return GL_TRUE; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8171 | } |
| 8172 | |
| 8173 | return GL_FALSE; |
| 8174 | } |
| 8175 | |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8176 | void* __stdcall glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) |
| 8177 | { |
| 8178 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)", |
| 8179 | target, offset, length, access); |
| 8180 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8181 | gl::Context *context = gl::getNonLostContext(); |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8182 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8183 | if (context) |
| 8184 | { |
| 8185 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8186 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8187 | return gl::error(GL_INVALID_ENUM, reinterpret_cast<GLvoid*>(NULL)); |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8188 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8189 | |
| 8190 | if (offset < 0 || length < 0) |
| 8191 | { |
| 8192 | return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLvoid*>(NULL)); |
| 8193 | } |
| 8194 | |
| 8195 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8196 | |
| 8197 | if (buffer == NULL) |
| 8198 | { |
| 8199 | return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL)); |
| 8200 | } |
| 8201 | |
| 8202 | // Check for buffer overflow |
| 8203 | size_t offsetSize = static_cast<size_t>(offset); |
| 8204 | size_t lengthSize = static_cast<size_t>(length); |
| 8205 | |
| 8206 | if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) || |
| 8207 | offsetSize + lengthSize > static_cast<size_t>(buffer->getSize())) |
| 8208 | { |
| 8209 | return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLvoid*>(NULL)); |
| 8210 | } |
| 8211 | |
| 8212 | // Check for invalid bits in the mask |
| 8213 | GLbitfield allAccessBits = GL_MAP_READ_BIT | |
| 8214 | GL_MAP_WRITE_BIT | |
| 8215 | GL_MAP_INVALIDATE_RANGE_BIT | |
| 8216 | GL_MAP_INVALIDATE_BUFFER_BIT | |
| 8217 | GL_MAP_FLUSH_EXPLICIT_BIT | |
| 8218 | GL_MAP_UNSYNCHRONIZED_BIT; |
| 8219 | |
| 8220 | if (access & ~(allAccessBits)) |
| 8221 | { |
| 8222 | return gl::error(GL_INVALID_VALUE, reinterpret_cast<GLvoid*>(NULL)); |
| 8223 | } |
| 8224 | |
| 8225 | if (length == 0 || buffer->isMapped()) |
| 8226 | { |
| 8227 | return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL)); |
| 8228 | } |
| 8229 | |
| 8230 | // Check for invalid bit combinations |
| 8231 | if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0) |
| 8232 | { |
| 8233 | return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL)); |
| 8234 | } |
| 8235 | |
| 8236 | GLbitfield writeOnlyBits = GL_MAP_INVALIDATE_RANGE_BIT | |
| 8237 | GL_MAP_INVALIDATE_BUFFER_BIT | |
| 8238 | GL_MAP_UNSYNCHRONIZED_BIT; |
| 8239 | |
| 8240 | if ((access & GL_MAP_READ_BIT) != 0 && (access & writeOnlyBits) != 0) |
| 8241 | { |
| 8242 | return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL)); |
| 8243 | } |
| 8244 | |
| 8245 | if ((access & GL_MAP_WRITE_BIT) == 0 && (access & GL_MAP_FLUSH_EXPLICIT_BIT) != 0) |
| 8246 | { |
| 8247 | return gl::error(GL_INVALID_OPERATION, reinterpret_cast<GLvoid*>(NULL)); |
| 8248 | } |
| 8249 | |
| 8250 | return buffer->mapRange(offset, length, access); |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8251 | } |
| 8252 | |
| 8253 | return NULL; |
| 8254 | } |
| 8255 | |
| 8256 | void __stdcall glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length) |
| 8257 | { |
| 8258 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length); |
| 8259 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8260 | gl::Context *context = gl::getNonLostContext(); |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8261 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8262 | if (context) |
| 8263 | { |
| 8264 | if (offset < 0 || length < 0) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8265 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8266 | return gl::error(GL_INVALID_VALUE); |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8267 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8268 | |
| 8269 | if (!gl::ValidBufferTarget(context, target)) |
| 8270 | { |
| 8271 | return gl::error(GL_INVALID_ENUM); |
| 8272 | } |
| 8273 | |
| 8274 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8275 | |
| 8276 | if (buffer == NULL) |
| 8277 | { |
| 8278 | return gl::error(GL_INVALID_OPERATION); |
| 8279 | } |
| 8280 | |
| 8281 | if (!buffer->isMapped() || (buffer->getAccessFlags() & GL_MAP_FLUSH_EXPLICIT_BIT) == 0) |
| 8282 | { |
| 8283 | return gl::error(GL_INVALID_OPERATION); |
| 8284 | } |
| 8285 | |
| 8286 | // Check for buffer overflow |
| 8287 | size_t offsetSize = static_cast<size_t>(offset); |
| 8288 | size_t lengthSize = static_cast<size_t>(length); |
| 8289 | |
| 8290 | if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) || |
| 8291 | offsetSize + lengthSize > static_cast<size_t>(buffer->getMapLength())) |
| 8292 | { |
| 8293 | return gl::error(GL_INVALID_VALUE); |
| 8294 | } |
| 8295 | |
| 8296 | // We do not currently support a non-trivial implementation of FlushMappedBufferRange |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8297 | } |
| 8298 | } |
| 8299 | |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8300 | __eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *procname) |
| 8301 | { |
| 8302 | struct Extension |
| 8303 | { |
| 8304 | const char *name; |
| 8305 | __eglMustCastToProperFunctionPointerType address; |
| 8306 | }; |
| 8307 | |
| 8308 | static const Extension glExtensions[] = |
| 8309 | { |
| 8310 | {"glTexImage3DOES", (__eglMustCastToProperFunctionPointerType)glTexImage3DOES}, |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 8311 | {"glBlitFramebufferANGLE", (__eglMustCastToProperFunctionPointerType)glBlitFramebufferANGLE}, |
daniel@transgaming.com | 1fe96c9 | 2011-01-14 15:08:44 +0000 | [diff] [blame] | 8312 | {"glRenderbufferStorageMultisampleANGLE", (__eglMustCastToProperFunctionPointerType)glRenderbufferStorageMultisampleANGLE}, |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 8313 | {"glDeleteFencesNV", (__eglMustCastToProperFunctionPointerType)glDeleteFencesNV}, |
| 8314 | {"glGenFencesNV", (__eglMustCastToProperFunctionPointerType)glGenFencesNV}, |
| 8315 | {"glIsFenceNV", (__eglMustCastToProperFunctionPointerType)glIsFenceNV}, |
| 8316 | {"glTestFenceNV", (__eglMustCastToProperFunctionPointerType)glTestFenceNV}, |
| 8317 | {"glGetFenceivNV", (__eglMustCastToProperFunctionPointerType)glGetFenceivNV}, |
| 8318 | {"glFinishFenceNV", (__eglMustCastToProperFunctionPointerType)glFinishFenceNV}, |
| 8319 | {"glSetFenceNV", (__eglMustCastToProperFunctionPointerType)glSetFenceNV}, |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 8320 | {"glGetTranslatedShaderSourceANGLE", (__eglMustCastToProperFunctionPointerType)glGetTranslatedShaderSourceANGLE}, |
daniel@transgaming.com | 0bd1f2f | 2011-11-11 04:19:03 +0000 | [diff] [blame] | 8321 | {"glTexStorage2DEXT", (__eglMustCastToProperFunctionPointerType)glTexStorage2DEXT}, |
daniel@transgaming.com | 709ed11 | 2011-11-12 03:18:10 +0000 | [diff] [blame] | 8322 | {"glGetGraphicsResetStatusEXT", (__eglMustCastToProperFunctionPointerType)glGetGraphicsResetStatusEXT}, |
| 8323 | {"glReadnPixelsEXT", (__eglMustCastToProperFunctionPointerType)glReadnPixelsEXT}, |
| 8324 | {"glGetnUniformfvEXT", (__eglMustCastToProperFunctionPointerType)glGetnUniformfvEXT}, |
| 8325 | {"glGetnUniformivEXT", (__eglMustCastToProperFunctionPointerType)glGetnUniformivEXT}, |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 8326 | {"glGenQueriesEXT", (__eglMustCastToProperFunctionPointerType)glGenQueriesEXT}, |
| 8327 | {"glDeleteQueriesEXT", (__eglMustCastToProperFunctionPointerType)glDeleteQueriesEXT}, |
| 8328 | {"glIsQueryEXT", (__eglMustCastToProperFunctionPointerType)glIsQueryEXT}, |
| 8329 | {"glBeginQueryEXT", (__eglMustCastToProperFunctionPointerType)glBeginQueryEXT}, |
| 8330 | {"glEndQueryEXT", (__eglMustCastToProperFunctionPointerType)glEndQueryEXT}, |
| 8331 | {"glGetQueryivEXT", (__eglMustCastToProperFunctionPointerType)glGetQueryivEXT}, |
| 8332 | {"glGetQueryObjectuivEXT", (__eglMustCastToProperFunctionPointerType)glGetQueryObjectuivEXT}, |
shannon.woods%transgaming.com@gtempaccount.com | 77d9472 | 2013-04-13 03:34:22 +0000 | [diff] [blame] | 8333 | {"glDrawBuffersEXT", (__eglMustCastToProperFunctionPointerType)glDrawBuffersEXT}, |
daniel@transgaming.com | dce02fd | 2012-01-27 15:39:51 +0000 | [diff] [blame] | 8334 | {"glVertexAttribDivisorANGLE", (__eglMustCastToProperFunctionPointerType)glVertexAttribDivisorANGLE}, |
| 8335 | {"glDrawArraysInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawArraysInstancedANGLE}, |
| 8336 | {"glDrawElementsInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawElementsInstancedANGLE}, |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8337 | {"glGetProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glGetProgramBinaryOES}, |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8338 | {"glProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glProgramBinaryOES}, |
| 8339 | {"glGetBufferPointervOES", (__eglMustCastToProperFunctionPointerType)glGetBufferPointervOES}, |
| 8340 | {"glMapBufferOES", (__eglMustCastToProperFunctionPointerType)glMapBufferOES}, |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8341 | {"glUnmapBufferOES", (__eglMustCastToProperFunctionPointerType)glUnmapBufferOES}, |
| 8342 | {"glMapBufferRangeEXT", (__eglMustCastToProperFunctionPointerType)glMapBufferRangeEXT}, |
| 8343 | {"glFlushMappedBufferRangeEXT", (__eglMustCastToProperFunctionPointerType)glFlushMappedBufferRangeEXT}, }; |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8344 | |
shannon.woods@transgaming.com | d438fd4 | 2013-02-28 23:17:45 +0000 | [diff] [blame] | 8345 | for (unsigned int ext = 0; ext < ArraySize(glExtensions); ext++) |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8346 | { |
| 8347 | if (strcmp(procname, glExtensions[ext].name) == 0) |
| 8348 | { |
| 8349 | return (__eglMustCastToProperFunctionPointerType)glExtensions[ext].address; |
| 8350 | } |
| 8351 | } |
| 8352 | |
| 8353 | return NULL; |
| 8354 | } |
| 8355 | |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 8356 | // Non-public functions used by EGL |
| 8357 | |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 8358 | bool __stdcall glBindTexImage(egl::Surface *surface) |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8359 | { |
| 8360 | EVENT("(egl::Surface* surface = 0x%0.8p)", |
| 8361 | surface); |
| 8362 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8363 | gl::Context *context = gl::getNonLostContext(); |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8364 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8365 | if (context) |
| 8366 | { |
| 8367 | gl::Texture2D *textureObject = context->getTexture2D(); |
| 8368 | ASSERT(textureObject != NULL); |
| 8369 | |
| 8370 | if (textureObject->isImmutable()) |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8371 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8372 | return false; |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8373 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8374 | |
| 8375 | textureObject->bindTexImage(surface); |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8376 | } |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 8377 | |
| 8378 | return true; |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8379 | } |
| 8380 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8381 | } |