daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1 | // |
Geoff Lang | 48dcae7 | 2014-02-05 16:28:24 -0500 | [diff] [blame] | 2 | // Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved. |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3 | // Use of this source code is governed by a BSD-style license that can be |
| 4 | // found in the LICENSE file. |
| 5 | // |
| 6 | |
| 7 | // libGLESv2.cpp: Implements the exported OpenGL ES 2.0 functions. |
| 8 | |
daniel@transgaming.com | a0ce7e6 | 2011-01-25 14:47:16 +0000 | [diff] [blame] | 9 | #include "common/version.h" |
Geoff Lang | 0b7eef7 | 2014-06-12 14:10:47 -0400 | [diff] [blame] | 10 | #include "common/utilities.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 11 | |
| 12 | #include "libGLESv2/main.h" |
shannonwoods@chromium.org | 8dcfc6a | 2013-05-30 00:09:48 +0000 | [diff] [blame] | 13 | #include "libGLESv2/formatutils.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 14 | #include "libGLESv2/Buffer.h" |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 15 | #include "libGLESv2/Fence.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 16 | #include "libGLESv2/Framebuffer.h" |
shannon.woods@transgaming.com | 486d9e9 | 2013-02-28 23:15:41 +0000 | [diff] [blame] | 17 | #include "libGLESv2/Renderbuffer.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 18 | #include "libGLESv2/Program.h" |
apatrick@chromium.org | ea09f9b | 2012-06-08 00:45:32 +0000 | [diff] [blame] | 19 | #include "libGLESv2/ProgramBinary.h" |
daniel@transgaming.com | bbf56f7 | 2010-04-20 18:52:13 +0000 | [diff] [blame] | 20 | #include "libGLESv2/Texture.h" |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 21 | #include "libGLESv2/Query.h" |
shannon.woods@transgaming.com | 486d9e9 | 2013-02-28 23:15:41 +0000 | [diff] [blame] | 22 | #include "libGLESv2/Context.h" |
Jamie Madill | 57a8972 | 2013-07-02 11:57:03 -0400 | [diff] [blame] | 23 | #include "libGLESv2/VertexArray.h" |
Brandon Jones | 5bf9829 | 2014-06-06 17:19:38 -0700 | [diff] [blame] | 24 | #include "libGLESv2/VertexAttribute.h" |
Geoff Lang | c805845 | 2014-02-03 12:04:11 -0500 | [diff] [blame] | 25 | #include "libGLESv2/TransformFeedback.h" |
Jamie Madill | e261b44 | 2014-06-25 12:42:21 -0400 | [diff] [blame] | 26 | #include "libGLESv2/FramebufferAttachment.h" |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 27 | |
Geoff Lang | e8ebe7f | 2013-08-05 15:03:13 -0400 | [diff] [blame] | 28 | #include "libGLESv2/validationES.h" |
| 29 | #include "libGLESv2/validationES2.h" |
| 30 | #include "libGLESv2/validationES3.h" |
Jamie Madill | 55856b1 | 2014-01-02 13:59:50 -0500 | [diff] [blame] | 31 | #include "libGLESv2/queryconversions.h" |
Jamie Madill | 478fdb2 | 2013-07-19 16:36:59 -0400 | [diff] [blame] | 32 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 33 | extern "C" |
| 34 | { |
| 35 | |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 36 | // OpenGL ES 2.0 functions |
| 37 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 38 | void __stdcall glActiveTexture(GLenum texture) |
| 39 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 40 | EVENT("(GLenum texture = 0x%X)", texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 41 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 42 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 43 | if (context) |
| 44 | { |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 45 | if (texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + context->getCaps().maxCombinedTextureImageUnits - 1) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 46 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 47 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 48 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 49 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 50 | |
| 51 | context->getState().setActiveSampler(texture - GL_TEXTURE0); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 52 | } |
| 53 | } |
| 54 | |
| 55 | void __stdcall glAttachShader(GLuint program, GLuint shader) |
| 56 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 57 | EVENT("(GLuint program = %d, GLuint shader = %d)", program, shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 58 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 59 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 60 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 61 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 62 | gl::Program *programObject = context->getProgram(program); |
| 63 | gl::Shader *shaderObject = context->getShader(shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 64 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 65 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 66 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 67 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 68 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 69 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 70 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 71 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 72 | else |
| 73 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 74 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 75 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 76 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 77 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 78 | |
| 79 | if (!shaderObject) |
| 80 | { |
| 81 | if (context->getProgram(shader)) |
| 82 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 83 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 84 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 85 | } |
| 86 | else |
| 87 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 88 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 89 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 90 | } |
| 91 | } |
| 92 | |
| 93 | if (!programObject->attachShader(shaderObject)) |
| 94 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 95 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 96 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 97 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 98 | } |
| 99 | } |
| 100 | |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 101 | void __stdcall glBeginQueryEXT(GLenum target, GLuint id) |
| 102 | { |
| 103 | EVENT("(GLenum target = 0x%X, GLuint %d)", target, id); |
| 104 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 105 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 106 | if (context) |
| 107 | { |
| 108 | if (!ValidateBeginQuery(context, target, id)) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 109 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 110 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 111 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 112 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame^] | 113 | gl::Error error = context->beginQuery(target, id); |
| 114 | if (error.isError()) |
| 115 | { |
| 116 | context->recordError(error); |
| 117 | return; |
| 118 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 119 | } |
| 120 | } |
| 121 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 122 | void __stdcall glBindAttribLocation(GLuint program, GLuint index, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 123 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 124 | EVENT("(GLuint program = %d, GLuint index = %d, const GLchar* name = 0x%0.8p)", program, index, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 125 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 126 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 127 | if (context) |
| 128 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 129 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 130 | { |
| 131 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 132 | return; |
| 133 | } |
| 134 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 135 | gl::Program *programObject = context->getProgram(program); |
| 136 | |
| 137 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 138 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 139 | if (context->getShader(program)) |
daniel@transgaming.com | 9807983 | 2010-04-13 03:26:29 +0000 | [diff] [blame] | 140 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 141 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 142 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 143 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 144 | else |
| 145 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 146 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 147 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 148 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 149 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 150 | |
| 151 | if (strncmp(name, "gl_", 3) == 0) |
| 152 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 153 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 154 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | programObject->bindAttributeLocation(index, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 158 | } |
| 159 | } |
| 160 | |
| 161 | void __stdcall glBindBuffer(GLenum target, GLuint buffer) |
| 162 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 163 | EVENT("(GLenum target = 0x%X, GLuint buffer = %d)", target, buffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 164 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 165 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 166 | if (context) |
| 167 | { |
| 168 | if (!gl::ValidBufferTarget(context, target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 169 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 170 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 171 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 172 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 173 | |
| 174 | switch (target) |
| 175 | { |
| 176 | case GL_ARRAY_BUFFER: |
| 177 | context->bindArrayBuffer(buffer); |
| 178 | return; |
| 179 | case GL_ELEMENT_ARRAY_BUFFER: |
| 180 | context->bindElementArrayBuffer(buffer); |
| 181 | return; |
| 182 | case GL_COPY_READ_BUFFER: |
| 183 | context->bindCopyReadBuffer(buffer); |
| 184 | return; |
| 185 | case GL_COPY_WRITE_BUFFER: |
| 186 | context->bindCopyWriteBuffer(buffer); |
| 187 | return; |
| 188 | case GL_PIXEL_PACK_BUFFER: |
| 189 | context->bindPixelPackBuffer(buffer); |
| 190 | return; |
| 191 | case GL_PIXEL_UNPACK_BUFFER: |
| 192 | context->bindPixelUnpackBuffer(buffer); |
| 193 | return; |
| 194 | case GL_UNIFORM_BUFFER: |
| 195 | context->bindGenericUniformBuffer(buffer); |
| 196 | return; |
| 197 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 198 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 199 | return; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 200 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 201 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 202 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 203 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 204 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 205 | } |
| 206 | } |
| 207 | |
| 208 | void __stdcall glBindFramebuffer(GLenum target, GLuint framebuffer) |
| 209 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 210 | EVENT("(GLenum target = 0x%X, GLuint framebuffer = %d)", target, framebuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 211 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 212 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 213 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 214 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 215 | if (!gl::ValidFramebufferTarget(target)) |
| 216 | { |
| 217 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 218 | return; |
| 219 | } |
| 220 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 221 | if (target == GL_READ_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER) |
| 222 | { |
| 223 | context->bindReadFramebuffer(framebuffer); |
| 224 | } |
| 225 | |
| 226 | if (target == GL_DRAW_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER) |
| 227 | { |
| 228 | context->bindDrawFramebuffer(framebuffer); |
| 229 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 230 | } |
| 231 | } |
| 232 | |
| 233 | void __stdcall glBindRenderbuffer(GLenum target, GLuint renderbuffer) |
| 234 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 235 | EVENT("(GLenum target = 0x%X, GLuint renderbuffer = %d)", target, renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 236 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 237 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 238 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 239 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 240 | if (target != GL_RENDERBUFFER) |
| 241 | { |
| 242 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 243 | return; |
| 244 | } |
| 245 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 246 | context->bindRenderbuffer(renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 247 | } |
| 248 | } |
| 249 | |
| 250 | void __stdcall glBindTexture(GLenum target, GLuint texture) |
| 251 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 252 | EVENT("(GLenum target = 0x%X, GLuint texture = %d)", target, texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 253 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 254 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 255 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 256 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 257 | gl::Texture *textureObject = context->getTexture(texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 258 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 259 | if (textureObject && textureObject->getTarget() != target && texture != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 260 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 261 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 262 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 263 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 264 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 265 | switch (target) |
| 266 | { |
| 267 | case GL_TEXTURE_2D: |
| 268 | context->bindTexture2D(texture); |
| 269 | return; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 270 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 271 | case GL_TEXTURE_CUBE_MAP: |
| 272 | context->bindTextureCubeMap(texture); |
| 273 | return; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 274 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 275 | case GL_TEXTURE_3D: |
| 276 | if (context->getClientVersion() < 3) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 277 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 278 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 279 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 280 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 281 | context->bindTexture3D(texture); |
| 282 | return; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 283 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 284 | case GL_TEXTURE_2D_ARRAY: |
| 285 | if (context->getClientVersion() < 3) |
| 286 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 287 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 288 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 289 | } |
| 290 | context->bindTexture2DArray(texture); |
| 291 | return; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 292 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 293 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 294 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 295 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 296 | } |
| 297 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 298 | } |
| 299 | |
| 300 | void __stdcall glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) |
| 301 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 302 | 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] | 303 | red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 304 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 305 | gl::Context* context = gl::getNonLostContext(); |
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 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 308 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 309 | 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] | 310 | } |
| 311 | } |
| 312 | |
| 313 | void __stdcall glBlendEquation(GLenum mode) |
| 314 | { |
| 315 | glBlendEquationSeparate(mode, mode); |
| 316 | } |
| 317 | |
| 318 | void __stdcall glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) |
| 319 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 320 | EVENT("(GLenum modeRGB = 0x%X, GLenum modeAlpha = 0x%X)", modeRGB, modeAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 321 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 322 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 323 | if (context) |
| 324 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 325 | switch (modeRGB) |
| 326 | { |
| 327 | case GL_FUNC_ADD: |
| 328 | case GL_FUNC_SUBTRACT: |
| 329 | case GL_FUNC_REVERSE_SUBTRACT: |
| 330 | case GL_MIN: |
| 331 | case GL_MAX: |
| 332 | break; |
| 333 | |
| 334 | default: |
| 335 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 336 | return; |
| 337 | } |
| 338 | |
| 339 | switch (modeAlpha) |
| 340 | { |
| 341 | case GL_FUNC_ADD: |
| 342 | case GL_FUNC_SUBTRACT: |
| 343 | case GL_FUNC_REVERSE_SUBTRACT: |
| 344 | case GL_MIN: |
| 345 | case GL_MAX: |
| 346 | break; |
| 347 | |
| 348 | default: |
| 349 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 350 | return; |
| 351 | } |
| 352 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 353 | context->getState().setBlendEquation(modeRGB, modeAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 354 | } |
| 355 | } |
| 356 | |
| 357 | void __stdcall glBlendFunc(GLenum sfactor, GLenum dfactor) |
| 358 | { |
| 359 | glBlendFuncSeparate(sfactor, dfactor, sfactor, dfactor); |
| 360 | } |
| 361 | |
| 362 | void __stdcall glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) |
| 363 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 364 | 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] | 365 | srcRGB, dstRGB, srcAlpha, dstAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 366 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 367 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 368 | if (context) |
| 369 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 370 | switch (srcRGB) |
| 371 | { |
| 372 | case GL_ZERO: |
| 373 | case GL_ONE: |
| 374 | case GL_SRC_COLOR: |
| 375 | case GL_ONE_MINUS_SRC_COLOR: |
| 376 | case GL_DST_COLOR: |
| 377 | case GL_ONE_MINUS_DST_COLOR: |
| 378 | case GL_SRC_ALPHA: |
| 379 | case GL_ONE_MINUS_SRC_ALPHA: |
| 380 | case GL_DST_ALPHA: |
| 381 | case GL_ONE_MINUS_DST_ALPHA: |
| 382 | case GL_CONSTANT_COLOR: |
| 383 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 384 | case GL_CONSTANT_ALPHA: |
| 385 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 386 | case GL_SRC_ALPHA_SATURATE: |
| 387 | break; |
| 388 | |
| 389 | default: |
| 390 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 391 | return; |
| 392 | } |
| 393 | |
| 394 | switch (dstRGB) |
| 395 | { |
| 396 | case GL_ZERO: |
| 397 | case GL_ONE: |
| 398 | case GL_SRC_COLOR: |
| 399 | case GL_ONE_MINUS_SRC_COLOR: |
| 400 | case GL_DST_COLOR: |
| 401 | case GL_ONE_MINUS_DST_COLOR: |
| 402 | case GL_SRC_ALPHA: |
| 403 | case GL_ONE_MINUS_SRC_ALPHA: |
| 404 | case GL_DST_ALPHA: |
| 405 | case GL_ONE_MINUS_DST_ALPHA: |
| 406 | case GL_CONSTANT_COLOR: |
| 407 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 408 | case GL_CONSTANT_ALPHA: |
| 409 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 410 | break; |
| 411 | |
| 412 | case GL_SRC_ALPHA_SATURATE: |
| 413 | if (context->getClientVersion() < 3) |
| 414 | { |
| 415 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 416 | return; |
| 417 | } |
| 418 | break; |
| 419 | |
| 420 | default: |
| 421 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 422 | return; |
| 423 | } |
| 424 | |
| 425 | switch (srcAlpha) |
| 426 | { |
| 427 | case GL_ZERO: |
| 428 | case GL_ONE: |
| 429 | case GL_SRC_COLOR: |
| 430 | case GL_ONE_MINUS_SRC_COLOR: |
| 431 | case GL_DST_COLOR: |
| 432 | case GL_ONE_MINUS_DST_COLOR: |
| 433 | case GL_SRC_ALPHA: |
| 434 | case GL_ONE_MINUS_SRC_ALPHA: |
| 435 | case GL_DST_ALPHA: |
| 436 | case GL_ONE_MINUS_DST_ALPHA: |
| 437 | case GL_CONSTANT_COLOR: |
| 438 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 439 | case GL_CONSTANT_ALPHA: |
| 440 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 441 | case GL_SRC_ALPHA_SATURATE: |
| 442 | break; |
| 443 | |
| 444 | default: |
| 445 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 446 | return; |
| 447 | } |
| 448 | |
| 449 | switch (dstAlpha) |
| 450 | { |
| 451 | case GL_ZERO: |
| 452 | case GL_ONE: |
| 453 | case GL_SRC_COLOR: |
| 454 | case GL_ONE_MINUS_SRC_COLOR: |
| 455 | case GL_DST_COLOR: |
| 456 | case GL_ONE_MINUS_DST_COLOR: |
| 457 | case GL_SRC_ALPHA: |
| 458 | case GL_ONE_MINUS_SRC_ALPHA: |
| 459 | case GL_DST_ALPHA: |
| 460 | case GL_ONE_MINUS_DST_ALPHA: |
| 461 | case GL_CONSTANT_COLOR: |
| 462 | case GL_ONE_MINUS_CONSTANT_COLOR: |
| 463 | case GL_CONSTANT_ALPHA: |
| 464 | case GL_ONE_MINUS_CONSTANT_ALPHA: |
| 465 | break; |
| 466 | |
| 467 | case GL_SRC_ALPHA_SATURATE: |
| 468 | if (context->getClientVersion() < 3) |
| 469 | { |
| 470 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 471 | return; |
| 472 | } |
| 473 | break; |
| 474 | |
| 475 | default: |
| 476 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 477 | return; |
| 478 | } |
| 479 | |
| 480 | bool constantColorUsed = (srcRGB == GL_CONSTANT_COLOR || srcRGB == GL_ONE_MINUS_CONSTANT_COLOR || |
| 481 | dstRGB == GL_CONSTANT_COLOR || dstRGB == GL_ONE_MINUS_CONSTANT_COLOR); |
| 482 | |
| 483 | bool constantAlphaUsed = (srcRGB == GL_CONSTANT_ALPHA || srcRGB == GL_ONE_MINUS_CONSTANT_ALPHA || |
| 484 | dstRGB == GL_CONSTANT_ALPHA || dstRGB == GL_ONE_MINUS_CONSTANT_ALPHA); |
| 485 | |
| 486 | if (constantColorUsed && constantAlphaUsed) |
| 487 | { |
| 488 | ERR("Simultaneous use of GL_CONSTANT_ALPHA/GL_ONE_MINUS_CONSTANT_ALPHA and GL_CONSTANT_COLOR/GL_ONE_MINUS_CONSTANT_COLOR invalid under WebGL"); |
| 489 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 490 | return; |
| 491 | } |
| 492 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 493 | context->getState().setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 494 | } |
| 495 | } |
| 496 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 497 | 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] | 498 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 499 | 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] | 500 | target, size, data, usage); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 501 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 502 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 503 | if (context) |
| 504 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 505 | if (size < 0) |
| 506 | { |
| 507 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 508 | return; |
| 509 | } |
| 510 | |
| 511 | switch (usage) |
| 512 | { |
| 513 | case GL_STREAM_DRAW: |
| 514 | case GL_STATIC_DRAW: |
| 515 | case GL_DYNAMIC_DRAW: |
| 516 | break; |
| 517 | |
| 518 | case GL_STREAM_READ: |
| 519 | case GL_STREAM_COPY: |
| 520 | case GL_STATIC_READ: |
| 521 | case GL_STATIC_COPY: |
| 522 | case GL_DYNAMIC_READ: |
| 523 | case GL_DYNAMIC_COPY: |
| 524 | if (context->getClientVersion() < 3) |
| 525 | { |
| 526 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 527 | return; |
| 528 | } |
| 529 | break; |
| 530 | |
| 531 | default: |
| 532 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 533 | return; |
| 534 | } |
| 535 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 536 | if (!gl::ValidBufferTarget(context, target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 537 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 538 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 539 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 540 | } |
| 541 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 542 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 543 | |
| 544 | if (!buffer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 545 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 546 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 547 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 548 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 549 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 550 | gl::Error error = buffer->bufferData(data, size, usage); |
| 551 | if (error.isError()) |
| 552 | { |
| 553 | context->recordError(error); |
| 554 | return; |
| 555 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 556 | } |
| 557 | } |
| 558 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 559 | 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] | 560 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 561 | 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] | 562 | target, offset, size, data); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 563 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 564 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 565 | if (context) |
| 566 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 567 | if (size < 0 || offset < 0) |
| 568 | { |
| 569 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 570 | return; |
| 571 | } |
| 572 | |
| 573 | if (data == NULL) |
| 574 | { |
| 575 | return; |
| 576 | } |
| 577 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 578 | if (!gl::ValidBufferTarget(context, target)) |
| 579 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 580 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 581 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 582 | } |
| 583 | |
| 584 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 585 | |
| 586 | if (!buffer) |
| 587 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 588 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 589 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 590 | } |
| 591 | |
| 592 | if (buffer->isMapped()) |
| 593 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 594 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 595 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 596 | } |
| 597 | |
| 598 | // Check for possible overflow of size + offset |
| 599 | if (!rx::IsUnsignedAdditionSafe<size_t>(size, offset)) |
| 600 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 601 | context->recordError(gl::Error(GL_OUT_OF_MEMORY)); |
| 602 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 603 | } |
| 604 | |
| 605 | if (size + offset > buffer->getSize()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 606 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 607 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 608 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 609 | } |
| 610 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 611 | gl::Error error = buffer->bufferSubData(data, size, offset); |
| 612 | if (error.isError()) |
| 613 | { |
| 614 | context->recordError(error); |
| 615 | return; |
| 616 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 617 | } |
| 618 | } |
| 619 | |
| 620 | GLenum __stdcall glCheckFramebufferStatus(GLenum target) |
| 621 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 622 | EVENT("(GLenum target = 0x%X)", target); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 623 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 624 | gl::Context *context = gl::getNonLostContext(); |
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 | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 627 | if (!gl::ValidFramebufferTarget(target)) |
| 628 | { |
| 629 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 630 | return 0; |
| 631 | } |
| 632 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 633 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 634 | ASSERT(framebuffer); |
| 635 | return framebuffer->completeness(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 636 | } |
| 637 | |
| 638 | return 0; |
| 639 | } |
| 640 | |
| 641 | void __stdcall glClear(GLbitfield mask) |
| 642 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 643 | EVENT("(GLbitfield mask = 0x%X)", mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 644 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 645 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 646 | if (context) |
| 647 | { |
| 648 | gl::Framebuffer *framebufferObject = context->getState().getDrawFramebuffer(); |
| 649 | |
| 650 | if (!framebufferObject || framebufferObject->completeness() != GL_FRAMEBUFFER_COMPLETE) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 651 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 652 | context->recordError(gl::Error(GL_INVALID_FRAMEBUFFER_OPERATION)); |
| 653 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 654 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 655 | |
| 656 | if ((mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0) |
| 657 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 658 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 659 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 660 | } |
| 661 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 662 | gl::Error error = context->clear(mask); |
| 663 | if (error.isError()) |
| 664 | { |
| 665 | context->recordError(error); |
| 666 | return; |
| 667 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 668 | } |
| 669 | } |
| 670 | |
| 671 | void __stdcall glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) |
| 672 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 673 | 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] | 674 | red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 675 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 676 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 677 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 678 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 679 | context->getState().setClearColor(red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 680 | } |
| 681 | } |
| 682 | |
| 683 | void __stdcall glClearDepthf(GLclampf depth) |
| 684 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 685 | EVENT("(GLclampf depth = %f)", depth); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 686 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 687 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 688 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 689 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 690 | context->getState().setClearDepth(depth); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 691 | } |
| 692 | } |
| 693 | |
| 694 | void __stdcall glClearStencil(GLint s) |
| 695 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 696 | EVENT("(GLint s = %d)", s); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 697 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 698 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 699 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 700 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 701 | context->getState().setClearStencil(s); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 702 | } |
| 703 | } |
| 704 | |
| 705 | void __stdcall glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) |
| 706 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 707 | 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] | 708 | red, green, blue, alpha); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 709 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 710 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 711 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 712 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 713 | 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] | 714 | } |
| 715 | } |
| 716 | |
| 717 | void __stdcall glCompileShader(GLuint shader) |
| 718 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 719 | EVENT("(GLuint shader = %d)", shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 720 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 721 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 722 | if (context) |
| 723 | { |
| 724 | gl::Shader *shaderObject = context->getShader(shader); |
| 725 | |
| 726 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 727 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 728 | if (context->getProgram(shader)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 729 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 730 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 731 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 732 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 733 | else |
daniel@transgaming.com | 5d752f2 | 2010-10-07 13:37:20 +0000 | [diff] [blame] | 734 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 735 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 736 | return; |
daniel@transgaming.com | 5d752f2 | 2010-10-07 13:37:20 +0000 | [diff] [blame] | 737 | } |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 738 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 739 | |
| 740 | shaderObject->compile(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 741 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 742 | } |
| 743 | |
| 744 | void __stdcall glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, |
| 745 | GLint border, GLsizei imageSize, const GLvoid* data) |
| 746 | { |
| 747 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " |
| 748 | "GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
| 749 | target, level, internalformat, width, height, border, imageSize, data); |
| 750 | |
| 751 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 752 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 753 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 754 | if (context->getClientVersion() < 3 && |
| 755 | !ValidateES2TexImageParameters(context, target, level, internalformat, true, false, |
| 756 | 0, 0, width, height, border, GL_NONE, GL_NONE, data)) |
| 757 | { |
| 758 | return; |
| 759 | } |
| 760 | |
| 761 | if (context->getClientVersion() >= 3 && |
| 762 | !ValidateES3TexImageParameters(context, target, level, internalformat, true, false, |
| 763 | 0, 0, 0, width, height, 1, border, GL_NONE, GL_NONE, data)) |
| 764 | { |
| 765 | return; |
| 766 | } |
| 767 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 768 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat); |
| 769 | 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] | 770 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 771 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 772 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 773 | } |
| 774 | |
| 775 | switch (target) |
| 776 | { |
| 777 | case GL_TEXTURE_2D: |
| 778 | { |
| 779 | gl::Texture2D *texture = context->getTexture2D(); |
| 780 | texture->setCompressedImage(level, internalformat, width, height, imageSize, data); |
| 781 | } |
| 782 | break; |
| 783 | |
| 784 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 785 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 786 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 787 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 788 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 789 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 790 | { |
| 791 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 792 | texture->setCompressedImage(target, level, internalformat, width, height, imageSize, data); |
| 793 | } |
| 794 | break; |
| 795 | |
| 796 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 797 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 798 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 799 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 800 | } |
| 801 | } |
| 802 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 803 | void __stdcall glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, |
| 804 | GLenum format, GLsizei imageSize, const GLvoid* data) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 805 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 806 | 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] | 807 | "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, " |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 808 | "GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 809 | target, level, xoffset, yoffset, width, height, format, imageSize, data); |
| 810 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 811 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 812 | if (context) |
| 813 | { |
| 814 | if (context->getClientVersion() < 3 && |
| 815 | !ValidateES2TexImageParameters(context, target, level, GL_NONE, true, true, |
| 816 | xoffset, yoffset, width, height, 0, GL_NONE, GL_NONE, data)) |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 817 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 818 | return; |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 819 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 820 | |
| 821 | if (context->getClientVersion() >= 3 && |
| 822 | !ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true, |
| 823 | xoffset, yoffset, 0, width, height, 1, 0, GL_NONE, GL_NONE, data)) |
| 824 | { |
| 825 | return; |
| 826 | } |
| 827 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 828 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format); |
| 829 | 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] | 830 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 831 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 832 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 833 | } |
| 834 | |
| 835 | switch (target) |
| 836 | { |
| 837 | case GL_TEXTURE_2D: |
| 838 | { |
| 839 | gl::Texture2D *texture = context->getTexture2D(); |
| 840 | texture->subImageCompressed(level, xoffset, yoffset, width, height, format, imageSize, data); |
| 841 | } |
| 842 | break; |
| 843 | |
| 844 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 845 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 846 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 847 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 848 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 849 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 850 | { |
| 851 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 852 | texture->subImageCompressed(target, level, xoffset, yoffset, width, height, format, imageSize, data); |
| 853 | } |
| 854 | break; |
| 855 | |
| 856 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 857 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 858 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 859 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 860 | } |
| 861 | } |
| 862 | |
| 863 | void __stdcall glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) |
| 864 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 865 | 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] | 866 | "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] | 867 | target, level, internalformat, x, y, width, height, border); |
| 868 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 869 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 870 | if (context) |
| 871 | { |
| 872 | if (context->getClientVersion() < 3 && |
| 873 | !ValidateES2CopyTexImageParameters(context, target, level, internalformat, false, |
| 874 | 0, 0, x, y, width, height, border)) |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 875 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 876 | return; |
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 | |
| 879 | if (context->getClientVersion() >= 3 && |
| 880 | !ValidateES3CopyTexImageParameters(context, target, level, internalformat, false, |
| 881 | 0, 0, 0, x, y, width, height, border)) |
| 882 | { |
| 883 | return; |
| 884 | } |
| 885 | |
| 886 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 887 | |
| 888 | switch (target) |
| 889 | { |
| 890 | case GL_TEXTURE_2D: |
| 891 | { |
| 892 | gl::Texture2D *texture = context->getTexture2D(); |
| 893 | texture->copyImage(level, internalformat, x, y, width, height, framebuffer); |
| 894 | } |
| 895 | break; |
| 896 | |
| 897 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 898 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 899 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 900 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 901 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 902 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 903 | { |
| 904 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 905 | texture->copyImage(target, level, internalformat, x, y, width, height, framebuffer); |
| 906 | } |
| 907 | break; |
| 908 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 909 | default: |
| 910 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 911 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 912 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 913 | } |
| 914 | } |
| 915 | |
| 916 | void __stdcall glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
| 917 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 918 | 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] | 919 | "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] | 920 | target, level, xoffset, yoffset, x, y, width, height); |
| 921 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 922 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 923 | if (context) |
| 924 | { |
| 925 | if (context->getClientVersion() < 3 && |
| 926 | !ValidateES2CopyTexImageParameters(context, target, level, GL_NONE, true, |
| 927 | xoffset, yoffset, x, y, width, height, 0)) |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 928 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 929 | return; |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 930 | } |
daniel@transgaming.com | b8c28ed | 2010-04-13 03:26:32 +0000 | [diff] [blame] | 931 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 932 | if (context->getClientVersion() >= 3 && |
| 933 | !ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true, |
| 934 | xoffset, yoffset, 0, x, y, width, height, 0)) |
| 935 | { |
| 936 | return; |
| 937 | } |
| 938 | |
| 939 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 940 | |
| 941 | switch (target) |
| 942 | { |
| 943 | case GL_TEXTURE_2D: |
| 944 | { |
| 945 | gl::Texture2D *texture = context->getTexture2D(); |
| 946 | texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer); |
| 947 | } |
| 948 | break; |
| 949 | |
| 950 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 951 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 952 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 953 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 954 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 955 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 956 | { |
| 957 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 958 | texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, framebuffer); |
| 959 | } |
| 960 | break; |
| 961 | |
| 962 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 963 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 964 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 965 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 966 | } |
| 967 | } |
| 968 | |
| 969 | GLuint __stdcall glCreateProgram(void) |
| 970 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 971 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 972 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 973 | gl::Context *context = gl::getNonLostContext(); |
| 974 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 975 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 976 | return context->createProgram(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 977 | } |
| 978 | |
| 979 | return 0; |
| 980 | } |
| 981 | |
| 982 | GLuint __stdcall glCreateShader(GLenum type) |
| 983 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 984 | EVENT("(GLenum type = 0x%X)", type); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 985 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 986 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 987 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 988 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 989 | switch (type) |
| 990 | { |
| 991 | case GL_FRAGMENT_SHADER: |
| 992 | case GL_VERTEX_SHADER: |
| 993 | return context->createShader(type); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 994 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 995 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 996 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 997 | return 0; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 998 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 999 | } |
| 1000 | |
| 1001 | return 0; |
| 1002 | } |
| 1003 | |
| 1004 | void __stdcall glCullFace(GLenum mode) |
| 1005 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1006 | EVENT("(GLenum mode = 0x%X)", mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1007 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1008 | gl::Context *context = gl::getNonLostContext(); |
| 1009 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1010 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1011 | switch (mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1012 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1013 | case GL_FRONT: |
| 1014 | case GL_BACK: |
| 1015 | case GL_FRONT_AND_BACK: |
| 1016 | break; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1017 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1018 | default: |
| 1019 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1020 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1021 | } |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1022 | |
| 1023 | context->getState().setCullMode(mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1024 | } |
| 1025 | } |
| 1026 | |
| 1027 | void __stdcall glDeleteBuffers(GLsizei n, const GLuint* buffers) |
| 1028 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1029 | 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] | 1030 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1031 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1032 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1033 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1034 | if (n < 0) |
| 1035 | { |
| 1036 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1037 | return; |
| 1038 | } |
| 1039 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1040 | for (int i = 0; i < n; i++) |
| 1041 | { |
| 1042 | context->deleteBuffer(buffers[i]); |
| 1043 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1044 | } |
| 1045 | } |
| 1046 | |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1047 | void __stdcall glDeleteFencesNV(GLsizei n, const GLuint* fences) |
| 1048 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1049 | 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] | 1050 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1051 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1052 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1053 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1054 | if (n < 0) |
| 1055 | { |
| 1056 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1057 | return; |
| 1058 | } |
| 1059 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1060 | for (int i = 0; i < n; i++) |
| 1061 | { |
| 1062 | context->deleteFenceNV(fences[i]); |
| 1063 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1064 | } |
| 1065 | } |
| 1066 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1067 | void __stdcall glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) |
| 1068 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1069 | 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] | 1070 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1071 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1072 | if (context) |
| 1073 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1074 | if (n < 0) |
| 1075 | { |
| 1076 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1077 | return; |
| 1078 | } |
| 1079 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1080 | for (int i = 0; i < n; i++) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1081 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1082 | if (framebuffers[i] != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1083 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1084 | context->deleteFramebuffer(framebuffers[i]); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1085 | } |
| 1086 | } |
| 1087 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1088 | } |
| 1089 | |
| 1090 | void __stdcall glDeleteProgram(GLuint program) |
| 1091 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1092 | EVENT("(GLuint program = %d)", program); |
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 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1095 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1096 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1097 | if (program == 0) |
| 1098 | { |
| 1099 | return; |
| 1100 | } |
| 1101 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1102 | if (!context->getProgram(program)) |
| 1103 | { |
| 1104 | if(context->getShader(program)) |
| 1105 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1106 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1107 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1108 | } |
| 1109 | else |
| 1110 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1111 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1112 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1113 | } |
| 1114 | } |
| 1115 | |
| 1116 | context->deleteProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1117 | } |
| 1118 | } |
| 1119 | |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1120 | void __stdcall glDeleteQueriesEXT(GLsizei n, const GLuint *ids) |
| 1121 | { |
| 1122 | EVENT("(GLsizei n = %d, const GLuint *ids = 0x%0.8p)", n, ids); |
| 1123 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1124 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1125 | if (context) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1126 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1127 | if (n < 0) |
| 1128 | { |
| 1129 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1130 | return; |
| 1131 | } |
| 1132 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1133 | for (int i = 0; i < n; i++) |
| 1134 | { |
| 1135 | context->deleteQuery(ids[i]); |
| 1136 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1137 | } |
| 1138 | } |
| 1139 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1140 | void __stdcall glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) |
| 1141 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1142 | 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] | 1143 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1144 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1145 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1146 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1147 | if (n < 0) |
| 1148 | { |
| 1149 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1150 | return; |
| 1151 | } |
| 1152 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1153 | for (int i = 0; i < n; i++) |
| 1154 | { |
| 1155 | context->deleteRenderbuffer(renderbuffers[i]); |
| 1156 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1157 | } |
| 1158 | } |
| 1159 | |
| 1160 | void __stdcall glDeleteShader(GLuint shader) |
| 1161 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1162 | EVENT("(GLuint shader = %d)", shader); |
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 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1165 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1166 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1167 | if (shader == 0) |
| 1168 | { |
| 1169 | return; |
| 1170 | } |
| 1171 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1172 | if (!context->getShader(shader)) |
| 1173 | { |
| 1174 | if(context->getProgram(shader)) |
| 1175 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1176 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1177 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1178 | } |
| 1179 | else |
| 1180 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1181 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1182 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1183 | } |
| 1184 | } |
| 1185 | |
| 1186 | context->deleteShader(shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1187 | } |
| 1188 | } |
| 1189 | |
| 1190 | void __stdcall glDeleteTextures(GLsizei n, const GLuint* textures) |
| 1191 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1192 | 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] | 1193 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1194 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1195 | if (context) |
| 1196 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1197 | if (n < 0) |
| 1198 | { |
| 1199 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1200 | return; |
| 1201 | } |
| 1202 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1203 | for (int i = 0; i < n; i++) |
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 | if (textures[i] != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1206 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1207 | context->deleteTexture(textures[i]); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1208 | } |
| 1209 | } |
| 1210 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1211 | } |
| 1212 | |
| 1213 | void __stdcall glDepthFunc(GLenum func) |
| 1214 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1215 | EVENT("(GLenum func = 0x%X)", func); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1216 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1217 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1218 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1219 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1220 | switch (func) |
| 1221 | { |
| 1222 | case GL_NEVER: |
| 1223 | case GL_ALWAYS: |
| 1224 | case GL_LESS: |
| 1225 | case GL_LEQUAL: |
| 1226 | case GL_EQUAL: |
| 1227 | case GL_GREATER: |
| 1228 | case GL_GEQUAL: |
| 1229 | case GL_NOTEQUAL: |
| 1230 | context->getState().setDepthFunc(func); |
| 1231 | break; |
| 1232 | |
| 1233 | default: |
| 1234 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1235 | return; |
| 1236 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1237 | } |
| 1238 | } |
| 1239 | |
| 1240 | void __stdcall glDepthMask(GLboolean flag) |
| 1241 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 1242 | EVENT("(GLboolean flag = %u)", flag); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1243 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1244 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1245 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1246 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1247 | context->getState().setDepthMask(flag != GL_FALSE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1248 | } |
| 1249 | } |
| 1250 | |
| 1251 | void __stdcall glDepthRangef(GLclampf zNear, GLclampf zFar) |
| 1252 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1253 | EVENT("(GLclampf zNear = %f, GLclampf zFar = %f)", zNear, zFar); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1254 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1255 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1256 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1257 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1258 | context->getState().setDepthRange(zNear, zFar); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1259 | } |
| 1260 | } |
| 1261 | |
| 1262 | void __stdcall glDetachShader(GLuint program, GLuint shader) |
| 1263 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1264 | EVENT("(GLuint program = %d, GLuint shader = %d)", program, shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1265 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1266 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1267 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1268 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1269 | gl::Program *programObject = context->getProgram(program); |
| 1270 | gl::Shader *shaderObject = context->getShader(shader); |
| 1271 | |
| 1272 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1273 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1274 | gl::Shader *shaderByProgramHandle; |
| 1275 | shaderByProgramHandle = context->getShader(program); |
| 1276 | if (!shaderByProgramHandle) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1277 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1278 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1279 | return; |
daniel@transgaming.com | 73c2c2e | 2010-04-13 03:26:11 +0000 | [diff] [blame] | 1280 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1281 | else |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1282 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1283 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1284 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1285 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1286 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1287 | |
| 1288 | if (!shaderObject) |
| 1289 | { |
| 1290 | gl::Program *programByShaderHandle = context->getProgram(shader); |
| 1291 | if (!programByShaderHandle) |
| 1292 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1293 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1294 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1295 | } |
| 1296 | else |
| 1297 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1298 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1299 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1300 | } |
| 1301 | } |
| 1302 | |
| 1303 | if (!programObject->detachShader(shaderObject)) |
| 1304 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1305 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1306 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1307 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1308 | } |
| 1309 | } |
| 1310 | |
| 1311 | void __stdcall glDisable(GLenum cap) |
| 1312 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1313 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1314 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1315 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1316 | if (context) |
| 1317 | { |
| 1318 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1319 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1320 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1321 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1322 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1323 | |
| 1324 | context->getState().setEnableFeature(cap, false); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1325 | } |
| 1326 | } |
| 1327 | |
| 1328 | void __stdcall glDisableVertexAttribArray(GLuint index) |
| 1329 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1330 | EVENT("(GLuint index = %d)", index); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1331 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1332 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1333 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1334 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1335 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 1336 | { |
| 1337 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1338 | return; |
| 1339 | } |
| 1340 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1341 | context->getState().setEnableVertexAttribArray(index, false); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1342 | } |
| 1343 | } |
| 1344 | |
| 1345 | void __stdcall glDrawArrays(GLenum mode, GLint first, GLsizei count) |
| 1346 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1347 | 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] | 1348 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1349 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1350 | if (context) |
| 1351 | { |
Jamie Madill | 2b97681 | 2014-08-25 15:47:49 -0400 | [diff] [blame] | 1352 | if (!ValidateDrawArrays(context, mode, first, count, 0)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1353 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1354 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1355 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1356 | |
| 1357 | context->drawArrays(mode, first, count, 0); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1358 | } |
| 1359 | } |
| 1360 | |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1361 | void __stdcall glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount) |
| 1362 | { |
| 1363 | EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei primcount = %d)", mode, first, count, primcount); |
| 1364 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1365 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1366 | if (context) |
| 1367 | { |
| 1368 | if (!ValidateDrawArraysInstanced(context, mode, first, count, primcount)) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1369 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1370 | return; |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1371 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1372 | |
| 1373 | context->drawArrays(mode, first, count, primcount); |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1374 | } |
| 1375 | } |
| 1376 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 1377 | 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] | 1378 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1379 | 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] | 1380 | mode, count, type, indices); |
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 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1383 | if (context) |
| 1384 | { |
Jamie Madill | 2b97681 | 2014-08-25 15:47:49 -0400 | [diff] [blame] | 1385 | rx::RangeUI indexRange; |
| 1386 | if (!ValidateDrawElements(context, mode, count, type, indices, 0, &indexRange)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1387 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1388 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1389 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1390 | |
Jamie Madill | 2b97681 | 2014-08-25 15:47:49 -0400 | [diff] [blame] | 1391 | context->drawElements(mode, count, type, indices, 0, indexRange); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1392 | } |
| 1393 | } |
| 1394 | |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1395 | void __stdcall glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount) |
| 1396 | { |
| 1397 | EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei primcount = %d)", |
| 1398 | mode, count, type, indices, primcount); |
| 1399 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1400 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1401 | if (context) |
| 1402 | { |
Jamie Madill | 2b97681 | 2014-08-25 15:47:49 -0400 | [diff] [blame] | 1403 | rx::RangeUI indexRange; |
| 1404 | if (!ValidateDrawElementsInstanced(context, mode, count, type, indices, primcount, &indexRange)) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1405 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1406 | return; |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1407 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1408 | |
Jamie Madill | 2b97681 | 2014-08-25 15:47:49 -0400 | [diff] [blame] | 1409 | context->drawElements(mode, count, type, indices, primcount, indexRange); |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 1410 | } |
| 1411 | } |
| 1412 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1413 | void __stdcall glEnable(GLenum cap) |
| 1414 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1415 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1416 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1417 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1418 | if (context) |
| 1419 | { |
| 1420 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1421 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1422 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1423 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1424 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1425 | |
| 1426 | context->getState().setEnableFeature(cap, true); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1427 | } |
| 1428 | } |
| 1429 | |
| 1430 | void __stdcall glEnableVertexAttribArray(GLuint index) |
| 1431 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1432 | EVENT("(GLuint index = %d)", index); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1433 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1434 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1435 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1436 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1437 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 1438 | { |
| 1439 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1440 | return; |
| 1441 | } |
| 1442 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1443 | context->getState().setEnableVertexAttribArray(index, true); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1444 | } |
| 1445 | } |
| 1446 | |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1447 | void __stdcall glEndQueryEXT(GLenum target) |
| 1448 | { |
| 1449 | EVENT("GLenum target = 0x%X)", target); |
| 1450 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1451 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1452 | if (context) |
| 1453 | { |
| 1454 | if (!ValidateEndQuery(context, target)) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1455 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1456 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1457 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1458 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame^] | 1459 | gl::Error error = context->endQuery(target); |
| 1460 | if (error.isError()) |
| 1461 | { |
| 1462 | context->recordError(error); |
| 1463 | return; |
| 1464 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1465 | } |
| 1466 | } |
| 1467 | |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1468 | void __stdcall glFinishFenceNV(GLuint fence) |
| 1469 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1470 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1471 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1472 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1473 | if (context) |
| 1474 | { |
| 1475 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 1476 | |
| 1477 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1478 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1479 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1480 | return; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1481 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1482 | |
| 1483 | if (fenceObject->isFence() != GL_TRUE) |
| 1484 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1485 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1486 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1487 | } |
| 1488 | |
| 1489 | fenceObject->finishFence(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1490 | } |
| 1491 | } |
| 1492 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1493 | void __stdcall glFinish(void) |
| 1494 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1495 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1496 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1497 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1498 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1499 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1500 | context->sync(true); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1501 | } |
| 1502 | } |
| 1503 | |
| 1504 | void __stdcall glFlush(void) |
| 1505 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1506 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1507 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1508 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1509 | if (context) |
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 | context->sync(false); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1512 | } |
| 1513 | } |
| 1514 | |
| 1515 | void __stdcall glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) |
| 1516 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1517 | 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] | 1518 | "GLuint renderbuffer = %d)", target, attachment, renderbuffertarget, renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1519 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1520 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1521 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1522 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1523 | if (!gl::ValidFramebufferTarget(target) || (renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0)) |
| 1524 | { |
| 1525 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1526 | return; |
| 1527 | } |
| 1528 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1529 | if (!gl::ValidateFramebufferRenderbufferParameters(context, target, attachment, renderbuffertarget, renderbuffer)) |
| 1530 | { |
| 1531 | return; |
| 1532 | } |
| 1533 | |
| 1534 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 1535 | ASSERT(framebuffer); |
| 1536 | |
| 1537 | if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT) |
| 1538 | { |
| 1539 | unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT); |
| 1540 | framebuffer->setColorbuffer(colorAttachment, GL_RENDERBUFFER, renderbuffer, 0, 0); |
| 1541 | } |
| 1542 | else |
| 1543 | { |
| 1544 | switch (attachment) |
| 1545 | { |
| 1546 | case GL_DEPTH_ATTACHMENT: |
| 1547 | framebuffer->setDepthbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0); |
| 1548 | break; |
| 1549 | case GL_STENCIL_ATTACHMENT: |
| 1550 | framebuffer->setStencilbuffer(GL_RENDERBUFFER, renderbuffer, 0, 0); |
| 1551 | break; |
| 1552 | case GL_DEPTH_STENCIL_ATTACHMENT: |
| 1553 | framebuffer->setDepthStencilBuffer(GL_RENDERBUFFER, renderbuffer, 0, 0); |
| 1554 | break; |
| 1555 | default: |
| 1556 | UNREACHABLE(); |
| 1557 | break; |
| 1558 | } |
| 1559 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1560 | } |
| 1561 | } |
| 1562 | |
| 1563 | void __stdcall glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) |
| 1564 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1565 | 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] | 1566 | "GLuint texture = %d, GLint level = %d)", target, attachment, textarget, texture, level); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1567 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1568 | gl::Context *context = gl::getNonLostContext(); |
| 1569 | if (context) |
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 | if (!ValidateFramebufferTexture2D(context, target, attachment, textarget, texture, level)) |
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 | return; |
| 1574 | } |
shannon.woods%transgaming.com@gtempaccount.com | 89ae113 | 2013-04-13 03:28:43 +0000 | [diff] [blame] | 1575 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1576 | if (texture == 0) |
| 1577 | { |
| 1578 | textarget = GL_NONE; |
| 1579 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1580 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1581 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1582 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1583 | if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT) |
| 1584 | { |
| 1585 | const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT); |
| 1586 | framebuffer->setColorbuffer(colorAttachment, textarget, texture, level, 0); |
| 1587 | } |
| 1588 | else |
| 1589 | { |
| 1590 | switch (attachment) |
daniel@transgaming.com | fbc0953 | 2010-04-26 15:33:41 +0000 | [diff] [blame] | 1591 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1592 | case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level, 0); break; |
| 1593 | case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level, 0); break; |
| 1594 | 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] | 1595 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1596 | } |
| 1597 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1598 | } |
| 1599 | |
| 1600 | void __stdcall glFrontFace(GLenum mode) |
| 1601 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1602 | EVENT("(GLenum mode = 0x%X)", mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1603 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1604 | gl::Context *context = gl::getNonLostContext(); |
| 1605 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1606 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1607 | switch (mode) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1608 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1609 | case GL_CW: |
| 1610 | case GL_CCW: |
| 1611 | context->getState().setFrontFace(mode); |
| 1612 | break; |
| 1613 | default: |
| 1614 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1615 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1616 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1617 | } |
| 1618 | } |
| 1619 | |
| 1620 | void __stdcall glGenBuffers(GLsizei n, GLuint* buffers) |
| 1621 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1622 | EVENT("(GLsizei n = %d, GLuint* buffers = 0x%0.8p)", n, buffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1623 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1624 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1625 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1626 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1627 | if (n < 0) |
| 1628 | { |
| 1629 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1630 | return; |
| 1631 | } |
| 1632 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1633 | for (int i = 0; i < n; i++) |
| 1634 | { |
| 1635 | buffers[i] = context->createBuffer(); |
| 1636 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1637 | } |
| 1638 | } |
| 1639 | |
| 1640 | void __stdcall glGenerateMipmap(GLenum target) |
| 1641 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1642 | EVENT("(GLenum target = 0x%X)", target); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1643 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1644 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1645 | if (context) |
| 1646 | { |
| 1647 | if (!ValidTextureTarget(context, target)) |
daniel@transgaming.com | 8fd99e2 | 2010-04-20 18:52:00 +0000 | [diff] [blame] | 1648 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1649 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 1650 | return; |
daniel@transgaming.com | 8fd99e2 | 2010-04-20 18:52:00 +0000 | [diff] [blame] | 1651 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1652 | |
| 1653 | gl::Texture *texture = context->getTargetTexture(target); |
| 1654 | |
| 1655 | if (texture == NULL) |
| 1656 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1657 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1658 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1659 | } |
| 1660 | |
| 1661 | GLenum internalFormat = texture->getBaseLevelInternalFormat(); |
| 1662 | const gl::TextureCaps &formatCaps = context->getTextureCaps().get(internalFormat); |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 1663 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1664 | |
| 1665 | // GenerateMipmap should not generate an INVALID_OPERATION for textures created with |
| 1666 | // unsized formats or that are color renderable and filterable. Since we do not track if |
| 1667 | // the texture was created with sized or unsized format (only sized formats are stored), |
| 1668 | // it is not possible to make sure the the LUMA formats can generate mipmaps (they should |
| 1669 | // be able to) because they aren't color renderable. Simply do a special case for LUMA |
| 1670 | // textures since they're the only texture format that can be created with unsized formats |
| 1671 | // that is not color renderable. New unsized formats are unlikely to be added, since ES2 |
| 1672 | // was the last version to use add them. |
| 1673 | bool isLUMA = internalFormat == GL_LUMINANCE8_EXT || |
| 1674 | internalFormat == GL_LUMINANCE8_ALPHA8_EXT || |
| 1675 | internalFormat == GL_ALPHA8_EXT; |
| 1676 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 1677 | if (formatInfo.depthBits > 0 || formatInfo.stencilBits > 0 || !formatCaps.filterable || |
| 1678 | (!formatCaps.renderable && !isLUMA) || formatInfo.compressed) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1679 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1680 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1681 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1682 | } |
| 1683 | |
| 1684 | // GL_EXT_sRGB does not support mipmap generation on sRGB textures |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 1685 | if (context->getClientVersion() == 2 && formatInfo.colorEncoding == GL_SRGB) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1686 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1687 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1688 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1689 | } |
| 1690 | |
| 1691 | // Non-power of 2 ES2 check |
| 1692 | if (!context->getExtensions().textureNPOT && (!gl::isPow2(texture->getBaseLevelWidth()) || !gl::isPow2(texture->getBaseLevelHeight()))) |
| 1693 | { |
| 1694 | ASSERT(context->getClientVersion() <= 2 && (target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP)); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1695 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1696 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1697 | } |
| 1698 | |
| 1699 | // Cube completeness check |
| 1700 | if (target == GL_TEXTURE_CUBE_MAP) |
| 1701 | { |
| 1702 | gl::TextureCubeMap *textureCube = static_cast<gl::TextureCubeMap *>(texture); |
| 1703 | if (!textureCube->isCubeComplete()) |
| 1704 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1705 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1706 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1707 | } |
| 1708 | } |
| 1709 | |
| 1710 | texture->generateMipmaps(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1711 | } |
| 1712 | } |
| 1713 | |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1714 | void __stdcall glGenFencesNV(GLsizei n, GLuint* fences) |
| 1715 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1716 | EVENT("(GLsizei n = %d, GLuint* fences = 0x%0.8p)", n, fences); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1717 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1718 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1719 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1720 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1721 | if (n < 0) |
| 1722 | { |
| 1723 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1724 | return; |
| 1725 | } |
| 1726 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1727 | for (int i = 0; i < n; i++) |
| 1728 | { |
| 1729 | fences[i] = context->createFenceNV(); |
| 1730 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 1731 | } |
| 1732 | } |
| 1733 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1734 | void __stdcall glGenFramebuffers(GLsizei n, GLuint* framebuffers) |
| 1735 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1736 | EVENT("(GLsizei n = %d, GLuint* framebuffers = 0x%0.8p)", n, framebuffers); |
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 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1739 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1740 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1741 | if (n < 0) |
| 1742 | { |
| 1743 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1744 | return; |
| 1745 | } |
| 1746 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1747 | for (int i = 0; i < n; i++) |
| 1748 | { |
| 1749 | framebuffers[i] = context->createFramebuffer(); |
| 1750 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1751 | } |
| 1752 | } |
| 1753 | |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1754 | void __stdcall glGenQueriesEXT(GLsizei n, GLuint* ids) |
| 1755 | { |
| 1756 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 1757 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1758 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1759 | if (context) |
| 1760 | { |
| 1761 | if (n < 0) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1762 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1763 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1764 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1765 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1766 | |
| 1767 | for (GLsizei i = 0; i < n; i++) |
| 1768 | { |
| 1769 | ids[i] = context->createQuery(); |
| 1770 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 1771 | } |
| 1772 | } |
| 1773 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1774 | void __stdcall glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) |
| 1775 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1776 | EVENT("(GLsizei n = %d, GLuint* renderbuffers = 0x%0.8p)", n, renderbuffers); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1777 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1778 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1779 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1780 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1781 | if (n < 0) |
| 1782 | { |
| 1783 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1784 | return; |
| 1785 | } |
| 1786 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1787 | for (int i = 0; i < n; i++) |
| 1788 | { |
| 1789 | renderbuffers[i] = context->createRenderbuffer(); |
| 1790 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1791 | } |
| 1792 | } |
| 1793 | |
| 1794 | void __stdcall glGenTextures(GLsizei n, GLuint* textures) |
| 1795 | { |
Jamie Madill | 1fc7e2c | 2014-01-21 16:47:10 -0500 | [diff] [blame] | 1796 | EVENT("(GLsizei n = %d, GLuint* textures = 0x%0.8p)", n, textures); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1797 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1798 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1799 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1800 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1801 | if (n < 0) |
| 1802 | { |
| 1803 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1804 | return; |
| 1805 | } |
| 1806 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1807 | for (int i = 0; i < n; i++) |
| 1808 | { |
| 1809 | textures[i] = context->createTexture(); |
| 1810 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1811 | } |
| 1812 | } |
| 1813 | |
daniel@transgaming.com | 8542318 | 2010-04-22 13:35:27 +0000 | [diff] [blame] | 1814 | 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] | 1815 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1816 | 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] | 1817 | "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] | 1818 | program, index, bufsize, length, size, type, name); |
| 1819 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1820 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1821 | if (context) |
| 1822 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1823 | if (bufsize < 0) |
| 1824 | { |
| 1825 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1826 | return; |
| 1827 | } |
| 1828 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1829 | gl::Program *programObject = context->getProgram(program); |
| 1830 | |
| 1831 | if (!programObject) |
| 1832 | { |
| 1833 | if (context->getShader(program)) |
| 1834 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1835 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1836 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1837 | } |
| 1838 | else |
| 1839 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1840 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1841 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1842 | } |
| 1843 | } |
| 1844 | |
| 1845 | if (index >= (GLuint)programObject->getActiveAttributeCount()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1846 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1847 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1848 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1849 | } |
| 1850 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1851 | programObject->getActiveAttribute(index, bufsize, length, size, type, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1852 | } |
| 1853 | } |
| 1854 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 1855 | 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] | 1856 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1857 | EVENT("(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, " |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 1858 | "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] | 1859 | program, index, bufsize, length, size, type, name); |
| 1860 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1861 | |
| 1862 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1863 | if (context) |
| 1864 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1865 | if (bufsize < 0) |
| 1866 | { |
| 1867 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1868 | return; |
| 1869 | } |
| 1870 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1871 | gl::Program *programObject = context->getProgram(program); |
| 1872 | |
| 1873 | if (!programObject) |
| 1874 | { |
| 1875 | if (context->getShader(program)) |
| 1876 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1877 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1878 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1879 | } |
| 1880 | else |
| 1881 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1882 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1883 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1884 | } |
| 1885 | } |
| 1886 | |
| 1887 | if (index >= (GLuint)programObject->getActiveUniformCount()) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1888 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1889 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1890 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1891 | } |
| 1892 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1893 | programObject->getActiveUniform(index, bufsize, length, size, type, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1894 | } |
| 1895 | } |
| 1896 | |
| 1897 | void __stdcall glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) |
| 1898 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1899 | 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] | 1900 | program, maxcount, count, shaders); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1901 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1902 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1903 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1904 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1905 | if (maxcount < 0) |
| 1906 | { |
| 1907 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1908 | return; |
| 1909 | } |
| 1910 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1911 | gl::Program *programObject = context->getProgram(program); |
| 1912 | |
| 1913 | if (!programObject) |
| 1914 | { |
| 1915 | if (context->getShader(program)) |
| 1916 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1917 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1918 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1919 | } |
| 1920 | else |
| 1921 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1922 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1923 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1924 | } |
| 1925 | } |
| 1926 | |
| 1927 | return programObject->getAttachedShaders(maxcount, count, shaders); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1928 | } |
| 1929 | } |
| 1930 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1931 | GLint __stdcall glGetAttribLocation(GLuint program, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1932 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1933 | EVENT("(GLuint program = %d, const GLchar* name = %s)", program, name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1934 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1935 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1936 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1937 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1938 | gl::Program *programObject = context->getProgram(program); |
| 1939 | |
| 1940 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1941 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1942 | if (context->getShader(program)) |
daniel@transgaming.com | cf4aa87 | 2010-04-13 03:26:27 +0000 | [diff] [blame] | 1943 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1944 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1945 | return -1; |
daniel@transgaming.com | cf4aa87 | 2010-04-13 03:26:27 +0000 | [diff] [blame] | 1946 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1947 | else |
| 1948 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1949 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 1950 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1951 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1952 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1953 | |
| 1954 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 1955 | if (!programObject->isLinked() || !programBinary) |
| 1956 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 1957 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 1958 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1959 | } |
| 1960 | |
| 1961 | return programBinary->getAttributeLocation(name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1962 | } |
| 1963 | |
| 1964 | return -1; |
| 1965 | } |
| 1966 | |
| 1967 | void __stdcall glGetBooleanv(GLenum pname, GLboolean* params) |
| 1968 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1969 | 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] | 1970 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1971 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1972 | if (context) |
| 1973 | { |
| 1974 | GLenum nativeType; |
| 1975 | unsigned int numParams = 0; |
| 1976 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1977 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1978 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1979 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1980 | |
| 1981 | if (nativeType == GL_BOOL) |
| 1982 | { |
| 1983 | context->getBooleanv(pname, params); |
| 1984 | } |
| 1985 | else |
| 1986 | { |
| 1987 | CastStateValues(context, nativeType, pname, numParams, params); |
| 1988 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 1989 | } |
| 1990 | } |
| 1991 | |
| 1992 | void __stdcall glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) |
| 1993 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 1994 | 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] | 1995 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1996 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 1997 | if (context) |
| 1998 | { |
| 1999 | if (!gl::ValidBufferTarget(context, target)) |
daniel@transgaming.com | aa0ccbd | 2010-04-15 20:45:05 +0000 | [diff] [blame] | 2000 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2001 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2002 | return; |
daniel@transgaming.com | aa0ccbd | 2010-04-15 20:45:05 +0000 | [diff] [blame] | 2003 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2004 | |
| 2005 | if (!gl::ValidBufferParameter(context, pname)) |
| 2006 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2007 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2008 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2009 | } |
| 2010 | |
| 2011 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 2012 | |
| 2013 | if (!buffer) |
| 2014 | { |
| 2015 | // A null buffer means that "0" is bound to the requested buffer target |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2016 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2017 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2018 | } |
| 2019 | |
| 2020 | switch (pname) |
| 2021 | { |
| 2022 | case GL_BUFFER_USAGE: |
| 2023 | *params = static_cast<GLint>(buffer->getUsage()); |
| 2024 | break; |
| 2025 | case GL_BUFFER_SIZE: |
| 2026 | *params = gl::clampCast<GLint>(buffer->getSize()); |
| 2027 | break; |
| 2028 | case GL_BUFFER_ACCESS_FLAGS: |
| 2029 | *params = buffer->getAccessFlags(); |
| 2030 | break; |
| 2031 | case GL_BUFFER_MAPPED: |
| 2032 | *params = static_cast<GLint>(buffer->isMapped()); |
| 2033 | break; |
| 2034 | case GL_BUFFER_MAP_OFFSET: |
| 2035 | *params = gl::clampCast<GLint>(buffer->getMapOffset()); |
| 2036 | break; |
| 2037 | case GL_BUFFER_MAP_LENGTH: |
| 2038 | *params = gl::clampCast<GLint>(buffer->getMapLength()); |
| 2039 | break; |
| 2040 | default: UNREACHABLE(); break; |
| 2041 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2042 | } |
| 2043 | } |
| 2044 | |
| 2045 | GLenum __stdcall glGetError(void) |
| 2046 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2047 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2048 | |
| 2049 | gl::Context *context = gl::getContext(); |
| 2050 | |
| 2051 | if (context) |
| 2052 | { |
daniel@transgaming.com | 82b2891 | 2011-12-12 21:01:35 +0000 | [diff] [blame] | 2053 | return context->getError(); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2054 | } |
| 2055 | |
| 2056 | return GL_NO_ERROR; |
| 2057 | } |
| 2058 | |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2059 | void __stdcall glGetFenceivNV(GLuint fence, GLenum pname, GLint *params) |
| 2060 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2061 | 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] | 2062 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2063 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2064 | if (context) |
| 2065 | { |
| 2066 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 2067 | |
| 2068 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2069 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2070 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2071 | return; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2072 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2073 | |
| 2074 | if (fenceObject->isFence() != GL_TRUE) |
| 2075 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2076 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2077 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2078 | } |
| 2079 | |
| 2080 | switch (pname) |
| 2081 | { |
| 2082 | case GL_FENCE_STATUS_NV: |
| 2083 | case GL_FENCE_CONDITION_NV: |
| 2084 | break; |
| 2085 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2086 | default: |
| 2087 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2088 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2089 | } |
| 2090 | |
| 2091 | params[0] = fenceObject->getFencei(pname); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 2092 | } |
| 2093 | } |
| 2094 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2095 | void __stdcall glGetFloatv(GLenum pname, GLfloat* params) |
| 2096 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2097 | 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] | 2098 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2099 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2100 | if (context) |
| 2101 | { |
| 2102 | GLenum nativeType; |
| 2103 | unsigned int numParams = 0; |
| 2104 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 32e58cd | 2010-03-24 09:44:10 +0000 | [diff] [blame] | 2105 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2106 | return; |
daniel@transgaming.com | 32e58cd | 2010-03-24 09:44:10 +0000 | [diff] [blame] | 2107 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2108 | |
| 2109 | if (nativeType == GL_FLOAT) |
| 2110 | { |
| 2111 | context->getFloatv(pname, params); |
| 2112 | } |
| 2113 | else |
| 2114 | { |
| 2115 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2116 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2117 | } |
| 2118 | } |
| 2119 | |
| 2120 | void __stdcall glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) |
| 2121 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2122 | 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] | 2123 | target, attachment, pname, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2124 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2125 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2126 | if (context) |
| 2127 | { |
| 2128 | if (!gl::ValidFramebufferTarget(target)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2129 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2130 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2131 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2132 | } |
| 2133 | |
| 2134 | int clientVersion = context->getClientVersion(); |
| 2135 | |
| 2136 | switch (pname) |
| 2137 | { |
| 2138 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2139 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2140 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| 2141 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| 2142 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2143 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2144 | case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: |
| 2145 | if (clientVersion < 3 && !context->getExtensions().sRGB) |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2146 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2147 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2148 | return; |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2149 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2150 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2151 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2152 | case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: |
| 2153 | case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: |
| 2154 | case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: |
| 2155 | case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: |
| 2156 | case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: |
| 2157 | case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: |
| 2158 | case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: |
| 2159 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: |
| 2160 | if (clientVersion < 3) |
| 2161 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2162 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2163 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2164 | } |
| 2165 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2166 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2167 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2168 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2169 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2170 | } |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2171 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2172 | // Determine if the attachment is a valid enum |
| 2173 | switch (attachment) |
| 2174 | { |
| 2175 | case GL_BACK: |
| 2176 | case GL_FRONT: |
| 2177 | case GL_DEPTH: |
| 2178 | case GL_STENCIL: |
| 2179 | case GL_DEPTH_STENCIL_ATTACHMENT: |
| 2180 | if (clientVersion < 3) |
| 2181 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2182 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2183 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2184 | } |
| 2185 | break; |
| 2186 | |
| 2187 | case GL_DEPTH_ATTACHMENT: |
| 2188 | case GL_STENCIL_ATTACHMENT: |
| 2189 | break; |
| 2190 | |
| 2191 | default: |
| 2192 | if (attachment < GL_COLOR_ATTACHMENT0_EXT || |
| 2193 | (attachment - GL_COLOR_ATTACHMENT0_EXT) >= context->getCaps().maxColorAttachments) |
| 2194 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2195 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2196 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2197 | } |
| 2198 | break; |
| 2199 | } |
| 2200 | |
| 2201 | GLuint framebufferHandle = context->getState().getTargetFramebuffer(target)->id(); |
| 2202 | gl::Framebuffer *framebuffer = context->getFramebuffer(framebufferHandle); |
| 2203 | |
| 2204 | if (framebufferHandle == 0) |
| 2205 | { |
| 2206 | if (clientVersion < 3) |
| 2207 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2208 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2209 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2210 | } |
| 2211 | |
| 2212 | switch (attachment) |
| 2213 | { |
| 2214 | case GL_BACK: |
| 2215 | case GL_DEPTH: |
| 2216 | case GL_STENCIL: |
| 2217 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2218 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2219 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2220 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2221 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2222 | } |
| 2223 | } |
| 2224 | else |
| 2225 | { |
| 2226 | if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT) |
| 2227 | { |
| 2228 | // Valid attachment query |
| 2229 | } |
| 2230 | else |
| 2231 | { |
| 2232 | switch (attachment) |
| 2233 | { |
| 2234 | case GL_DEPTH_ATTACHMENT: |
| 2235 | case GL_STENCIL_ATTACHMENT: |
| 2236 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2237 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2238 | case GL_DEPTH_STENCIL_ATTACHMENT: |
| 2239 | if (framebuffer->hasValidDepthStencil()) |
| 2240 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2241 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2242 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2243 | } |
| 2244 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2245 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2246 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2247 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2248 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2249 | } |
| 2250 | } |
| 2251 | } |
| 2252 | |
| 2253 | GLenum attachmentType = GL_NONE; |
| 2254 | GLuint attachmentHandle = 0; |
| 2255 | GLuint attachmentLevel = 0; |
| 2256 | GLuint attachmentLayer = 0; |
| 2257 | |
| 2258 | const gl::FramebufferAttachment *attachmentObject = framebuffer->getAttachment(attachment); |
| 2259 | |
| 2260 | if (attachmentObject) |
| 2261 | { |
| 2262 | attachmentType = attachmentObject->type(); |
| 2263 | attachmentHandle = attachmentObject->id(); |
| 2264 | attachmentLevel = attachmentObject->mipLevel(); |
| 2265 | attachmentLayer = attachmentObject->layer(); |
| 2266 | } |
| 2267 | |
| 2268 | GLenum attachmentObjectType; // Type category |
| 2269 | if (framebufferHandle == 0) |
| 2270 | { |
| 2271 | attachmentObjectType = GL_FRAMEBUFFER_DEFAULT; |
| 2272 | } |
| 2273 | else if (attachmentType == GL_NONE || attachmentType == GL_RENDERBUFFER) |
| 2274 | { |
| 2275 | attachmentObjectType = attachmentType; |
| 2276 | } |
| 2277 | else if (gl::ValidTexture2DDestinationTarget(context, attachmentType)) |
| 2278 | { |
| 2279 | attachmentObjectType = GL_TEXTURE; |
| 2280 | } |
| 2281 | else |
| 2282 | { |
| 2283 | UNREACHABLE(); |
| 2284 | return; |
| 2285 | } |
| 2286 | |
| 2287 | if (attachmentObjectType == GL_NONE) |
| 2288 | { |
| 2289 | // ES 2.0.25 spec pg 127 states that if the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE |
| 2290 | // is NONE, then querying any other pname will generate INVALID_ENUM. |
| 2291 | |
| 2292 | // ES 3.0.2 spec pg 235 states that if the attachment type is none, |
| 2293 | // GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero and be an |
| 2294 | // INVALID_OPERATION for all other pnames |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 2295 | |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2296 | switch (pname) |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2297 | { |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2298 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2299 | *params = attachmentObjectType; |
| 2300 | break; |
| 2301 | |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2302 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
Geoff Lang | 05b0502 | 2014-06-11 15:31:45 -0400 | [diff] [blame] | 2303 | if (clientVersion < 3) |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2304 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2305 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2306 | return; |
daniel@transgaming.com | a27ff1e | 2010-08-24 19:20:11 +0000 | [diff] [blame] | 2307 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2308 | *params = 0; |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2309 | break; |
| 2310 | |
| 2311 | default: |
Jamie Madill | 1e3fa74 | 2014-06-16 10:34:00 -0400 | [diff] [blame] | 2312 | if (clientVersion < 3) |
shannon.woods%transgaming.com@gtempaccount.com | 89ae113 | 2013-04-13 03:28:43 +0000 | [diff] [blame] | 2313 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2314 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2315 | return; |
Geoff Lang | 646559f | 2013-08-15 11:08:15 -0400 | [diff] [blame] | 2316 | } |
| 2317 | else |
| 2318 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2319 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2320 | return; |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2321 | } |
daniel@transgaming.com | c46c9c0 | 2010-04-23 18:34:55 +0000 | [diff] [blame] | 2322 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2323 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2324 | else |
| 2325 | { |
| 2326 | ASSERT(attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE || |
| 2327 | attachmentObjectType == GL_FRAMEBUFFER_DEFAULT); |
| 2328 | ASSERT(attachmentObject != NULL); |
| 2329 | |
| 2330 | switch (pname) |
| 2331 | { |
| 2332 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: |
| 2333 | *params = attachmentObjectType; |
| 2334 | break; |
| 2335 | |
| 2336 | case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: |
| 2337 | if (attachmentObjectType != GL_RENDERBUFFER && attachmentObjectType != GL_TEXTURE) |
| 2338 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2339 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2340 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2341 | } |
| 2342 | *params = attachmentHandle; |
| 2343 | break; |
| 2344 | |
| 2345 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: |
| 2346 | if (attachmentObjectType != GL_TEXTURE) |
| 2347 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2348 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2349 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2350 | } |
| 2351 | *params = attachmentLevel; |
| 2352 | break; |
| 2353 | |
| 2354 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: |
| 2355 | if (attachmentObjectType != GL_TEXTURE) |
| 2356 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2357 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2358 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2359 | } |
| 2360 | *params = gl::IsCubemapTextureTarget(attachmentType) ? attachmentType : 0; |
| 2361 | break; |
| 2362 | |
| 2363 | case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: |
| 2364 | *params = attachmentObject->getRedSize(); |
| 2365 | break; |
| 2366 | |
| 2367 | case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: |
| 2368 | *params = attachmentObject->getGreenSize(); |
| 2369 | break; |
| 2370 | |
| 2371 | case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: |
| 2372 | *params = attachmentObject->getBlueSize(); |
| 2373 | break; |
| 2374 | |
| 2375 | case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: |
| 2376 | *params = attachmentObject->getAlphaSize(); |
| 2377 | break; |
| 2378 | |
| 2379 | case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: |
| 2380 | *params = attachmentObject->getDepthSize(); |
| 2381 | break; |
| 2382 | |
| 2383 | case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: |
| 2384 | *params = attachmentObject->getStencilSize(); |
| 2385 | break; |
| 2386 | |
| 2387 | case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: |
| 2388 | if (attachment == GL_DEPTH_STENCIL) |
| 2389 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2390 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2391 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2392 | } |
| 2393 | *params = attachmentObject->getComponentType(); |
| 2394 | break; |
| 2395 | |
| 2396 | case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: |
| 2397 | *params = attachmentObject->getColorEncoding(); |
| 2398 | break; |
| 2399 | |
| 2400 | case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: |
| 2401 | if (attachmentObjectType != GL_TEXTURE) |
| 2402 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2403 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2404 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2405 | } |
| 2406 | *params = attachmentLayer; |
| 2407 | break; |
| 2408 | |
| 2409 | default: |
| 2410 | UNREACHABLE(); |
| 2411 | break; |
| 2412 | } |
| 2413 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2414 | } |
| 2415 | } |
| 2416 | |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2417 | GLenum __stdcall glGetGraphicsResetStatusEXT(void) |
| 2418 | { |
| 2419 | EVENT("()"); |
| 2420 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2421 | gl::Context *context = gl::getContext(); |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2422 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2423 | if (context) |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2424 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2425 | return context->getResetStatus(); |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2426 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2427 | |
| 2428 | return GL_NO_ERROR; |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 2429 | } |
| 2430 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2431 | void __stdcall glGetIntegerv(GLenum pname, GLint* params) |
| 2432 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2433 | 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] | 2434 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2435 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2436 | if (context) |
| 2437 | { |
| 2438 | GLenum nativeType; |
| 2439 | unsigned int numParams = 0; |
| 2440 | |
| 2441 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2442 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2443 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2444 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2445 | |
| 2446 | if (nativeType == GL_INT) |
| 2447 | { |
| 2448 | context->getIntegerv(pname, params); |
| 2449 | } |
| 2450 | else |
| 2451 | { |
| 2452 | CastStateValues(context, nativeType, pname, numParams, params); |
| 2453 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2454 | } |
| 2455 | } |
| 2456 | |
| 2457 | void __stdcall glGetProgramiv(GLuint program, GLenum pname, GLint* params) |
| 2458 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2459 | 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] | 2460 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2461 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2462 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2463 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2464 | gl::Program *programObject = context->getProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2465 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2466 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2467 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2468 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2469 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2470 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2471 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2472 | if (context->getClientVersion() < 3) |
| 2473 | { |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2474 | switch (pname) |
| 2475 | { |
shannonwoods@chromium.org | e684b58 | 2013-05-30 00:07:42 +0000 | [diff] [blame] | 2476 | case GL_ACTIVE_UNIFORM_BLOCKS: |
shannonwoods@chromium.org | e684b58 | 2013-05-30 00:07:42 +0000 | [diff] [blame] | 2477 | case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2478 | case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2479 | case GL_TRANSFORM_FEEDBACK_VARYINGS: |
Geoff Lang | 1b6edcb | 2014-02-03 14:27:56 -0500 | [diff] [blame] | 2480 | case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2481 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2482 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2483 | } |
| 2484 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2485 | |
| 2486 | switch (pname) |
| 2487 | { |
| 2488 | case GL_DELETE_STATUS: |
| 2489 | *params = programObject->isFlaggedForDeletion(); |
| 2490 | return; |
| 2491 | case GL_LINK_STATUS: |
| 2492 | *params = programObject->isLinked(); |
| 2493 | return; |
| 2494 | case GL_VALIDATE_STATUS: |
| 2495 | *params = programObject->isValidated(); |
| 2496 | return; |
| 2497 | case GL_INFO_LOG_LENGTH: |
| 2498 | *params = programObject->getInfoLogLength(); |
| 2499 | return; |
| 2500 | case GL_ATTACHED_SHADERS: |
| 2501 | *params = programObject->getAttachedShadersCount(); |
| 2502 | return; |
| 2503 | case GL_ACTIVE_ATTRIBUTES: |
| 2504 | *params = programObject->getActiveAttributeCount(); |
| 2505 | return; |
| 2506 | case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH: |
| 2507 | *params = programObject->getActiveAttributeMaxLength(); |
| 2508 | return; |
| 2509 | case GL_ACTIVE_UNIFORMS: |
| 2510 | *params = programObject->getActiveUniformCount(); |
| 2511 | return; |
| 2512 | case GL_ACTIVE_UNIFORM_MAX_LENGTH: |
| 2513 | *params = programObject->getActiveUniformMaxLength(); |
| 2514 | return; |
| 2515 | case GL_PROGRAM_BINARY_LENGTH_OES: |
| 2516 | *params = programObject->getProgramBinaryLength(); |
| 2517 | return; |
| 2518 | case GL_ACTIVE_UNIFORM_BLOCKS: |
| 2519 | *params = programObject->getActiveUniformBlockCount(); |
| 2520 | return; |
| 2521 | case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH: |
| 2522 | *params = programObject->getActiveUniformBlockMaxLength(); |
| 2523 | break; |
| 2524 | case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: |
| 2525 | *params = programObject->getTransformFeedbackBufferMode(); |
| 2526 | break; |
| 2527 | case GL_TRANSFORM_FEEDBACK_VARYINGS: |
| 2528 | *params = programObject->getTransformFeedbackVaryingCount(); |
| 2529 | break; |
| 2530 | case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH: |
| 2531 | *params = programObject->getTransformFeedbackVaryingMaxLength(); |
| 2532 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2533 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2534 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2535 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2536 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2537 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2538 | } |
| 2539 | } |
| 2540 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 2541 | void __stdcall glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2542 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2543 | 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] | 2544 | program, bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2545 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2546 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2547 | if (context) |
| 2548 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2549 | if (bufsize < 0) |
| 2550 | { |
| 2551 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2552 | return; |
| 2553 | } |
| 2554 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2555 | gl::Program *programObject = context->getProgram(program); |
| 2556 | |
| 2557 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2558 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2559 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2560 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2561 | } |
| 2562 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2563 | programObject->getInfoLog(bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2564 | } |
| 2565 | } |
| 2566 | |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2567 | void __stdcall glGetQueryivEXT(GLenum target, GLenum pname, GLint *params) |
| 2568 | { |
| 2569 | EVENT("GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname, params); |
| 2570 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2571 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2572 | if (context) |
| 2573 | { |
| 2574 | if (!ValidQueryType(context, target)) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2575 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2576 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2577 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2578 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2579 | |
| 2580 | switch (pname) |
| 2581 | { |
| 2582 | case GL_CURRENT_QUERY_EXT: |
| 2583 | params[0] = context->getState().getActiveQueryId(target); |
| 2584 | break; |
| 2585 | |
| 2586 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2587 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2588 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2589 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2590 | } |
| 2591 | } |
| 2592 | |
| 2593 | void __stdcall glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params) |
| 2594 | { |
| 2595 | EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)", id, pname, params); |
| 2596 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2597 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2598 | if (context) |
| 2599 | { |
| 2600 | gl::Query *queryObject = context->getQuery(id, false, GL_NONE); |
| 2601 | |
| 2602 | if (!queryObject) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2603 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2604 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2605 | return; |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2606 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2607 | |
| 2608 | if (context->getState().getActiveQueryId(queryObject->getType()) == id) |
| 2609 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2610 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2611 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2612 | } |
| 2613 | |
| 2614 | switch(pname) |
| 2615 | { |
| 2616 | case GL_QUERY_RESULT_EXT: |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame^] | 2617 | { |
| 2618 | gl::Error error = queryObject->getResult(params); |
| 2619 | if (error.isError()) |
| 2620 | { |
| 2621 | context->recordError(error); |
| 2622 | return; |
| 2623 | } |
| 2624 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2625 | break; |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame^] | 2626 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2627 | case GL_QUERY_RESULT_AVAILABLE_EXT: |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame^] | 2628 | { |
| 2629 | gl::Error error = queryObject->isResultAvailable(params); |
| 2630 | if (error.isError()) |
| 2631 | { |
| 2632 | context->recordError(error); |
| 2633 | return; |
| 2634 | } |
| 2635 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2636 | break; |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame^] | 2637 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2638 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2639 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2640 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2641 | } |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 2642 | } |
| 2643 | } |
| 2644 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2645 | void __stdcall glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) |
| 2646 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2647 | 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] | 2648 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2649 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2650 | if (context) |
| 2651 | { |
| 2652 | if (target != GL_RENDERBUFFER) |
daniel@transgaming.com | 4901fca | 2010-04-20 18:52:41 +0000 | [diff] [blame] | 2653 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2654 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2655 | return; |
daniel@transgaming.com | 4901fca | 2010-04-20 18:52:41 +0000 | [diff] [blame] | 2656 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2657 | |
| 2658 | if (context->getState().getRenderbufferId() == 0) |
| 2659 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2660 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2661 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2662 | } |
| 2663 | |
| 2664 | gl::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getState().getRenderbufferId()); |
| 2665 | |
| 2666 | switch (pname) |
| 2667 | { |
| 2668 | case GL_RENDERBUFFER_WIDTH: *params = renderbuffer->getWidth(); break; |
| 2669 | case GL_RENDERBUFFER_HEIGHT: *params = renderbuffer->getHeight(); break; |
| 2670 | case GL_RENDERBUFFER_INTERNAL_FORMAT: *params = renderbuffer->getInternalFormat(); break; |
| 2671 | case GL_RENDERBUFFER_RED_SIZE: *params = renderbuffer->getRedSize(); break; |
| 2672 | case GL_RENDERBUFFER_GREEN_SIZE: *params = renderbuffer->getGreenSize(); break; |
| 2673 | case GL_RENDERBUFFER_BLUE_SIZE: *params = renderbuffer->getBlueSize(); break; |
| 2674 | case GL_RENDERBUFFER_ALPHA_SIZE: *params = renderbuffer->getAlphaSize(); break; |
| 2675 | case GL_RENDERBUFFER_DEPTH_SIZE: *params = renderbuffer->getDepthSize(); break; |
| 2676 | case GL_RENDERBUFFER_STENCIL_SIZE: *params = renderbuffer->getStencilSize(); break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2677 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2678 | case GL_RENDERBUFFER_SAMPLES_ANGLE: |
| 2679 | if (!context->getExtensions().framebufferMultisample) |
| 2680 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2681 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2682 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2683 | } |
| 2684 | *params = renderbuffer->getSamples(); |
| 2685 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2686 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2687 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2688 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2689 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2690 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2691 | } |
| 2692 | } |
| 2693 | |
| 2694 | void __stdcall glGetShaderiv(GLuint shader, GLenum pname, GLint* params) |
| 2695 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2696 | 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] | 2697 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2698 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2699 | if (context) |
| 2700 | { |
| 2701 | gl::Shader *shaderObject = context->getShader(shader); |
| 2702 | |
| 2703 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2704 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2705 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2706 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2707 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2708 | |
| 2709 | switch (pname) |
| 2710 | { |
| 2711 | case GL_SHADER_TYPE: |
| 2712 | *params = shaderObject->getType(); |
| 2713 | return; |
| 2714 | case GL_DELETE_STATUS: |
| 2715 | *params = shaderObject->isFlaggedForDeletion(); |
| 2716 | return; |
| 2717 | case GL_COMPILE_STATUS: |
| 2718 | *params = shaderObject->isCompiled() ? GL_TRUE : GL_FALSE; |
| 2719 | return; |
| 2720 | case GL_INFO_LOG_LENGTH: |
| 2721 | *params = shaderObject->getInfoLogLength(); |
| 2722 | return; |
| 2723 | case GL_SHADER_SOURCE_LENGTH: |
| 2724 | *params = shaderObject->getSourceLength(); |
| 2725 | return; |
| 2726 | case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: |
| 2727 | *params = shaderObject->getTranslatedSourceLength(); |
| 2728 | return; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2729 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2730 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2731 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2732 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2733 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2734 | } |
| 2735 | } |
| 2736 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 2737 | void __stdcall glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2738 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2739 | 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] | 2740 | shader, bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2741 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2742 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2743 | if (context) |
| 2744 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2745 | if (bufsize < 0) |
| 2746 | { |
| 2747 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2748 | return; |
| 2749 | } |
| 2750 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2751 | gl::Shader *shaderObject = context->getShader(shader); |
| 2752 | |
| 2753 | if (!shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2754 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2755 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2756 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2757 | } |
| 2758 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2759 | shaderObject->getInfoLog(bufsize, length, infolog); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2760 | } |
| 2761 | } |
| 2762 | |
| 2763 | void __stdcall glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) |
| 2764 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2765 | 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] | 2766 | shadertype, precisiontype, range, precision); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2767 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2768 | gl::Context *context = gl::getNonLostContext(); |
| 2769 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2770 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2771 | switch (shadertype) |
| 2772 | { |
| 2773 | case GL_VERTEX_SHADER: |
| 2774 | case GL_FRAGMENT_SHADER: |
| 2775 | break; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2776 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2777 | default: |
| 2778 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2779 | return; |
| 2780 | } |
| 2781 | |
| 2782 | switch (precisiontype) |
| 2783 | { |
| 2784 | case GL_LOW_FLOAT: |
| 2785 | case GL_MEDIUM_FLOAT: |
| 2786 | case GL_HIGH_FLOAT: |
| 2787 | // Assume IEEE 754 precision |
| 2788 | range[0] = 127; |
| 2789 | range[1] = 127; |
| 2790 | *precision = 23; |
| 2791 | break; |
| 2792 | |
| 2793 | case GL_LOW_INT: |
| 2794 | case GL_MEDIUM_INT: |
| 2795 | case GL_HIGH_INT: |
| 2796 | // Some (most) hardware only supports single-precision floating-point numbers, |
| 2797 | // which can accurately represent integers up to +/-16777216 |
| 2798 | range[0] = 24; |
| 2799 | range[1] = 24; |
| 2800 | *precision = 0; |
| 2801 | break; |
| 2802 | |
| 2803 | default: |
| 2804 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2805 | return; |
| 2806 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2807 | } |
| 2808 | } |
| 2809 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 2810 | void __stdcall glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2811 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2812 | 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] | 2813 | shader, bufsize, length, source); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2814 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2815 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2816 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2817 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2818 | if (bufsize < 0) |
| 2819 | { |
| 2820 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2821 | return; |
| 2822 | } |
| 2823 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2824 | gl::Shader *shaderObject = context->getShader(shader); |
| 2825 | |
| 2826 | if (!shaderObject) |
| 2827 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2828 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2829 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2830 | } |
| 2831 | |
| 2832 | shaderObject->getSource(bufsize, length, source); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2833 | } |
| 2834 | } |
| 2835 | |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2836 | void __stdcall glGetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) |
| 2837 | { |
| 2838 | EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)", |
| 2839 | shader, bufsize, length, source); |
| 2840 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2841 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2842 | if (context) |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2843 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2844 | if (bufsize < 0) |
| 2845 | { |
| 2846 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 2847 | return; |
| 2848 | } |
| 2849 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2850 | gl::Shader *shaderObject = context->getShader(shader); |
| 2851 | |
| 2852 | if (!shaderObject) |
| 2853 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2854 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 2855 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2856 | } |
| 2857 | |
| 2858 | shaderObject->getTranslatedSource(bufsize, length, source); |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 2859 | } |
| 2860 | } |
| 2861 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2862 | const GLubyte* __stdcall glGetString(GLenum name) |
| 2863 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2864 | EVENT("(GLenum name = 0x%X)", name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2865 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2866 | gl::Context *context = gl::getNonLostContext(); |
daniel@transgaming.com | 3e4c600 | 2010-05-05 18:50:13 +0000 | [diff] [blame] | 2867 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2868 | switch (name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2869 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2870 | case GL_VENDOR: |
| 2871 | return (GLubyte*)"Google Inc."; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2872 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2873 | case GL_RENDERER: |
| 2874 | return (GLubyte*)((context != NULL) ? context->getRendererString().c_str() : "ANGLE"); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2875 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2876 | case GL_VERSION: |
| 2877 | if (context->getClientVersion() == 2) |
| 2878 | { |
| 2879 | return (GLubyte*)"OpenGL ES 2.0 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2880 | } |
| 2881 | else |
| 2882 | { |
| 2883 | return (GLubyte*)"OpenGL ES 3.0 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2884 | } |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2885 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2886 | case GL_SHADING_LANGUAGE_VERSION: |
| 2887 | if (context->getClientVersion() == 2) |
| 2888 | { |
| 2889 | return (GLubyte*)"OpenGL ES GLSL ES 1.00 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2890 | } |
| 2891 | else |
| 2892 | { |
| 2893 | return (GLubyte*)"OpenGL ES GLSL ES 3.00 (ANGLE " ANGLE_VERSION_STRING ")"; |
| 2894 | } |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2895 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2896 | case GL_EXTENSIONS: |
| 2897 | return (GLubyte*)((context != NULL) ? context->getExtensionString().c_str() : ""); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2898 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2899 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2900 | if (context) |
| 2901 | { |
| 2902 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2903 | } |
| 2904 | return NULL; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2905 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 2906 | } |
| 2907 | |
| 2908 | void __stdcall glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) |
| 2909 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 2910 | 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] | 2911 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2912 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2913 | if (context) |
| 2914 | { |
| 2915 | gl::Texture *texture = context->getTargetTexture(target); |
| 2916 | |
| 2917 | if (!texture) |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 2918 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2919 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2920 | return; |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 2921 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2922 | |
| 2923 | switch (pname) |
| 2924 | { |
| 2925 | case GL_TEXTURE_MAG_FILTER: |
| 2926 | *params = (GLfloat)texture->getSamplerState().magFilter; |
| 2927 | break; |
| 2928 | case GL_TEXTURE_MIN_FILTER: |
| 2929 | *params = (GLfloat)texture->getSamplerState().minFilter; |
| 2930 | break; |
| 2931 | case GL_TEXTURE_WRAP_S: |
| 2932 | *params = (GLfloat)texture->getSamplerState().wrapS; |
| 2933 | break; |
| 2934 | case GL_TEXTURE_WRAP_T: |
| 2935 | *params = (GLfloat)texture->getSamplerState().wrapT; |
| 2936 | break; |
| 2937 | case GL_TEXTURE_WRAP_R: |
| 2938 | if (context->getClientVersion() < 3) |
| 2939 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2940 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2941 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2942 | } |
| 2943 | *params = (GLfloat)texture->getSamplerState().wrapR; |
| 2944 | break; |
| 2945 | case GL_TEXTURE_IMMUTABLE_FORMAT: |
| 2946 | // Exposed to ES2.0 through EXT_texture_storage, no client version validation. |
| 2947 | *params = (GLfloat)(texture->isImmutable() ? GL_TRUE : GL_FALSE); |
| 2948 | break; |
| 2949 | case GL_TEXTURE_IMMUTABLE_LEVELS: |
| 2950 | if (context->getClientVersion() < 3) |
| 2951 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2952 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2953 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2954 | } |
| 2955 | *params = (GLfloat)texture->immutableLevelCount(); |
| 2956 | break; |
| 2957 | case GL_TEXTURE_USAGE_ANGLE: |
| 2958 | *params = (GLfloat)texture->getUsage(); |
| 2959 | break; |
| 2960 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
| 2961 | if (!context->getExtensions().textureFilterAnisotropic) |
| 2962 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2963 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2964 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2965 | } |
| 2966 | *params = (GLfloat)texture->getSamplerState().maxAnisotropy; |
| 2967 | break; |
| 2968 | case GL_TEXTURE_SWIZZLE_R: |
| 2969 | if (context->getClientVersion() < 3) |
| 2970 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2971 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2972 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2973 | } |
| 2974 | *params = (GLfloat)texture->getSamplerState().swizzleRed; |
| 2975 | break; |
| 2976 | case GL_TEXTURE_SWIZZLE_G: |
| 2977 | if (context->getClientVersion() < 3) |
| 2978 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2979 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2980 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2981 | } |
| 2982 | *params = (GLfloat)texture->getSamplerState().swizzleGreen; |
| 2983 | break; |
| 2984 | case GL_TEXTURE_SWIZZLE_B: |
| 2985 | if (context->getClientVersion() < 3) |
| 2986 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2987 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2988 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2989 | } |
| 2990 | *params = (GLfloat)texture->getSamplerState().swizzleBlue; |
| 2991 | break; |
| 2992 | case GL_TEXTURE_SWIZZLE_A: |
| 2993 | if (context->getClientVersion() < 3) |
| 2994 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 2995 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 2996 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 2997 | } |
| 2998 | *params = (GLfloat)texture->getSamplerState().swizzleAlpha; |
| 2999 | break; |
| 3000 | case GL_TEXTURE_BASE_LEVEL: |
| 3001 | if (context->getClientVersion() < 3) |
| 3002 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3003 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3004 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3005 | } |
| 3006 | *params = (GLfloat)texture->getSamplerState().baseLevel; |
| 3007 | break; |
| 3008 | case GL_TEXTURE_MAX_LEVEL: |
| 3009 | if (context->getClientVersion() < 3) |
| 3010 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3011 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3012 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3013 | } |
| 3014 | *params = (GLfloat)texture->getSamplerState().maxLevel; |
| 3015 | break; |
| 3016 | case GL_TEXTURE_MIN_LOD: |
| 3017 | if (context->getClientVersion() < 3) |
| 3018 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3019 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3020 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3021 | } |
| 3022 | *params = texture->getSamplerState().minLod; |
| 3023 | break; |
| 3024 | case GL_TEXTURE_MAX_LOD: |
| 3025 | if (context->getClientVersion() < 3) |
| 3026 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3027 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3028 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3029 | } |
| 3030 | *params = texture->getSamplerState().maxLod; |
| 3031 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3032 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3033 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3034 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3035 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3036 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3037 | } |
| 3038 | } |
| 3039 | |
| 3040 | void __stdcall glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) |
| 3041 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3042 | 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] | 3043 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3044 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3045 | if (context) |
| 3046 | { |
| 3047 | gl::Texture *texture = context->getTargetTexture(target); |
| 3048 | |
| 3049 | if (!texture) |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 3050 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3051 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3052 | return; |
daniel@transgaming.com | 5d2bee9 | 2010-04-20 18:51:56 +0000 | [diff] [blame] | 3053 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3054 | |
| 3055 | switch (pname) |
| 3056 | { |
| 3057 | case GL_TEXTURE_MAG_FILTER: |
| 3058 | *params = texture->getSamplerState().magFilter; |
| 3059 | break; |
| 3060 | case GL_TEXTURE_MIN_FILTER: |
| 3061 | *params = texture->getSamplerState().minFilter; |
| 3062 | break; |
| 3063 | case GL_TEXTURE_WRAP_S: |
| 3064 | *params = texture->getSamplerState().wrapS; |
| 3065 | break; |
| 3066 | case GL_TEXTURE_WRAP_T: |
| 3067 | *params = texture->getSamplerState().wrapT; |
| 3068 | break; |
| 3069 | case GL_TEXTURE_WRAP_R: |
| 3070 | if (context->getClientVersion() < 3) |
| 3071 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3072 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3073 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3074 | } |
| 3075 | *params = texture->getSamplerState().wrapR; |
| 3076 | break; |
| 3077 | case GL_TEXTURE_IMMUTABLE_FORMAT: |
| 3078 | // Exposed to ES2.0 through EXT_texture_storage, no client version validation. |
| 3079 | *params = texture->isImmutable() ? GL_TRUE : GL_FALSE; |
| 3080 | break; |
| 3081 | case GL_TEXTURE_IMMUTABLE_LEVELS: |
| 3082 | if (context->getClientVersion() < 3) |
| 3083 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3084 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3085 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3086 | } |
| 3087 | *params = texture->immutableLevelCount(); |
| 3088 | break; |
| 3089 | case GL_TEXTURE_USAGE_ANGLE: |
| 3090 | *params = texture->getUsage(); |
| 3091 | break; |
| 3092 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: |
| 3093 | if (!context->getExtensions().textureFilterAnisotropic) |
| 3094 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3095 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3096 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3097 | } |
| 3098 | *params = (GLint)texture->getSamplerState().maxAnisotropy; |
| 3099 | break; |
| 3100 | case GL_TEXTURE_SWIZZLE_R: |
| 3101 | if (context->getClientVersion() < 3) |
| 3102 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3103 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3104 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3105 | } |
| 3106 | *params = texture->getSamplerState().swizzleRed; |
| 3107 | break; |
| 3108 | case GL_TEXTURE_SWIZZLE_G: |
| 3109 | if (context->getClientVersion() < 3) |
| 3110 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3111 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3112 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3113 | } |
| 3114 | *params = texture->getSamplerState().swizzleGreen; |
| 3115 | break; |
| 3116 | case GL_TEXTURE_SWIZZLE_B: |
| 3117 | if (context->getClientVersion() < 3) |
| 3118 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3119 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3120 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3121 | } |
| 3122 | *params = texture->getSamplerState().swizzleBlue; |
| 3123 | break; |
| 3124 | case GL_TEXTURE_SWIZZLE_A: |
| 3125 | if (context->getClientVersion() < 3) |
| 3126 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3127 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3128 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3129 | } |
| 3130 | *params = texture->getSamplerState().swizzleAlpha; |
| 3131 | break; |
| 3132 | case GL_TEXTURE_BASE_LEVEL: |
| 3133 | if (context->getClientVersion() < 3) |
| 3134 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3135 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3136 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3137 | } |
| 3138 | *params = texture->getSamplerState().baseLevel; |
| 3139 | break; |
| 3140 | case GL_TEXTURE_MAX_LEVEL: |
| 3141 | if (context->getClientVersion() < 3) |
| 3142 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3143 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3144 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3145 | } |
| 3146 | *params = texture->getSamplerState().maxLevel; |
| 3147 | break; |
| 3148 | case GL_TEXTURE_MIN_LOD: |
| 3149 | if (context->getClientVersion() < 3) |
| 3150 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3151 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3152 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3153 | } |
| 3154 | *params = (GLint)texture->getSamplerState().minLod; |
| 3155 | break; |
| 3156 | case GL_TEXTURE_MAX_LOD: |
| 3157 | if (context->getClientVersion() < 3) |
| 3158 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3159 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3160 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3161 | } |
| 3162 | *params = (GLint)texture->getSamplerState().maxLod; |
| 3163 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3164 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3165 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3166 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3167 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3168 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3169 | } |
| 3170 | } |
| 3171 | |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3172 | void __stdcall glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat* params) |
| 3173 | { |
| 3174 | EVENT("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLfloat* params = 0x%0.8p)", |
| 3175 | program, location, bufSize, params); |
| 3176 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3177 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3178 | if (context) |
| 3179 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3180 | if (!ValidateGetnUniformfvEXT(context, program, location, bufSize, params)) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3181 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3182 | return; |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3183 | } |
| 3184 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3185 | gl::Program *programObject = context->getProgram(program); |
| 3186 | ASSERT(programObject); |
| 3187 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3188 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3189 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3190 | programBinary->getUniformfv(location, params); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3191 | } |
| 3192 | } |
| 3193 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3194 | void __stdcall glGetUniformfv(GLuint program, GLint location, GLfloat* params) |
| 3195 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3196 | 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] | 3197 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3198 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3199 | if (context) |
| 3200 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3201 | if (!ValidateGetUniformfv(context, program, location, params)) |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3202 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3203 | return; |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3204 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3205 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3206 | gl::Program *programObject = context->getProgram(program); |
| 3207 | ASSERT(programObject); |
| 3208 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3209 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3210 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3211 | programBinary->getUniformfv(location, params); |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3212 | } |
| 3213 | } |
| 3214 | |
| 3215 | void __stdcall glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint* params) |
| 3216 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3217 | 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] | 3218 | program, location, bufSize, params); |
| 3219 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3220 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3221 | if (context) |
| 3222 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3223 | if (!ValidateGetnUniformivEXT(context, program, location, bufSize, params)) |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3224 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3225 | return; |
daniel@transgaming.com | 9a84912 | 2011-11-12 03:18:00 +0000 | [diff] [blame] | 3226 | } |
| 3227 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3228 | gl::Program *programObject = context->getProgram(program); |
| 3229 | ASSERT(programObject); |
| 3230 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3231 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3232 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3233 | programBinary->getUniformiv(location, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3234 | } |
| 3235 | } |
| 3236 | |
| 3237 | void __stdcall glGetUniformiv(GLuint program, GLint location, GLint* params) |
| 3238 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3239 | 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] | 3240 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3241 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3242 | if (context) |
| 3243 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3244 | if (!ValidateGetUniformiv(context, program, location, params)) |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3245 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3246 | return; |
daniel@transgaming.com | bb3d9d0 | 2010-04-13 03:26:06 +0000 | [diff] [blame] | 3247 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3248 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 3249 | gl::Program *programObject = context->getProgram(program); |
| 3250 | ASSERT(programObject); |
| 3251 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 3252 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3253 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 3254 | programBinary->getUniformiv(location, params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3255 | } |
| 3256 | } |
| 3257 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3258 | GLint __stdcall glGetUniformLocation(GLuint program, const GLchar* name) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3259 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3260 | 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] | 3261 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3262 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3263 | if (context) |
| 3264 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3265 | if (strstr(name, "gl_") == name) |
| 3266 | { |
| 3267 | return -1; |
| 3268 | } |
| 3269 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3270 | gl::Program *programObject = context->getProgram(program); |
| 3271 | |
| 3272 | if (!programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3273 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3274 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3275 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3276 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3277 | return -1; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3278 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3279 | else |
| 3280 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3281 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3282 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3283 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3284 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3285 | |
| 3286 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 3287 | if (!programObject->isLinked() || !programBinary) |
| 3288 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3289 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3290 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3291 | } |
| 3292 | |
| 3293 | return programBinary->getUniformLocation(name); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3294 | } |
| 3295 | |
| 3296 | return -1; |
| 3297 | } |
| 3298 | |
| 3299 | void __stdcall glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) |
| 3300 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3301 | 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] | 3302 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3303 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3304 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3305 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3306 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3307 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3308 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3309 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3310 | } |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3311 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3312 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3313 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3314 | { |
| 3315 | return; |
| 3316 | } |
daniel@transgaming.com | 428d158 | 2010-05-04 03:35:25 +0000 | [diff] [blame] | 3317 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3318 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 3319 | { |
| 3320 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 3321 | for (int i = 0; i < 4; ++i) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3322 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3323 | params[i] = currentValueData.FloatValues[i]; |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3324 | } |
| 3325 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3326 | else |
| 3327 | { |
| 3328 | *params = gl::QuerySingleVertexAttributeParameter<GLfloat>(attribState, pname); |
| 3329 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3330 | } |
| 3331 | } |
| 3332 | |
| 3333 | void __stdcall glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) |
| 3334 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3335 | 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] | 3336 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3337 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3338 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3339 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3340 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3341 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3342 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3343 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3344 | } |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3345 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3346 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
daniel@transgaming.com | 428d158 | 2010-05-04 03:35:25 +0000 | [diff] [blame] | 3347 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3348 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3349 | { |
| 3350 | return; |
| 3351 | } |
Jamie Madill | aff7150 | 2013-07-02 11:57:05 -0400 | [diff] [blame] | 3352 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3353 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 3354 | { |
| 3355 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 3356 | for (int i = 0; i < 4; ++i) |
Jamie Madill | aff7150 | 2013-07-02 11:57:05 -0400 | [diff] [blame] | 3357 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3358 | float currentValue = currentValueData.FloatValues[i]; |
| 3359 | params[i] = gl::iround<GLint>(currentValue); |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3360 | } |
| 3361 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3362 | else |
| 3363 | { |
| 3364 | *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname); |
| 3365 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3366 | } |
| 3367 | } |
| 3368 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 3369 | void __stdcall glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3370 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3371 | 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] | 3372 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3373 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3374 | if (context) |
| 3375 | { |
| 3376 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3377 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3378 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3379 | return; |
daniel@transgaming.com | e007896 | 2010-04-15 20:45:08 +0000 | [diff] [blame] | 3380 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3381 | |
| 3382 | if (pname != GL_VERTEX_ATTRIB_ARRAY_POINTER) |
| 3383 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3384 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3385 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3386 | } |
| 3387 | |
| 3388 | *pointer = const_cast<GLvoid*>(context->getState().getVertexAttribPointer(index)); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3389 | } |
| 3390 | } |
| 3391 | |
| 3392 | void __stdcall glHint(GLenum target, GLenum mode) |
| 3393 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3394 | EVENT("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3395 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3396 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3397 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3398 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3399 | switch (mode) |
| 3400 | { |
| 3401 | case GL_FASTEST: |
| 3402 | case GL_NICEST: |
| 3403 | case GL_DONT_CARE: |
| 3404 | break; |
| 3405 | |
| 3406 | default: |
| 3407 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3408 | return; |
| 3409 | } |
| 3410 | |
| 3411 | switch (target) |
| 3412 | { |
| 3413 | case GL_GENERATE_MIPMAP_HINT: |
| 3414 | context->getState().setGenerateMipmapHint(mode); |
| 3415 | break; |
| 3416 | |
| 3417 | case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: |
| 3418 | context->getState().setFragmentShaderDerivativeHint(mode); |
| 3419 | break; |
| 3420 | |
| 3421 | default: |
| 3422 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3423 | return; |
| 3424 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3425 | } |
| 3426 | } |
| 3427 | |
| 3428 | GLboolean __stdcall glIsBuffer(GLuint buffer) |
| 3429 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3430 | EVENT("(GLuint buffer = %d)", buffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3431 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3432 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3433 | if (context && buffer) |
| 3434 | { |
| 3435 | gl::Buffer *bufferObject = context->getBuffer(buffer); |
| 3436 | |
| 3437 | if (bufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3438 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3439 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3440 | } |
| 3441 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3442 | |
| 3443 | return GL_FALSE; |
| 3444 | } |
| 3445 | |
| 3446 | GLboolean __stdcall glIsEnabled(GLenum cap) |
| 3447 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3448 | EVENT("(GLenum cap = 0x%X)", cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3449 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3450 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3451 | if (context) |
| 3452 | { |
| 3453 | if (!ValidCap(context, cap)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3454 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3455 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3456 | return GL_FALSE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3457 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3458 | |
| 3459 | return context->getState().getEnableFeature(cap); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3460 | } |
| 3461 | |
| 3462 | return false; |
| 3463 | } |
| 3464 | |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3465 | GLboolean __stdcall glIsFenceNV(GLuint fence) |
| 3466 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3467 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3468 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3469 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3470 | if (context) |
| 3471 | { |
| 3472 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 3473 | |
| 3474 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3475 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3476 | return GL_FALSE; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3477 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3478 | |
| 3479 | return fenceObject->isFence(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3480 | } |
| 3481 | |
| 3482 | return GL_FALSE; |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3483 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3484 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3485 | GLboolean __stdcall glIsFramebuffer(GLuint framebuffer) |
| 3486 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3487 | EVENT("(GLuint framebuffer = %d)", framebuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3488 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3489 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3490 | if (context && framebuffer) |
| 3491 | { |
| 3492 | gl::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer); |
| 3493 | |
| 3494 | if (framebufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3495 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3496 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3497 | } |
| 3498 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3499 | |
| 3500 | return GL_FALSE; |
| 3501 | } |
| 3502 | |
| 3503 | GLboolean __stdcall glIsProgram(GLuint program) |
| 3504 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3505 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3506 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3507 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3508 | if (context && program) |
| 3509 | { |
| 3510 | gl::Program *programObject = context->getProgram(program); |
| 3511 | |
| 3512 | if (programObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3513 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3514 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3515 | } |
| 3516 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3517 | |
| 3518 | return GL_FALSE; |
| 3519 | } |
| 3520 | |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 3521 | GLboolean __stdcall glIsQueryEXT(GLuint id) |
| 3522 | { |
| 3523 | EVENT("(GLuint id = %d)", id); |
| 3524 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3525 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3526 | if (context) |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 3527 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3528 | 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] | 3529 | } |
| 3530 | |
| 3531 | return GL_FALSE; |
| 3532 | } |
| 3533 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3534 | GLboolean __stdcall glIsRenderbuffer(GLuint renderbuffer) |
| 3535 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3536 | EVENT("(GLuint renderbuffer = %d)", renderbuffer); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3537 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3538 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3539 | if (context && renderbuffer) |
| 3540 | { |
| 3541 | gl::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer); |
| 3542 | |
| 3543 | if (renderbufferObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3544 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3545 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3546 | } |
| 3547 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3548 | |
| 3549 | return GL_FALSE; |
| 3550 | } |
| 3551 | |
| 3552 | GLboolean __stdcall glIsShader(GLuint shader) |
| 3553 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3554 | EVENT("(GLuint shader = %d)", shader); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3555 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3556 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3557 | if (context && shader) |
| 3558 | { |
| 3559 | gl::Shader *shaderObject = context->getShader(shader); |
| 3560 | |
| 3561 | if (shaderObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3562 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3563 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3564 | } |
| 3565 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3566 | |
| 3567 | return GL_FALSE; |
| 3568 | } |
| 3569 | |
| 3570 | GLboolean __stdcall glIsTexture(GLuint texture) |
| 3571 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3572 | EVENT("(GLuint texture = %d)", texture); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3573 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3574 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3575 | if (context && texture) |
| 3576 | { |
| 3577 | gl::Texture *textureObject = context->getTexture(texture); |
| 3578 | |
| 3579 | if (textureObject) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3580 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3581 | return GL_TRUE; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3582 | } |
| 3583 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3584 | |
| 3585 | return GL_FALSE; |
| 3586 | } |
| 3587 | |
| 3588 | void __stdcall glLineWidth(GLfloat width) |
| 3589 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3590 | EVENT("(GLfloat width = %f)", width); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3591 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3592 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3593 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3594 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3595 | if (width <= 0.0f) |
| 3596 | { |
| 3597 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3598 | return; |
| 3599 | } |
| 3600 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3601 | context->getState().setLineWidth(width); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3602 | } |
| 3603 | } |
| 3604 | |
| 3605 | void __stdcall glLinkProgram(GLuint program) |
| 3606 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3607 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3608 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3609 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3610 | if (context) |
| 3611 | { |
| 3612 | gl::Program *programObject = context->getProgram(program); |
| 3613 | |
| 3614 | if (!programObject) |
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 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3617 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3618 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3619 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3620 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3621 | else |
| 3622 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3623 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3624 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3625 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3626 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3627 | |
| 3628 | context->linkProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3629 | } |
| 3630 | } |
| 3631 | |
| 3632 | void __stdcall glPixelStorei(GLenum pname, GLint param) |
| 3633 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3634 | EVENT("(GLenum pname = 0x%X, GLint param = %d)", pname, param); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3635 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3636 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3637 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3638 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3639 | switch (pname) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3640 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3641 | case GL_UNPACK_ALIGNMENT: |
| 3642 | if (param != 1 && param != 2 && param != 4 && param != 8) |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3643 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3644 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3645 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3646 | } |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3647 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3648 | context->getState().setUnpackAlignment(param); |
| 3649 | break; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3650 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3651 | case GL_PACK_ALIGNMENT: |
| 3652 | if (param != 1 && param != 2 && param != 4 && param != 8) |
| 3653 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3654 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3655 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3656 | } |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3657 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3658 | context->getState().setPackAlignment(param); |
| 3659 | break; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3660 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3661 | case GL_PACK_REVERSE_ROW_ORDER_ANGLE: |
| 3662 | context->getState().setPackReverseRowOrder(param != 0); |
| 3663 | break; |
bsalomon@google.com | 56d46ab | 2011-11-23 14:53:10 +0000 | [diff] [blame] | 3664 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3665 | case GL_UNPACK_IMAGE_HEIGHT: |
| 3666 | case GL_UNPACK_SKIP_IMAGES: |
| 3667 | case GL_UNPACK_ROW_LENGTH: |
| 3668 | case GL_UNPACK_SKIP_ROWS: |
| 3669 | case GL_UNPACK_SKIP_PIXELS: |
| 3670 | case GL_PACK_ROW_LENGTH: |
| 3671 | case GL_PACK_SKIP_ROWS: |
| 3672 | case GL_PACK_SKIP_PIXELS: |
| 3673 | if (context->getClientVersion() < 3) |
| 3674 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3675 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3676 | return; |
daniel@transgaming.com | 3489e3a | 2010-03-21 04:31:11 +0000 | [diff] [blame] | 3677 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3678 | UNIMPLEMENTED(); |
| 3679 | break; |
| 3680 | |
| 3681 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3682 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3683 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3684 | } |
| 3685 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3686 | } |
| 3687 | |
| 3688 | void __stdcall glPolygonOffset(GLfloat factor, GLfloat units) |
| 3689 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3690 | EVENT("(GLfloat factor = %f, GLfloat units = %f)", factor, units); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3691 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3692 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3693 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3694 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3695 | context->getState().setPolygonOffsetParams(factor, units); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3696 | } |
| 3697 | } |
| 3698 | |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3699 | void __stdcall glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, |
| 3700 | GLenum format, GLenum type, GLsizei bufSize, |
| 3701 | GLvoid *data) |
| 3702 | { |
| 3703 | EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, " |
| 3704 | "GLenum format = 0x%X, GLenum type = 0x%X, GLsizei bufSize = 0x%d, GLvoid *data = 0x%0.8p)", |
| 3705 | x, y, width, height, format, type, bufSize, data); |
| 3706 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3707 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3708 | if (context) |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3709 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3710 | if (width < 0 || height < 0 || bufSize < 0) |
| 3711 | { |
| 3712 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3713 | return; |
| 3714 | } |
| 3715 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3716 | if (!gl::ValidateReadPixelsParameters(context, x, y, width, height, |
| 3717 | format, type, &bufSize, data)) |
| 3718 | { |
| 3719 | return; |
| 3720 | } |
| 3721 | |
Geoff Lang | 63d2fc7 | 2014-07-25 14:51:41 -0400 | [diff] [blame] | 3722 | gl::Error error = context->readPixels(x, y, width, height, format, type, &bufSize, data); |
| 3723 | if (error.isError()) |
| 3724 | { |
| 3725 | context->recordError(error); |
| 3726 | return; |
| 3727 | } |
daniel@transgaming.com | b7915a5 | 2011-11-12 03:14:20 +0000 | [diff] [blame] | 3728 | } |
| 3729 | } |
| 3730 | |
| 3731 | void __stdcall glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, |
| 3732 | GLenum format, GLenum type, GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3733 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3734 | 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] | 3735 | "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] | 3736 | x, y, width, height, format, type, pixels); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3737 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3738 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3739 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3740 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3741 | if (width < 0 || height < 0) |
| 3742 | { |
| 3743 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3744 | return; |
| 3745 | } |
| 3746 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3747 | if (!gl::ValidateReadPixelsParameters(context, x, y, width, height, |
| 3748 | format, type, NULL, pixels)) |
| 3749 | { |
| 3750 | return; |
| 3751 | } |
| 3752 | |
Geoff Lang | 63d2fc7 | 2014-07-25 14:51:41 -0400 | [diff] [blame] | 3753 | gl::Error error = context->readPixels(x, y, width, height, format, type, NULL, pixels); |
| 3754 | if (error.isError()) |
| 3755 | { |
| 3756 | context->recordError(error); |
| 3757 | return; |
| 3758 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3759 | } |
| 3760 | } |
| 3761 | |
| 3762 | void __stdcall glReleaseShaderCompiler(void) |
| 3763 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3764 | EVENT("()"); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3765 | |
Brandon Jones | f05cdee | 2014-08-27 15:24:07 -0700 | [diff] [blame] | 3766 | gl::Context *context = gl::getNonLostContext(); |
| 3767 | |
| 3768 | if (context) |
| 3769 | { |
| 3770 | context->releaseShaderCompiler(); |
| 3771 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3772 | } |
| 3773 | |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 3774 | 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] | 3775 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3776 | 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] | 3777 | target, samples, internalformat, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3778 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3779 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3780 | if (context) |
| 3781 | { |
| 3782 | if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat, |
| 3783 | width, height, true)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3784 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3785 | return; |
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 | context->setRenderbufferStorage(width, height, internalformat, samples); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3789 | } |
| 3790 | } |
| 3791 | |
daniel@transgaming.com | 1f135d8 | 2010-08-24 19:20:36 +0000 | [diff] [blame] | 3792 | void __stdcall glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) |
| 3793 | { |
| 3794 | glRenderbufferStorageMultisampleANGLE(target, 0, internalformat, width, height); |
| 3795 | } |
| 3796 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3797 | void __stdcall glSampleCoverage(GLclampf value, GLboolean invert) |
| 3798 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 3799 | EVENT("(GLclampf value = %f, GLboolean invert = %u)", value, invert); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3800 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3801 | gl::Context* context = gl::getNonLostContext(); |
daniel@transgaming.com | fab5a1a | 2010-03-11 19:22:30 +0000 | [diff] [blame] | 3802 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3803 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3804 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3805 | context->getState().setSampleCoverageParams(gl::clamp01(value), invert == GL_TRUE); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3806 | } |
| 3807 | } |
| 3808 | |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3809 | void __stdcall glSetFenceNV(GLuint fence, GLenum condition) |
| 3810 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3811 | EVENT("(GLuint fence = %d, GLenum condition = 0x%X)", fence, condition); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3812 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3813 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3814 | if (context) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3815 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3816 | if (condition != GL_ALL_COMPLETED_NV) |
| 3817 | { |
| 3818 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3819 | return; |
| 3820 | } |
| 3821 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3822 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 3823 | |
| 3824 | if (fenceObject == NULL) |
| 3825 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3826 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3827 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3828 | } |
| 3829 | |
| 3830 | fenceObject->setFence(condition); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3831 | } |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 3832 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 3833 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3834 | void __stdcall glScissor(GLint x, GLint y, GLsizei width, GLsizei height) |
| 3835 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3836 | 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] | 3837 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3838 | gl::Context* context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3839 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3840 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3841 | if (width < 0 || height < 0) |
| 3842 | { |
| 3843 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3844 | return; |
| 3845 | } |
| 3846 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3847 | context->getState().setScissorParams(x, y, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3848 | } |
| 3849 | } |
| 3850 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 3851 | 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] | 3852 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3853 | 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] | 3854 | "const GLvoid* binary = 0x%0.8p, GLsizei length = %d)", |
daniel@transgaming.com | b5b0616 | 2010-03-21 04:31:32 +0000 | [diff] [blame] | 3855 | n, shaders, binaryformat, binary, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3856 | |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 3857 | gl::Context* context = gl::getNonLostContext(); |
| 3858 | if (context) |
| 3859 | { |
| 3860 | const std::vector<GLenum> &shaderBinaryFormats = context->getCaps().shaderBinaryFormats; |
| 3861 | if (std::find(shaderBinaryFormats.begin(), shaderBinaryFormats.end(), binaryformat) == shaderBinaryFormats.end()) |
| 3862 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3863 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3864 | return; |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 3865 | } |
| 3866 | |
| 3867 | // No binary shader formats are supported. |
| 3868 | UNIMPLEMENTED(); |
| 3869 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3870 | } |
| 3871 | |
shannon.woods%transgaming.com@gtempaccount.com | 5f33933 | 2013-04-13 03:29:02 +0000 | [diff] [blame] | 3872 | 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] | 3873 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3874 | 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] | 3875 | shader, count, string, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3876 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3877 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3878 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3879 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3880 | if (count < 0) |
| 3881 | { |
| 3882 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3883 | return; |
| 3884 | } |
| 3885 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3886 | gl::Shader *shaderObject = context->getShader(shader); |
| 3887 | |
| 3888 | if (!shaderObject) |
| 3889 | { |
| 3890 | if (context->getProgram(shader)) |
| 3891 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3892 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 3893 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3894 | } |
| 3895 | else |
| 3896 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3897 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 3898 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3899 | } |
| 3900 | } |
| 3901 | |
| 3902 | shaderObject->setSource(count, string, length); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3903 | } |
| 3904 | } |
| 3905 | |
| 3906 | void __stdcall glStencilFunc(GLenum func, GLint ref, GLuint mask) |
| 3907 | { |
daniel@transgaming.com | fab5a1a | 2010-03-11 19:22:30 +0000 | [diff] [blame] | 3908 | glStencilFuncSeparate(GL_FRONT_AND_BACK, func, ref, mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3909 | } |
| 3910 | |
| 3911 | void __stdcall glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) |
| 3912 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3913 | 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] | 3914 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3915 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3916 | if (context) |
| 3917 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3918 | switch (face) |
| 3919 | { |
| 3920 | case GL_FRONT: |
| 3921 | case GL_BACK: |
| 3922 | case GL_FRONT_AND_BACK: |
| 3923 | break; |
| 3924 | |
| 3925 | default: |
| 3926 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3927 | return; |
| 3928 | } |
| 3929 | |
| 3930 | switch (func) |
| 3931 | { |
| 3932 | case GL_NEVER: |
| 3933 | case GL_ALWAYS: |
| 3934 | case GL_LESS: |
| 3935 | case GL_LEQUAL: |
| 3936 | case GL_EQUAL: |
| 3937 | case GL_GEQUAL: |
| 3938 | case GL_GREATER: |
| 3939 | case GL_NOTEQUAL: |
| 3940 | break; |
| 3941 | |
| 3942 | default: |
| 3943 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3944 | return; |
| 3945 | } |
| 3946 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3947 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 3948 | { |
| 3949 | context->getState().setStencilParams(func, ref, mask); |
| 3950 | } |
| 3951 | |
| 3952 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 3953 | { |
| 3954 | context->getState().setStencilBackParams(func, ref, mask); |
| 3955 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3956 | } |
| 3957 | } |
| 3958 | |
| 3959 | void __stdcall glStencilMask(GLuint mask) |
| 3960 | { |
| 3961 | glStencilMaskSeparate(GL_FRONT_AND_BACK, mask); |
| 3962 | } |
| 3963 | |
| 3964 | void __stdcall glStencilMaskSeparate(GLenum face, GLuint mask) |
| 3965 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 3966 | EVENT("(GLenum face = 0x%X, GLuint mask = %d)", face, mask); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3967 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3968 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3969 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3970 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 3971 | switch (face) |
| 3972 | { |
| 3973 | case GL_FRONT: |
| 3974 | case GL_BACK: |
| 3975 | case GL_FRONT_AND_BACK: |
| 3976 | break; |
| 3977 | |
| 3978 | default: |
| 3979 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 3980 | return; |
| 3981 | } |
| 3982 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 3983 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 3984 | { |
| 3985 | context->getState().setStencilWritemask(mask); |
| 3986 | } |
| 3987 | |
| 3988 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 3989 | { |
| 3990 | context->getState().setStencilBackWritemask(mask); |
| 3991 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 3992 | } |
| 3993 | } |
| 3994 | |
| 3995 | void __stdcall glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) |
| 3996 | { |
| 3997 | glStencilOpSeparate(GL_FRONT_AND_BACK, fail, zfail, zpass); |
| 3998 | } |
| 3999 | |
| 4000 | void __stdcall glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) |
| 4001 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4002 | 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] | 4003 | face, fail, zfail, zpass); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4004 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4005 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4006 | if (context) |
| 4007 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4008 | switch (face) |
| 4009 | { |
| 4010 | case GL_FRONT: |
| 4011 | case GL_BACK: |
| 4012 | case GL_FRONT_AND_BACK: |
| 4013 | break; |
| 4014 | |
| 4015 | default: |
| 4016 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4017 | return; |
| 4018 | } |
| 4019 | |
| 4020 | switch (fail) |
| 4021 | { |
| 4022 | case GL_ZERO: |
| 4023 | case GL_KEEP: |
| 4024 | case GL_REPLACE: |
| 4025 | case GL_INCR: |
| 4026 | case GL_DECR: |
| 4027 | case GL_INVERT: |
| 4028 | case GL_INCR_WRAP: |
| 4029 | case GL_DECR_WRAP: |
| 4030 | break; |
| 4031 | |
| 4032 | default: |
| 4033 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4034 | return; |
| 4035 | } |
| 4036 | |
| 4037 | switch (zfail) |
| 4038 | { |
| 4039 | case GL_ZERO: |
| 4040 | case GL_KEEP: |
| 4041 | case GL_REPLACE: |
| 4042 | case GL_INCR: |
| 4043 | case GL_DECR: |
| 4044 | case GL_INVERT: |
| 4045 | case GL_INCR_WRAP: |
| 4046 | case GL_DECR_WRAP: |
| 4047 | break; |
| 4048 | |
| 4049 | default: |
| 4050 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4051 | return; |
| 4052 | } |
| 4053 | |
| 4054 | switch (zpass) |
| 4055 | { |
| 4056 | case GL_ZERO: |
| 4057 | case GL_KEEP: |
| 4058 | case GL_REPLACE: |
| 4059 | case GL_INCR: |
| 4060 | case GL_DECR: |
| 4061 | case GL_INVERT: |
| 4062 | case GL_INCR_WRAP: |
| 4063 | case GL_DECR_WRAP: |
| 4064 | break; |
| 4065 | |
| 4066 | default: |
| 4067 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4068 | return; |
| 4069 | } |
| 4070 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4071 | if (face == GL_FRONT || face == GL_FRONT_AND_BACK) |
| 4072 | { |
| 4073 | context->getState().setStencilOperations(fail, zfail, zpass); |
| 4074 | } |
| 4075 | |
| 4076 | if (face == GL_BACK || face == GL_FRONT_AND_BACK) |
| 4077 | { |
| 4078 | context->getState().setStencilBackOperations(fail, zfail, zpass); |
| 4079 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4080 | } |
| 4081 | } |
| 4082 | |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 4083 | GLboolean __stdcall glTestFenceNV(GLuint fence) |
| 4084 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4085 | EVENT("(GLuint fence = %d)", fence); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4086 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4087 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4088 | if (context) |
| 4089 | { |
| 4090 | gl::FenceNV *fenceObject = context->getFenceNV(fence); |
| 4091 | |
| 4092 | if (fenceObject == NULL) |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4093 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4094 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4095 | return GL_TRUE; |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4096 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4097 | |
| 4098 | if (fenceObject->isFence() != GL_TRUE) |
| 4099 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4100 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4101 | return GL_TRUE; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4102 | } |
| 4103 | |
| 4104 | return fenceObject->testFence(); |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4105 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4106 | |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4107 | return GL_TRUE; |
daniel@transgaming.com | fe20888 | 2010-09-01 15:47:57 +0000 | [diff] [blame] | 4108 | } |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 4109 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 4110 | void __stdcall glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, |
| 4111 | GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4112 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4113 | 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] | 4114 | "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] | 4115 | target, level, internalformat, width, height, border, format, type, pixels); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4116 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4117 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4118 | if (context) |
| 4119 | { |
| 4120 | if (context->getClientVersion() < 3 && |
| 4121 | !ValidateES2TexImageParameters(context, target, level, internalformat, false, false, |
| 4122 | 0, 0, width, height, border, format, type, pixels)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4123 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4124 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4125 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4126 | |
| 4127 | if (context->getClientVersion() >= 3 && |
| 4128 | !ValidateES3TexImageParameters(context, target, level, internalformat, false, false, |
| 4129 | 0, 0, 0, width, height, 1, border, format, type, pixels)) |
| 4130 | { |
| 4131 | return; |
| 4132 | } |
| 4133 | |
| 4134 | switch (target) |
| 4135 | { |
| 4136 | case GL_TEXTURE_2D: |
| 4137 | { |
| 4138 | gl::Texture2D *texture = context->getTexture2D(); |
| 4139 | texture->setImage(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4140 | } |
| 4141 | break; |
| 4142 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 4143 | { |
| 4144 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 4145 | texture->setImagePosX(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4146 | } |
| 4147 | break; |
| 4148 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 4149 | { |
| 4150 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 4151 | texture->setImageNegX(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4152 | } |
| 4153 | break; |
| 4154 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 4155 | { |
| 4156 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 4157 | texture->setImagePosY(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4158 | } |
| 4159 | break; |
| 4160 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 4161 | { |
| 4162 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 4163 | texture->setImageNegY(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4164 | } |
| 4165 | break; |
| 4166 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 4167 | { |
| 4168 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 4169 | texture->setImagePosZ(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4170 | } |
| 4171 | break; |
| 4172 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 4173 | { |
| 4174 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 4175 | texture->setImageNegZ(level, width, height, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 4176 | } |
| 4177 | break; |
| 4178 | default: UNREACHABLE(); |
| 4179 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4180 | } |
| 4181 | } |
| 4182 | |
| 4183 | void __stdcall glTexParameterf(GLenum target, GLenum pname, GLfloat param) |
| 4184 | { |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4185 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %f)", target, pname, param); |
| 4186 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4187 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4188 | if (context) |
| 4189 | { |
| 4190 | if (!ValidateTexParamParameters(context, pname, static_cast<GLint>(param))) |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4191 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4192 | return; |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4193 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4194 | |
| 4195 | gl::Texture *texture = context->getTargetTexture(target); |
| 4196 | |
| 4197 | if (!texture) |
| 4198 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4199 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4200 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4201 | } |
| 4202 | |
| 4203 | switch (pname) |
| 4204 | { |
| 4205 | case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = gl::uiround<GLenum>(param); break; |
| 4206 | case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = gl::uiround<GLenum>(param); break; |
| 4207 | case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = gl::uiround<GLenum>(param); break; |
| 4208 | case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = gl::uiround<GLenum>(param); break; |
| 4209 | case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = gl::uiround<GLenum>(param); break; |
| 4210 | case GL_TEXTURE_USAGE_ANGLE: texture->setUsage(gl::uiround<GLenum>(param)); break; |
| 4211 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min(param, context->getExtensions().maxTextureAnisotropy); break; |
| 4212 | case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = gl::uiround<GLenum>(param); break; |
| 4213 | case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = gl::uiround<GLenum>(param); break; |
| 4214 | case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = gl::uiround<GLenum>(param); break; |
| 4215 | case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = gl::uiround<GLenum>(param); break; |
| 4216 | case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = gl::uiround<GLenum>(param); break; |
| 4217 | case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = gl::uiround<GLenum>(param); break; |
| 4218 | case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = gl::iround<GLint>(param); break; |
| 4219 | case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = gl::iround<GLint>(param); break; |
| 4220 | case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = param; break; |
| 4221 | case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = param; break; |
| 4222 | default: UNREACHABLE(); break; |
| 4223 | } |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4224 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4225 | } |
| 4226 | |
| 4227 | void __stdcall glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) |
| 4228 | { |
daniel@transgaming.com | 07ab841 | 2012-07-12 15:17:09 +0000 | [diff] [blame] | 4229 | glTexParameterf(target, pname, (GLfloat)*params); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4230 | } |
| 4231 | |
| 4232 | void __stdcall glTexParameteri(GLenum target, GLenum pname, GLint param) |
| 4233 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4234 | 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] | 4235 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4236 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4237 | if (context) |
| 4238 | { |
| 4239 | if (!ValidateTexParamParameters(context, pname, param)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4240 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4241 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4242 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4243 | |
| 4244 | gl::Texture *texture = context->getTargetTexture(target); |
| 4245 | |
| 4246 | if (!texture) |
| 4247 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4248 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4249 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4250 | } |
| 4251 | |
| 4252 | switch (pname) |
| 4253 | { |
| 4254 | case GL_TEXTURE_WRAP_S: texture->getSamplerState().wrapS = (GLenum)param; break; |
| 4255 | case GL_TEXTURE_WRAP_T: texture->getSamplerState().wrapT = (GLenum)param; break; |
| 4256 | case GL_TEXTURE_WRAP_R: texture->getSamplerState().wrapR = (GLenum)param; break; |
| 4257 | case GL_TEXTURE_MIN_FILTER: texture->getSamplerState().minFilter = (GLenum)param; break; |
| 4258 | case GL_TEXTURE_MAG_FILTER: texture->getSamplerState().magFilter = (GLenum)param; break; |
| 4259 | case GL_TEXTURE_USAGE_ANGLE: texture->setUsage((GLenum)param); break; |
| 4260 | case GL_TEXTURE_MAX_ANISOTROPY_EXT: texture->getSamplerState().maxAnisotropy = std::min((float)param, context->getExtensions().maxTextureAnisotropy); break; |
| 4261 | case GL_TEXTURE_COMPARE_MODE: texture->getSamplerState().compareMode = (GLenum)param; break; |
| 4262 | case GL_TEXTURE_COMPARE_FUNC: texture->getSamplerState().compareFunc = (GLenum)param; break; |
| 4263 | case GL_TEXTURE_SWIZZLE_R: texture->getSamplerState().swizzleRed = (GLenum)param; break; |
| 4264 | case GL_TEXTURE_SWIZZLE_G: texture->getSamplerState().swizzleGreen = (GLenum)param; break; |
| 4265 | case GL_TEXTURE_SWIZZLE_B: texture->getSamplerState().swizzleBlue = (GLenum)param; break; |
| 4266 | case GL_TEXTURE_SWIZZLE_A: texture->getSamplerState().swizzleAlpha = (GLenum)param; break; |
| 4267 | case GL_TEXTURE_BASE_LEVEL: texture->getSamplerState().baseLevel = param; break; |
| 4268 | case GL_TEXTURE_MAX_LEVEL: texture->getSamplerState().maxLevel = param; break; |
| 4269 | case GL_TEXTURE_MIN_LOD: texture->getSamplerState().minLod = (GLfloat)param; break; |
| 4270 | case GL_TEXTURE_MAX_LOD: texture->getSamplerState().maxLod = (GLfloat)param; break; |
| 4271 | default: UNREACHABLE(); break; |
| 4272 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4273 | } |
| 4274 | } |
| 4275 | |
| 4276 | void __stdcall glTexParameteriv(GLenum target, GLenum pname, const GLint* params) |
| 4277 | { |
| 4278 | glTexParameteri(target, pname, *params); |
| 4279 | } |
| 4280 | |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4281 | void __stdcall glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) |
| 4282 | { |
| 4283 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 4284 | target, levels, internalformat, width, height); |
| 4285 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4286 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4287 | if (context) |
| 4288 | { |
| 4289 | if (!context->getExtensions().textureStorage) |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4290 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4291 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4292 | return; |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4293 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4294 | |
| 4295 | if (context->getClientVersion() < 3 && |
| 4296 | !ValidateES2TexStorageParameters(context, target, levels, internalformat, width, height)) |
| 4297 | { |
| 4298 | return; |
| 4299 | } |
| 4300 | |
| 4301 | if (context->getClientVersion() >= 3 && |
| 4302 | !ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1)) |
| 4303 | { |
| 4304 | return; |
| 4305 | } |
| 4306 | |
| 4307 | switch (target) |
| 4308 | { |
| 4309 | case GL_TEXTURE_2D: |
| 4310 | { |
| 4311 | gl::Texture2D *texture2d = context->getTexture2D(); |
| 4312 | texture2d->storage(levels, internalformat, width, height); |
| 4313 | } |
| 4314 | break; |
| 4315 | |
| 4316 | case GL_TEXTURE_CUBE_MAP: |
| 4317 | { |
| 4318 | gl::TextureCubeMap *textureCube = context->getTextureCubeMap(); |
| 4319 | textureCube->storage(levels, internalformat, width); |
| 4320 | } |
| 4321 | break; |
| 4322 | |
| 4323 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4324 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4325 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4326 | } |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 4327 | } |
| 4328 | } |
| 4329 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 4330 | void __stdcall glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, |
| 4331 | GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4332 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4333 | 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] | 4334 | "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] | 4335 | "const GLvoid* pixels = 0x%0.8p)", |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4336 | target, level, xoffset, yoffset, width, height, format, type, pixels); |
| 4337 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4338 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4339 | if (context) |
| 4340 | { |
| 4341 | if (context->getClientVersion() < 3 && |
| 4342 | !ValidateES2TexImageParameters(context, target, level, GL_NONE, false, true, |
| 4343 | xoffset, yoffset, width, height, 0, format, type, pixels)) |
daniel@transgaming.com | 00c7596 | 2010-03-11 20:36:15 +0000 | [diff] [blame] | 4344 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4345 | return; |
daniel@transgaming.com | 00c7596 | 2010-03-11 20:36:15 +0000 | [diff] [blame] | 4346 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4347 | |
| 4348 | if (context->getClientVersion() >= 3 && |
| 4349 | !ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true, |
| 4350 | xoffset, yoffset, 0, width, height, 1, 0, format, type, pixels)) |
| 4351 | { |
| 4352 | return; |
| 4353 | } |
| 4354 | |
| 4355 | // Zero sized uploads are valid but no-ops |
| 4356 | if (width == 0 || height == 0) |
| 4357 | { |
| 4358 | return; |
| 4359 | } |
| 4360 | |
| 4361 | switch (target) |
| 4362 | { |
| 4363 | case GL_TEXTURE_2D: |
| 4364 | { |
| 4365 | gl::Texture2D *texture = context->getTexture2D(); |
| 4366 | texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels); |
| 4367 | } |
| 4368 | break; |
| 4369 | |
| 4370 | case GL_TEXTURE_CUBE_MAP_POSITIVE_X: |
| 4371 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: |
| 4372 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: |
| 4373 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: |
| 4374 | case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 4375 | case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: |
| 4376 | { |
| 4377 | gl::TextureCubeMap *texture = context->getTextureCubeMap(); |
| 4378 | texture->subImage(target, level, xoffset, yoffset, width, height, format, type, context->getState().getUnpackState(), pixels); |
| 4379 | } |
| 4380 | break; |
| 4381 | |
| 4382 | default: |
| 4383 | UNREACHABLE(); |
| 4384 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4385 | } |
| 4386 | } |
| 4387 | |
| 4388 | void __stdcall glUniform1f(GLint location, GLfloat x) |
| 4389 | { |
| 4390 | glUniform1fv(location, 1, &x); |
| 4391 | } |
| 4392 | |
| 4393 | void __stdcall glUniform1fv(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(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4398 | if (context) |
| 4399 | { |
| 4400 | if (!ValidateUniform(context, GL_FLOAT, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4401 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4402 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4403 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4404 | |
| 4405 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4406 | programBinary->setUniform1fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4407 | } |
| 4408 | } |
| 4409 | |
| 4410 | void __stdcall glUniform1i(GLint location, GLint x) |
| 4411 | { |
| 4412 | glUniform1iv(location, 1, &x); |
| 4413 | } |
| 4414 | |
| 4415 | void __stdcall glUniform1iv(GLint location, GLsizei count, const GLint* v) |
| 4416 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4417 | 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] | 4418 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4419 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4420 | if (context) |
| 4421 | { |
| 4422 | if (!ValidateUniform(context, GL_INT, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4423 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4424 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4425 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4426 | |
| 4427 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4428 | programBinary->setUniform1iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4429 | } |
| 4430 | } |
| 4431 | |
| 4432 | void __stdcall glUniform2f(GLint location, GLfloat x, GLfloat y) |
| 4433 | { |
| 4434 | GLfloat xy[2] = {x, y}; |
| 4435 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4436 | glUniform2fv(location, 1, xy); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4437 | } |
| 4438 | |
| 4439 | void __stdcall glUniform2fv(GLint location, GLsizei count, const GLfloat* v) |
| 4440 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4441 | 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] | 4442 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4443 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4444 | if (context) |
| 4445 | { |
| 4446 | if (!ValidateUniform(context, GL_FLOAT_VEC2, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4447 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4448 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4449 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4450 | |
| 4451 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4452 | programBinary->setUniform2fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4453 | } |
| 4454 | } |
| 4455 | |
| 4456 | void __stdcall glUniform2i(GLint location, GLint x, GLint y) |
| 4457 | { |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4458 | GLint xy[2] = {x, y}; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4459 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4460 | glUniform2iv(location, 1, xy); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4461 | } |
| 4462 | |
| 4463 | void __stdcall glUniform2iv(GLint location, GLsizei count, const GLint* v) |
| 4464 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4465 | 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] | 4466 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4467 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4468 | if (context) |
| 4469 | { |
| 4470 | if (!ValidateUniform(context, GL_INT_VEC2, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4471 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4472 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4473 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4474 | |
| 4475 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4476 | programBinary->setUniform2iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4477 | } |
| 4478 | } |
| 4479 | |
| 4480 | void __stdcall glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) |
| 4481 | { |
| 4482 | GLfloat xyz[3] = {x, y, z}; |
| 4483 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4484 | glUniform3fv(location, 1, xyz); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4485 | } |
| 4486 | |
| 4487 | void __stdcall glUniform3fv(GLint location, GLsizei count, const GLfloat* v) |
| 4488 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4489 | 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] | 4490 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4491 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4492 | if (context) |
| 4493 | { |
| 4494 | if (!ValidateUniform(context, GL_FLOAT_VEC3, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4495 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4496 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4497 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4498 | |
| 4499 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4500 | programBinary->setUniform3fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4501 | } |
| 4502 | } |
| 4503 | |
| 4504 | void __stdcall glUniform3i(GLint location, GLint x, GLint y, GLint z) |
| 4505 | { |
| 4506 | GLint xyz[3] = {x, y, z}; |
| 4507 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4508 | glUniform3iv(location, 1, xyz); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4509 | } |
| 4510 | |
| 4511 | void __stdcall glUniform3iv(GLint location, GLsizei count, const GLint* v) |
| 4512 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4513 | 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] | 4514 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4515 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4516 | if (context) |
| 4517 | { |
| 4518 | if (!ValidateUniform(context, GL_INT_VEC3, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4519 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4520 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4521 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4522 | |
| 4523 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4524 | programBinary->setUniform3iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4525 | } |
| 4526 | } |
| 4527 | |
| 4528 | void __stdcall glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
| 4529 | { |
| 4530 | GLfloat xyzw[4] = {x, y, z, w}; |
| 4531 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4532 | glUniform4fv(location, 1, xyzw); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4533 | } |
| 4534 | |
| 4535 | void __stdcall glUniform4fv(GLint location, GLsizei count, const GLfloat* v) |
| 4536 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4537 | 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] | 4538 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4539 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4540 | if (context) |
| 4541 | { |
| 4542 | if (!ValidateUniform(context, GL_FLOAT_VEC4, location, count)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4543 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4544 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4545 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4546 | |
| 4547 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4548 | programBinary->setUniform4fv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4549 | } |
| 4550 | } |
| 4551 | |
| 4552 | void __stdcall glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) |
| 4553 | { |
| 4554 | GLint xyzw[4] = {x, y, z, w}; |
| 4555 | |
Geoff Lang | 3b3ad1f | 2014-03-05 14:35:01 -0500 | [diff] [blame] | 4556 | glUniform4iv(location, 1, xyzw); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4557 | } |
| 4558 | |
| 4559 | void __stdcall glUniform4iv(GLint location, GLsizei count, const GLint* v) |
| 4560 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4561 | 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] | 4562 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4563 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4564 | if (context) |
| 4565 | { |
| 4566 | if (!ValidateUniform(context, GL_INT_VEC4, location, count)) |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4567 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4568 | return; |
daniel@transgaming.com | 9a95e2b | 2010-04-13 03:26:03 +0000 | [diff] [blame] | 4569 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4570 | |
| 4571 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4572 | programBinary->setUniform4iv(location, count, v); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4573 | } |
| 4574 | } |
| 4575 | |
| 4576 | void __stdcall glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 4577 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4578 | 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] | 4579 | location, count, transpose, value); |
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 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4582 | if (context) |
| 4583 | { |
| 4584 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4585 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4586 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4587 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4588 | |
| 4589 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4590 | programBinary->setUniformMatrix2fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4591 | } |
| 4592 | } |
| 4593 | |
| 4594 | void __stdcall glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 4595 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4596 | 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] | 4597 | location, count, transpose, value); |
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 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4600 | if (context) |
| 4601 | { |
| 4602 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4603 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4604 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4605 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4606 | |
| 4607 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4608 | programBinary->setUniformMatrix3fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4609 | } |
| 4610 | } |
| 4611 | |
| 4612 | void __stdcall glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 4613 | { |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4614 | 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] | 4615 | location, count, transpose, value); |
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 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4618 | if (context) |
| 4619 | { |
| 4620 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4, location, count, transpose)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4621 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4622 | return; |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4623 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4624 | |
| 4625 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 4626 | programBinary->setUniformMatrix4fv(location, count, transpose, value); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4627 | } |
| 4628 | } |
| 4629 | |
| 4630 | void __stdcall glUseProgram(GLuint program) |
| 4631 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4632 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4633 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4634 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4635 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4636 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4637 | gl::Program *programObject = context->getProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4638 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4639 | if (!programObject && program != 0) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4640 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4641 | if (context->getShader(program)) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4642 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4643 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4644 | return; |
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 | else |
| 4647 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4648 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4649 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4650 | } |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4651 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4652 | |
| 4653 | if (program != 0 && !programObject->isLinked()) |
| 4654 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4655 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4656 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4657 | } |
| 4658 | |
| 4659 | context->useProgram(program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4660 | } |
| 4661 | } |
| 4662 | |
| 4663 | void __stdcall glValidateProgram(GLuint program) |
| 4664 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4665 | EVENT("(GLuint program = %d)", program); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4666 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4667 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4668 | if (context) |
| 4669 | { |
| 4670 | gl::Program *programObject = context->getProgram(program); |
| 4671 | |
| 4672 | if (!programObject) |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4673 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4674 | if (context->getShader(program)) |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4675 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4676 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4677 | return; |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4678 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4679 | else |
| 4680 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4681 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4682 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4683 | } |
daniel@transgaming.com | 86a7a13 | 2010-04-29 03:32:32 +0000 | [diff] [blame] | 4684 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4685 | |
Brandon Jones | 43a53e2 | 2014-08-28 16:23:22 -0700 | [diff] [blame] | 4686 | programObject->validate(context->getCaps()); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4687 | } |
| 4688 | } |
| 4689 | |
| 4690 | void __stdcall glVertexAttrib1f(GLuint index, GLfloat x) |
| 4691 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4692 | EVENT("(GLuint index = %d, GLfloat x = %f)", index, x); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4693 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4694 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4695 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4696 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4697 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4698 | { |
| 4699 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4700 | return; |
| 4701 | } |
| 4702 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4703 | GLfloat vals[4] = { x, 0, 0, 1 }; |
| 4704 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4705 | } |
| 4706 | } |
| 4707 | |
| 4708 | void __stdcall glVertexAttrib1fv(GLuint index, const GLfloat* values) |
| 4709 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4710 | 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] | 4711 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4712 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4713 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4714 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4715 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4716 | { |
| 4717 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4718 | return; |
| 4719 | } |
| 4720 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4721 | GLfloat vals[4] = { values[0], 0, 0, 1 }; |
| 4722 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4723 | } |
| 4724 | } |
| 4725 | |
| 4726 | void __stdcall glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y) |
| 4727 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4728 | 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] | 4729 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4730 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4731 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4732 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4733 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4734 | { |
| 4735 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4736 | return; |
| 4737 | } |
| 4738 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4739 | GLfloat vals[4] = { x, y, 0, 1 }; |
| 4740 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4741 | } |
| 4742 | } |
| 4743 | |
| 4744 | void __stdcall glVertexAttrib2fv(GLuint index, const GLfloat* values) |
| 4745 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4746 | 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] | 4747 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4748 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4749 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4750 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4751 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4752 | { |
| 4753 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4754 | return; |
| 4755 | } |
| 4756 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4757 | GLfloat vals[4] = { values[0], values[1], 0, 1 }; |
| 4758 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4759 | } |
| 4760 | } |
| 4761 | |
| 4762 | void __stdcall glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z) |
| 4763 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4764 | 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] | 4765 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4766 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4767 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4768 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4769 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4770 | { |
| 4771 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4772 | return; |
| 4773 | } |
| 4774 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4775 | GLfloat vals[4] = { x, y, z, 1 }; |
| 4776 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4777 | } |
| 4778 | } |
| 4779 | |
| 4780 | void __stdcall glVertexAttrib3fv(GLuint index, const GLfloat* values) |
| 4781 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4782 | 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] | 4783 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4784 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4785 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4786 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4787 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4788 | { |
| 4789 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4790 | return; |
| 4791 | } |
| 4792 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4793 | GLfloat vals[4] = { values[0], values[1], values[2], 1 }; |
| 4794 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4795 | } |
| 4796 | } |
| 4797 | |
| 4798 | void __stdcall glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
| 4799 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4800 | 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] | 4801 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4802 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4803 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4804 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4805 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4806 | { |
| 4807 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4808 | return; |
| 4809 | } |
| 4810 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4811 | GLfloat vals[4] = { x, y, z, w }; |
| 4812 | context->getState().setVertexAttribf(index, vals); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4813 | } |
| 4814 | } |
| 4815 | |
| 4816 | void __stdcall glVertexAttrib4fv(GLuint index, const GLfloat* values) |
| 4817 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4818 | 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] | 4819 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4820 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4821 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4822 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4823 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4824 | { |
| 4825 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4826 | return; |
| 4827 | } |
| 4828 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4829 | context->getState().setVertexAttribf(index, values); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4830 | } |
| 4831 | } |
| 4832 | |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4833 | void __stdcall glVertexAttribDivisorANGLE(GLuint index, GLuint divisor) |
| 4834 | { |
| 4835 | EVENT("(GLuint index = %d, GLuint divisor = %d)", index, divisor); |
| 4836 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4837 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4838 | if (context) |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4839 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4840 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4841 | { |
| 4842 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4843 | return; |
| 4844 | } |
| 4845 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4846 | context->setVertexAttribDivisor(index, divisor); |
daniel@transgaming.com | d2820bf | 2012-01-27 15:38:48 +0000 | [diff] [blame] | 4847 | } |
| 4848 | } |
| 4849 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 4850 | 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] | 4851 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4852 | 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] | 4853 | "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] | 4854 | index, size, type, normalized, stride, ptr); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4855 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4856 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4857 | if (context) |
| 4858 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4859 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 4860 | { |
| 4861 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4862 | return; |
| 4863 | } |
| 4864 | |
| 4865 | if (size < 1 || size > 4) |
| 4866 | { |
| 4867 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4868 | return; |
| 4869 | } |
| 4870 | |
| 4871 | switch (type) |
| 4872 | { |
| 4873 | case GL_BYTE: |
| 4874 | case GL_UNSIGNED_BYTE: |
| 4875 | case GL_SHORT: |
| 4876 | case GL_UNSIGNED_SHORT: |
| 4877 | case GL_FIXED: |
| 4878 | case GL_FLOAT: |
| 4879 | break; |
| 4880 | |
| 4881 | case GL_HALF_FLOAT: |
| 4882 | case GL_INT: |
| 4883 | case GL_UNSIGNED_INT: |
| 4884 | case GL_INT_2_10_10_10_REV: |
| 4885 | case GL_UNSIGNED_INT_2_10_10_10_REV: |
| 4886 | if (context->getClientVersion() < 3) |
| 4887 | { |
| 4888 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4889 | return; |
| 4890 | } |
| 4891 | break; |
| 4892 | |
| 4893 | default: |
| 4894 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 4895 | return; |
| 4896 | } |
| 4897 | |
| 4898 | if (stride < 0) |
| 4899 | { |
| 4900 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4901 | return; |
| 4902 | } |
| 4903 | |
| 4904 | if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4) |
| 4905 | { |
| 4906 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4907 | return; |
| 4908 | } |
| 4909 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4910 | // [OpenGL ES 3.0.2] Section 2.8 page 24: |
| 4911 | // An INVALID_OPERATION error is generated when a non-zero vertex array object |
| 4912 | // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point, |
| 4913 | // and the pointer argument is not NULL. |
| 4914 | 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] | 4915 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4916 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4917 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 1ab57be | 2013-04-13 03:38:39 +0000 | [diff] [blame] | 4918 | } |
| 4919 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4920 | context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type, |
| 4921 | normalized == GL_TRUE, false, stride, ptr); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4922 | } |
| 4923 | } |
| 4924 | |
| 4925 | void __stdcall glViewport(GLint x, GLint y, GLsizei width, GLsizei height) |
| 4926 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 4927 | 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] | 4928 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4929 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4930 | if (context) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4931 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4932 | if (width < 0 || height < 0) |
| 4933 | { |
| 4934 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 4935 | return; |
| 4936 | } |
| 4937 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4938 | context->getState().setViewportParams(x, y, width, height); |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 4939 | } |
| 4940 | } |
| 4941 | |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4942 | // OpenGL ES 3.0 functions |
| 4943 | |
| 4944 | void __stdcall glReadBuffer(GLenum mode) |
| 4945 | { |
| 4946 | EVENT("(GLenum mode = 0x%X)", mode); |
| 4947 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4948 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4949 | if (context) |
| 4950 | { |
| 4951 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4952 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4953 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4954 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 4955 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4956 | |
| 4957 | // glReadBuffer |
| 4958 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4959 | } |
| 4960 | } |
| 4961 | |
| 4962 | void __stdcall glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices) |
| 4963 | { |
| 4964 | EVENT("(GLenum mode = 0x%X, GLuint start = %u, GLuint end = %u, GLsizei count = %d, GLenum type = 0x%X, " |
| 4965 | "const GLvoid* indices = 0x%0.8p)", mode, start, end, count, type, indices); |
| 4966 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4967 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4968 | if (context) |
| 4969 | { |
| 4970 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4971 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4972 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4973 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 4974 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4975 | |
| 4976 | // glDrawRangeElements |
| 4977 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4978 | } |
| 4979 | } |
| 4980 | |
| 4981 | void __stdcall glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
| 4982 | { |
| 4983 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, " |
| 4984 | "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLenum format = 0x%X, " |
| 4985 | "GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", |
| 4986 | target, level, internalformat, width, height, depth, border, format, type, pixels); |
| 4987 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4988 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4989 | if (context) |
| 4990 | { |
| 4991 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 4992 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 4993 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 4994 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 4995 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 4996 | |
| 4997 | // validateES3TexImageFormat sets the error code if there is an error |
| 4998 | if (!ValidateES3TexImageParameters(context, target, level, internalformat, false, false, |
| 4999 | 0, 0, 0, width, height, depth, border, format, type, pixels)) |
| 5000 | { |
| 5001 | return; |
| 5002 | } |
| 5003 | |
| 5004 | switch(target) |
| 5005 | { |
| 5006 | case GL_TEXTURE_3D: |
| 5007 | { |
| 5008 | gl::Texture3D *texture = context->getTexture3D(); |
| 5009 | texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 5010 | } |
| 5011 | break; |
| 5012 | |
| 5013 | case GL_TEXTURE_2D_ARRAY: |
| 5014 | { |
| 5015 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
| 5016 | texture->setImage(level, width, height, depth, internalformat, format, type, context->getState().getUnpackState(), pixels); |
| 5017 | } |
| 5018 | break; |
| 5019 | |
| 5020 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5021 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5022 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5023 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5024 | } |
| 5025 | } |
| 5026 | |
| 5027 | 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) |
| 5028 | { |
| 5029 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5030 | "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, " |
| 5031 | "GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", |
| 5032 | target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); |
| 5033 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5034 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5035 | if (context) |
| 5036 | { |
| 5037 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5038 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5039 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5040 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5041 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5042 | |
| 5043 | // validateES3TexImageFormat sets the error code if there is an error |
| 5044 | if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true, |
| 5045 | xoffset, yoffset, zoffset, width, height, depth, 0, |
| 5046 | format, type, pixels)) |
| 5047 | { |
| 5048 | return; |
| 5049 | } |
| 5050 | |
| 5051 | // Zero sized uploads are valid but no-ops |
| 5052 | if (width == 0 || height == 0 || depth == 0) |
| 5053 | { |
| 5054 | return; |
| 5055 | } |
| 5056 | |
| 5057 | switch(target) |
| 5058 | { |
| 5059 | case GL_TEXTURE_3D: |
| 5060 | { |
| 5061 | gl::Texture3D *texture = context->getTexture3D(); |
| 5062 | texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels); |
| 5063 | } |
| 5064 | break; |
| 5065 | |
| 5066 | case GL_TEXTURE_2D_ARRAY: |
| 5067 | { |
| 5068 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
| 5069 | texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getState().getUnpackState(), pixels); |
| 5070 | } |
| 5071 | break; |
| 5072 | |
| 5073 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5074 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5075 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5076 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5077 | } |
| 5078 | } |
| 5079 | |
| 5080 | void __stdcall glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) |
| 5081 | { |
| 5082 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5083 | "GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", |
| 5084 | target, level, xoffset, yoffset, zoffset, x, y, width, height); |
| 5085 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5086 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5087 | if (context) |
| 5088 | { |
| 5089 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5090 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5091 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5092 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5093 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5094 | |
| 5095 | if (!ValidateES3CopyTexImageParameters(context, target, level, GL_NONE, true, xoffset, yoffset, zoffset, |
| 5096 | x, y, width, height, 0)) |
| 5097 | { |
| 5098 | return; |
| 5099 | } |
| 5100 | |
| 5101 | gl::Framebuffer *framebuffer = context->getState().getReadFramebuffer(); |
| 5102 | gl::Texture *texture = NULL; |
| 5103 | switch (target) |
| 5104 | { |
| 5105 | case GL_TEXTURE_3D: |
| 5106 | texture = context->getTexture3D(); |
| 5107 | break; |
| 5108 | |
| 5109 | case GL_TEXTURE_2D_ARRAY: |
| 5110 | texture = context->getTexture2DArray(); |
| 5111 | break; |
| 5112 | |
| 5113 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5114 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5115 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5116 | } |
| 5117 | |
| 5118 | 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] | 5119 | } |
| 5120 | } |
| 5121 | |
| 5122 | void __stdcall glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) |
| 5123 | { |
Geoff Lang | eef52cc | 2013-10-16 15:07:39 -0400 | [diff] [blame] | 5124 | 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] | 5125 | "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLsizei imageSize = %d, " |
| 5126 | "const GLvoid* data = 0x%0.8p)", |
| 5127 | target, level, internalformat, width, height, depth, border, imageSize, data); |
| 5128 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5129 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5130 | if (context) |
| 5131 | { |
| 5132 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5133 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5134 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5135 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5136 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5137 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 5138 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat); |
| 5139 | 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] | 5140 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5141 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5142 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5143 | } |
| 5144 | |
| 5145 | // validateES3TexImageFormat sets the error code if there is an error |
| 5146 | if (!ValidateES3TexImageParameters(context, target, level, internalformat, true, false, |
| 5147 | 0, 0, 0, width, height, depth, border, GL_NONE, GL_NONE, data)) |
| 5148 | { |
| 5149 | return; |
| 5150 | } |
| 5151 | |
| 5152 | switch(target) |
| 5153 | { |
| 5154 | case GL_TEXTURE_3D: |
| 5155 | { |
| 5156 | gl::Texture3D *texture = context->getTexture3D(); |
| 5157 | texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, data); |
| 5158 | } |
| 5159 | break; |
| 5160 | |
| 5161 | case GL_TEXTURE_2D_ARRAY: |
| 5162 | { |
| 5163 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
| 5164 | texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, data); |
| 5165 | } |
| 5166 | break; |
| 5167 | |
| 5168 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5169 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5170 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5171 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5172 | } |
| 5173 | } |
| 5174 | |
| 5175 | 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) |
| 5176 | { |
| 5177 | EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " |
| 5178 | "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, " |
| 5179 | "GLenum format = 0x%X, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", |
| 5180 | target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); |
| 5181 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5182 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5183 | if (context) |
| 5184 | { |
| 5185 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5186 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5187 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5188 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 875994b | 2013-04-13 03:45:17 +0000 | [diff] [blame] | 5189 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5190 | |
Geoff Lang | 5d60138 | 2014-07-22 15:14:06 -0400 | [diff] [blame] | 5191 | const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format); |
| 5192 | 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] | 5193 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5194 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5195 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5196 | } |
| 5197 | |
| 5198 | if (!data) |
| 5199 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5200 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5201 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5202 | } |
| 5203 | |
| 5204 | // validateES3TexImageFormat sets the error code if there is an error |
| 5205 | if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true, |
| 5206 | 0, 0, 0, width, height, depth, 0, GL_NONE, GL_NONE, data)) |
| 5207 | { |
| 5208 | return; |
| 5209 | } |
| 5210 | |
| 5211 | // Zero sized uploads are valid but no-ops |
| 5212 | if (width == 0 || height == 0) |
| 5213 | { |
| 5214 | return; |
| 5215 | } |
| 5216 | |
| 5217 | switch(target) |
| 5218 | { |
| 5219 | case GL_TEXTURE_3D: |
| 5220 | { |
| 5221 | gl::Texture3D *texture = context->getTexture3D(); |
| 5222 | texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, |
| 5223 | format, imageSize, data); |
| 5224 | } |
| 5225 | break; |
| 5226 | |
| 5227 | case GL_TEXTURE_2D_ARRAY: |
| 5228 | { |
| 5229 | gl::Texture2DArray *texture = context->getTexture2DArray(); |
| 5230 | texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, |
| 5231 | format, imageSize, data); |
| 5232 | } |
| 5233 | break; |
| 5234 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5235 | default: |
| 5236 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5237 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5238 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5239 | } |
| 5240 | } |
| 5241 | |
| 5242 | void __stdcall glGenQueries(GLsizei n, GLuint* ids) |
| 5243 | { |
| 5244 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 5245 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5246 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5247 | if (context) |
| 5248 | { |
| 5249 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5250 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5251 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5252 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5253 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5254 | |
| 5255 | if (n < 0) |
| 5256 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5257 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5258 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5259 | } |
| 5260 | |
| 5261 | for (GLsizei i = 0; i < n; i++) |
| 5262 | { |
| 5263 | ids[i] = context->createQuery(); |
| 5264 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5265 | } |
| 5266 | } |
| 5267 | |
| 5268 | void __stdcall glDeleteQueries(GLsizei n, const GLuint* ids) |
| 5269 | { |
| 5270 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 5271 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5272 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5273 | if (context) |
| 5274 | { |
| 5275 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5276 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5277 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5278 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5279 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5280 | |
| 5281 | if (n < 0) |
| 5282 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5283 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5284 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5285 | } |
| 5286 | |
| 5287 | for (GLsizei i = 0; i < n; i++) |
| 5288 | { |
| 5289 | context->deleteQuery(ids[i]); |
| 5290 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5291 | } |
| 5292 | } |
| 5293 | |
| 5294 | GLboolean __stdcall glIsQuery(GLuint id) |
| 5295 | { |
| 5296 | EVENT("(GLuint id = %u)", id); |
| 5297 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5298 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5299 | if (context) |
| 5300 | { |
| 5301 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5302 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5303 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5304 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5305 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5306 | |
| 5307 | 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] | 5308 | } |
| 5309 | |
| 5310 | return GL_FALSE; |
| 5311 | } |
| 5312 | |
| 5313 | void __stdcall glBeginQuery(GLenum target, GLuint id) |
| 5314 | { |
| 5315 | EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id); |
| 5316 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5317 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5318 | if (context) |
| 5319 | { |
| 5320 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5321 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5322 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5323 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5324 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5325 | |
| 5326 | if (!ValidateBeginQuery(context, target, id)) |
| 5327 | { |
| 5328 | return; |
| 5329 | } |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame^] | 5330 | |
| 5331 | gl::Error error = context->beginQuery(target, id); |
| 5332 | if (error.isError()) |
| 5333 | { |
| 5334 | context->recordError(error); |
| 5335 | return; |
| 5336 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5337 | } |
| 5338 | } |
| 5339 | |
| 5340 | void __stdcall glEndQuery(GLenum target) |
| 5341 | { |
| 5342 | EVENT("(GLenum target = 0x%X)", target); |
| 5343 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5344 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5345 | if (context) |
| 5346 | { |
| 5347 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5348 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5349 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5350 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5351 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5352 | |
| 5353 | if (!ValidateEndQuery(context, target)) |
| 5354 | { |
| 5355 | return; |
| 5356 | } |
| 5357 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame^] | 5358 | gl::Error error = context->endQuery(target); |
| 5359 | if (error.isError()) |
| 5360 | { |
| 5361 | context->recordError(error); |
| 5362 | return; |
| 5363 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5364 | } |
| 5365 | } |
| 5366 | |
| 5367 | void __stdcall glGetQueryiv(GLenum target, GLenum pname, GLint* params) |
| 5368 | { |
| 5369 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params); |
| 5370 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5371 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5372 | if (context) |
| 5373 | { |
| 5374 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5375 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5376 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5377 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5378 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5379 | |
| 5380 | if (!ValidQueryType(context, target)) |
| 5381 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5382 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5383 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5384 | } |
| 5385 | |
| 5386 | switch (pname) |
| 5387 | { |
| 5388 | case GL_CURRENT_QUERY: |
| 5389 | params[0] = static_cast<GLint>(context->getState().getActiveQueryId(target)); |
| 5390 | break; |
| 5391 | |
| 5392 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5393 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5394 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5395 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5396 | } |
| 5397 | } |
| 5398 | |
| 5399 | void __stdcall glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) |
| 5400 | { |
| 5401 | EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", id, pname, params); |
| 5402 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5403 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5404 | if (context) |
| 5405 | { |
| 5406 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5407 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5408 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5409 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5410 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5411 | |
| 5412 | gl::Query *queryObject = context->getQuery(id, false, GL_NONE); |
| 5413 | |
| 5414 | if (!queryObject) |
| 5415 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5416 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5417 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5418 | } |
| 5419 | |
| 5420 | if (context->getState().getActiveQueryId(queryObject->getType()) == id) |
| 5421 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5422 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5423 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5424 | } |
| 5425 | |
| 5426 | switch(pname) |
| 5427 | { |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame^] | 5428 | case GL_QUERY_RESULT_EXT: |
| 5429 | { |
| 5430 | gl::Error error = queryObject->getResult(params); |
| 5431 | if (error.isError()) |
| 5432 | { |
| 5433 | context->recordError(error); |
| 5434 | return; |
| 5435 | } |
| 5436 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5437 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5438 | |
Geoff Lang | 5aad967 | 2014-09-08 11:10:42 -0400 | [diff] [blame^] | 5439 | case GL_QUERY_RESULT_AVAILABLE_EXT: |
| 5440 | { |
| 5441 | gl::Error error = queryObject->isResultAvailable(params); |
| 5442 | if (error.isError()) |
| 5443 | { |
| 5444 | context->recordError(error); |
| 5445 | return; |
| 5446 | } |
| 5447 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5448 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5449 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5450 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5451 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5452 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5453 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5454 | } |
| 5455 | } |
| 5456 | |
| 5457 | GLboolean __stdcall glUnmapBuffer(GLenum target) |
| 5458 | { |
| 5459 | EVENT("(GLenum target = 0x%X)", target); |
| 5460 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5461 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5462 | if (context) |
| 5463 | { |
| 5464 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5465 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5466 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5467 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5468 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5469 | |
| 5470 | return glUnmapBufferOES(target); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5471 | } |
| 5472 | |
| 5473 | return GL_FALSE; |
| 5474 | } |
| 5475 | |
| 5476 | void __stdcall glGetBufferPointerv(GLenum target, GLenum pname, GLvoid** params) |
| 5477 | { |
| 5478 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params); |
| 5479 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5480 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5481 | if (context) |
| 5482 | { |
| 5483 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5484 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5485 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5486 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5487 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5488 | |
| 5489 | glGetBufferPointervOES(target, pname, params); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5490 | } |
| 5491 | } |
| 5492 | |
| 5493 | void __stdcall glDrawBuffers(GLsizei n, const GLenum* bufs) |
| 5494 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5495 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5496 | if (context) |
| 5497 | { |
| 5498 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5499 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5500 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5501 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 7948c5f | 2013-04-13 03:38:58 +0000 | [diff] [blame] | 5502 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5503 | |
| 5504 | glDrawBuffersEXT(n, bufs); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5505 | } |
| 5506 | } |
| 5507 | |
| 5508 | void __stdcall glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 5509 | { |
| 5510 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5511 | location, count, transpose, value); |
| 5512 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5513 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5514 | if (context) |
| 5515 | { |
| 5516 | if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2x3, location, count, transpose)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5517 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5518 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5519 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5520 | |
| 5521 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5522 | programBinary->setUniformMatrix2x3fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5523 | } |
| 5524 | } |
| 5525 | |
| 5526 | void __stdcall glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 5527 | { |
| 5528 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5529 | location, count, transpose, value); |
| 5530 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5531 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5532 | if (context) |
| 5533 | { |
| 5534 | 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] | 5535 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5536 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5537 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5538 | |
| 5539 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5540 | programBinary->setUniformMatrix3x2fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5541 | } |
| 5542 | } |
| 5543 | |
| 5544 | void __stdcall glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 5545 | { |
| 5546 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5547 | location, count, transpose, value); |
| 5548 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5549 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5550 | if (context) |
| 5551 | { |
| 5552 | 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] | 5553 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5554 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5555 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5556 | |
| 5557 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5558 | programBinary->setUniformMatrix2x4fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5559 | } |
| 5560 | } |
| 5561 | |
| 5562 | void __stdcall glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 5563 | { |
| 5564 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5565 | location, count, transpose, value); |
| 5566 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5567 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5568 | if (context) |
| 5569 | { |
| 5570 | 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] | 5571 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5572 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5573 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5574 | |
| 5575 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5576 | programBinary->setUniformMatrix4x2fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5577 | } |
| 5578 | } |
| 5579 | |
| 5580 | void __stdcall glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 5581 | { |
| 5582 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5583 | location, count, transpose, value); |
| 5584 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5585 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5586 | if (context) |
| 5587 | { |
| 5588 | 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] | 5589 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5590 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5591 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5592 | |
| 5593 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5594 | programBinary->setUniformMatrix3x4fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5595 | } |
| 5596 | } |
| 5597 | |
| 5598 | void __stdcall glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) |
| 5599 | { |
| 5600 | EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", |
| 5601 | location, count, transpose, value); |
| 5602 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5603 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5604 | if (context) |
| 5605 | { |
| 5606 | 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] | 5607 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5608 | return; |
shannon.woods%transgaming.com@gtempaccount.com | f130616 | 2013-04-13 03:40:04 +0000 | [diff] [blame] | 5609 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5610 | |
| 5611 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 5612 | programBinary->setUniformMatrix4x3fv(location, count, transpose, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5613 | } |
| 5614 | } |
| 5615 | |
| 5616 | void __stdcall glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) |
| 5617 | { |
| 5618 | EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, GLint dstX0 = %d, " |
| 5619 | "GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, GLbitfield mask = 0x%X, GLenum filter = 0x%X)", |
| 5620 | srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 5621 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5622 | gl::Context *context = gl::getNonLostContext(); |
| 5623 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5624 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5625 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5626 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5627 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5628 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5629 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5630 | |
| 5631 | if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, |
| 5632 | dstX0, dstY0, dstX1, dstY1, mask, filter, |
| 5633 | false)) |
| 5634 | { |
| 5635 | return; |
| 5636 | } |
| 5637 | |
| 5638 | context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, |
| 5639 | mask, filter); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5640 | } |
| 5641 | } |
| 5642 | |
| 5643 | void __stdcall glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) |
| 5644 | { |
| 5645 | EVENT("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 5646 | target, samples, internalformat, width, height); |
| 5647 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5648 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5649 | if (context) |
| 5650 | { |
| 5651 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5652 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5653 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5654 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5655 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5656 | |
| 5657 | if (!ValidateRenderbufferStorageParameters(context, target, samples, internalformat, |
| 5658 | width, height, false)) |
| 5659 | { |
| 5660 | return; |
| 5661 | } |
| 5662 | |
| 5663 | context->setRenderbufferStorage(width, height, internalformat, samples); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5664 | } |
| 5665 | } |
| 5666 | |
| 5667 | void __stdcall glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) |
| 5668 | { |
| 5669 | EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d, GLint layer = %d)", |
| 5670 | target, attachment, texture, level, layer); |
| 5671 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5672 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5673 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5674 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5675 | if (!ValidateFramebufferTextureLayer(context, target, attachment, texture, |
| 5676 | level, layer)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5677 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5678 | return; |
| 5679 | } |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5680 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5681 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 5682 | ASSERT(framebuffer); |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5683 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5684 | gl::Texture *textureObject = context->getTexture(texture); |
| 5685 | GLenum textarget = textureObject ? textureObject->getTarget() : GL_NONE; |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5686 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5687 | if (attachment >= GL_COLOR_ATTACHMENT0_EXT && attachment <= GL_COLOR_ATTACHMENT15_EXT) |
| 5688 | { |
| 5689 | const unsigned int colorAttachment = (attachment - GL_COLOR_ATTACHMENT0_EXT); |
| 5690 | framebuffer->setColorbuffer(colorAttachment, textarget, texture, level, layer); |
| 5691 | } |
| 5692 | else |
| 5693 | { |
| 5694 | switch (attachment) |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5695 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5696 | case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level, layer); break; |
| 5697 | case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level, layer); break; |
| 5698 | case GL_DEPTH_STENCIL_ATTACHMENT: framebuffer->setDepthStencilBuffer(textarget, texture, level, layer); break; |
Geoff Lang | 3ed0c48 | 2013-07-25 17:03:18 -0400 | [diff] [blame] | 5699 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5700 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5701 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5702 | } |
| 5703 | |
| 5704 | GLvoid* __stdcall glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) |
| 5705 | { |
| 5706 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)", |
| 5707 | target, offset, length, access); |
| 5708 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5709 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5710 | if (context) |
| 5711 | { |
| 5712 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5713 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5714 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5715 | return NULL; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5716 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5717 | |
| 5718 | return glMapBufferRangeEXT(target, offset, length, access); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5719 | } |
| 5720 | |
| 5721 | return NULL; |
| 5722 | } |
| 5723 | |
| 5724 | void __stdcall glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) |
| 5725 | { |
| 5726 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length); |
| 5727 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5728 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5729 | if (context) |
| 5730 | { |
| 5731 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5732 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5733 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5734 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5735 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5736 | |
| 5737 | glFlushMappedBufferRangeEXT(target, offset, length); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5738 | } |
| 5739 | } |
| 5740 | |
| 5741 | void __stdcall glBindVertexArray(GLuint array) |
| 5742 | { |
| 5743 | EVENT("(GLuint array = %u)", array); |
| 5744 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5745 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5746 | if (context) |
| 5747 | { |
| 5748 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5749 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5750 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5751 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5752 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5753 | |
| 5754 | gl::VertexArray *vao = context->getVertexArray(array); |
| 5755 | |
| 5756 | if (!vao) |
| 5757 | { |
| 5758 | // The default VAO should always exist |
| 5759 | ASSERT(array != 0); |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5760 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5761 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5762 | } |
| 5763 | |
| 5764 | context->bindVertexArray(array); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5765 | } |
| 5766 | } |
| 5767 | |
| 5768 | void __stdcall glDeleteVertexArrays(GLsizei n, const GLuint* arrays) |
| 5769 | { |
| 5770 | EVENT("(GLsizei n = %d, const GLuint* arrays = 0x%0.8p)", n, arrays); |
| 5771 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5772 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5773 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5774 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5775 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5776 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5777 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5778 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5779 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5780 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5781 | if (n < 0) |
| 5782 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5783 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5784 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5785 | } |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5786 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5787 | for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) |
| 5788 | { |
| 5789 | if (arrays[arrayIndex] != 0) |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5790 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5791 | context->deleteVertexArray(arrays[arrayIndex]); |
Jamie Madill | d102854 | 2013-07-02 11:57:04 -0400 | [diff] [blame] | 5792 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5793 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5794 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5795 | } |
| 5796 | |
| 5797 | void __stdcall glGenVertexArrays(GLsizei n, GLuint* arrays) |
| 5798 | { |
| 5799 | EVENT("(GLsizei n = %d, GLuint* arrays = 0x%0.8p)", n, arrays); |
| 5800 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5801 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5802 | if (context) |
| 5803 | { |
| 5804 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5805 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5806 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5807 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5808 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5809 | |
| 5810 | if (n < 0) |
| 5811 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5812 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5813 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5814 | } |
| 5815 | |
| 5816 | for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) |
| 5817 | { |
| 5818 | arrays[arrayIndex] = context->createVertexArray(); |
| 5819 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5820 | } |
| 5821 | } |
| 5822 | |
| 5823 | GLboolean __stdcall glIsVertexArray(GLuint array) |
| 5824 | { |
| 5825 | EVENT("(GLuint array = %u)", array); |
| 5826 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5827 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5828 | if (context) |
| 5829 | { |
| 5830 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5831 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5832 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5833 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5834 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5835 | |
| 5836 | if (array == 0) |
| 5837 | { |
| 5838 | return GL_FALSE; |
| 5839 | } |
| 5840 | |
| 5841 | gl::VertexArray *vao = context->getVertexArray(array); |
| 5842 | |
| 5843 | return (vao != NULL ? GL_TRUE : GL_FALSE); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5844 | } |
| 5845 | |
| 5846 | return GL_FALSE; |
| 5847 | } |
| 5848 | |
| 5849 | void __stdcall glGetIntegeri_v(GLenum target, GLuint index, GLint* data) |
| 5850 | { |
| 5851 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint* data = 0x%0.8p)", |
| 5852 | target, index, data); |
| 5853 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5854 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5855 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5856 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5857 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5858 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5859 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5860 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5861 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5862 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 5863 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5864 | switch (target) |
| 5865 | { |
| 5866 | case GL_TRANSFORM_FEEDBACK_BUFFER_START: |
| 5867 | case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: |
| 5868 | case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 5869 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
| 5870 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5871 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5872 | return; |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 5873 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5874 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5875 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5876 | case GL_UNIFORM_BUFFER_START: |
| 5877 | case GL_UNIFORM_BUFFER_SIZE: |
| 5878 | case GL_UNIFORM_BUFFER_BINDING: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 5879 | if (index >= caps.maxCombinedUniformBlocks) |
| 5880 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5881 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 5882 | return; |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 5883 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5884 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5885 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5886 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5887 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5888 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5889 | } |
| 5890 | |
| 5891 | if (!(context->getIndexedIntegerv(target, index, data))) |
| 5892 | { |
| 5893 | GLenum nativeType; |
| 5894 | unsigned int numParams = 0; |
| 5895 | if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams)) |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5896 | { |
| 5897 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5898 | return; |
| 5899 | } |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 5900 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5901 | if (numParams == 0) |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5902 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5903 | return; // it is known that pname is valid, but there are no parameters to return |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5904 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5905 | |
| 5906 | if (nativeType == GL_INT_64_ANGLEX) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 5907 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5908 | GLint64 minIntValue = static_cast<GLint64>(std::numeric_limits<int>::min()); |
| 5909 | GLint64 maxIntValue = static_cast<GLint64>(std::numeric_limits<int>::max()); |
| 5910 | GLint64 *int64Params = new GLint64[numParams]; |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 5911 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5912 | context->getIndexedInteger64v(target, index, int64Params); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 5913 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5914 | for (unsigned int i = 0; i < numParams; ++i) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 5915 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5916 | GLint64 clampedValue = std::max(std::min(int64Params[i], maxIntValue), minIntValue); |
| 5917 | data[i] = static_cast<GLint>(clampedValue); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 5918 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5919 | |
| 5920 | delete [] int64Params; |
| 5921 | } |
| 5922 | else |
| 5923 | { |
| 5924 | UNREACHABLE(); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 5925 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5926 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5927 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5928 | } |
| 5929 | |
| 5930 | void __stdcall glBeginTransformFeedback(GLenum primitiveMode) |
| 5931 | { |
| 5932 | EVENT("(GLenum primitiveMode = 0x%X)", primitiveMode); |
| 5933 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5934 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5935 | if (context) |
| 5936 | { |
| 5937 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5938 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5939 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5940 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5941 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5942 | |
| 5943 | switch (primitiveMode) |
| 5944 | { |
| 5945 | case GL_TRIANGLES: |
| 5946 | case GL_LINES: |
| 5947 | case GL_POINTS: |
| 5948 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5949 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5950 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5951 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 5952 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5953 | } |
| 5954 | |
| 5955 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 5956 | ASSERT(transformFeedback != NULL); |
| 5957 | |
| 5958 | if (transformFeedback->isStarted()) |
| 5959 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5960 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5961 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5962 | } |
| 5963 | |
| 5964 | if (transformFeedback->isPaused()) |
| 5965 | { |
| 5966 | transformFeedback->resume(); |
| 5967 | } |
| 5968 | else |
| 5969 | { |
| 5970 | transformFeedback->start(primitiveMode); |
| 5971 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5972 | } |
| 5973 | } |
| 5974 | |
| 5975 | void __stdcall glEndTransformFeedback(void) |
| 5976 | { |
| 5977 | EVENT("(void)"); |
| 5978 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5979 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5980 | if (context) |
| 5981 | { |
| 5982 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5983 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5984 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5985 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 5986 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5987 | |
| 5988 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 5989 | ASSERT(transformFeedback != NULL); |
| 5990 | |
| 5991 | if (!transformFeedback->isStarted()) |
| 5992 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 5993 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 5994 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 5995 | } |
| 5996 | |
| 5997 | transformFeedback->stop(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 5998 | } |
| 5999 | } |
| 6000 | |
| 6001 | void __stdcall glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) |
| 6002 | { |
| 6003 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u, GLintptr offset = %d, GLsizeiptr size = %d)", |
| 6004 | target, index, buffer, offset, size); |
| 6005 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6006 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6007 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6008 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6009 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6010 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6011 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6012 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6013 | } |
| 6014 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6015 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6016 | switch (target) |
| 6017 | { |
| 6018 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6019 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6020 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6021 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6022 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6023 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6024 | break; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6025 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6026 | case GL_UNIFORM_BUFFER: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6027 | if (index >= caps.maxUniformBufferBindings) |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6028 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6029 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6030 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6031 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6032 | break; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6033 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6034 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6035 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6036 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6037 | } |
| 6038 | |
| 6039 | if (buffer != 0 && size <= 0) |
| 6040 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6041 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6042 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6043 | } |
| 6044 | |
| 6045 | switch (target) |
| 6046 | { |
| 6047 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 6048 | |
| 6049 | // size and offset must be a multiple of 4 |
| 6050 | 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] | 6051 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6052 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6053 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6054 | } |
| 6055 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6056 | context->bindIndexedTransformFeedbackBuffer(buffer, index, offset, size); |
| 6057 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 6058 | break; |
| 6059 | |
| 6060 | case GL_UNIFORM_BUFFER: |
| 6061 | |
| 6062 | // it is an error to bind an offset not a multiple of the alignment |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6063 | if (buffer != 0 && (offset % caps.uniformBufferOffsetAlignment) != 0) |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6064 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6065 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6066 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6067 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6068 | |
| 6069 | context->bindIndexedUniformBuffer(buffer, index, offset, size); |
| 6070 | context->bindGenericUniformBuffer(buffer); |
| 6071 | break; |
| 6072 | |
| 6073 | default: |
| 6074 | UNREACHABLE(); |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6075 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6076 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6077 | } |
| 6078 | |
| 6079 | void __stdcall glBindBufferBase(GLenum target, GLuint index, GLuint buffer) |
| 6080 | { |
| 6081 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u)", |
| 6082 | target, index, buffer); |
| 6083 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6084 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6085 | if (context) |
| 6086 | { |
| 6087 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6088 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6089 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6090 | return; |
shannon.woods%transgaming.com@gtempaccount.com | d4e6197 | 2013-04-13 03:37:04 +0000 | [diff] [blame] | 6091 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6092 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6093 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6094 | switch (target) |
| 6095 | { |
| 6096 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6097 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6098 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6099 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6100 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6101 | } |
| 6102 | break; |
| 6103 | |
| 6104 | case GL_UNIFORM_BUFFER: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 6105 | if (index >= caps.maxUniformBufferBindings) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6106 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6107 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6108 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6109 | } |
| 6110 | break; |
| 6111 | |
| 6112 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6113 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6114 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6115 | } |
| 6116 | |
| 6117 | switch (target) |
| 6118 | { |
| 6119 | case GL_TRANSFORM_FEEDBACK_BUFFER: |
| 6120 | context->bindIndexedTransformFeedbackBuffer(buffer, index, 0, 0); |
| 6121 | context->bindGenericTransformFeedbackBuffer(buffer); |
| 6122 | break; |
| 6123 | |
| 6124 | case GL_UNIFORM_BUFFER: |
| 6125 | context->bindIndexedUniformBuffer(buffer, index, 0, 0); |
| 6126 | context->bindGenericUniformBuffer(buffer); |
| 6127 | break; |
| 6128 | |
| 6129 | default: |
| 6130 | UNREACHABLE(); |
| 6131 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6132 | } |
| 6133 | } |
| 6134 | |
| 6135 | void __stdcall glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode) |
| 6136 | { |
| 6137 | EVENT("(GLuint program = %u, GLsizei count = %d, const GLchar* const* varyings = 0x%0.8p, GLenum bufferMode = 0x%X)", |
| 6138 | program, count, varyings, bufferMode); |
| 6139 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6140 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6141 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6142 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6143 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6144 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6145 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6146 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6147 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6148 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6149 | if (count < 0) |
| 6150 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6151 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6152 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6153 | } |
| 6154 | |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6155 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6156 | switch (bufferMode) |
| 6157 | { |
| 6158 | case GL_INTERLEAVED_ATTRIBS: |
| 6159 | break; |
| 6160 | case GL_SEPARATE_ATTRIBS: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 6161 | if (static_cast<GLuint>(count) > caps.maxTransformFeedbackSeparateAttributes) |
Geoff Lang | 48dcae7 | 2014-02-05 16:28:24 -0500 | [diff] [blame] | 6162 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6163 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6164 | return; |
Geoff Lang | 48dcae7 | 2014-02-05 16:28:24 -0500 | [diff] [blame] | 6165 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6166 | break; |
| 6167 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6168 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6169 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6170 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6171 | |
| 6172 | if (!gl::ValidProgram(context, program)) |
| 6173 | { |
| 6174 | return; |
| 6175 | } |
| 6176 | |
| 6177 | gl::Program *programObject = context->getProgram(program); |
| 6178 | ASSERT(programObject); |
| 6179 | |
| 6180 | programObject->setTransformFeedbackVaryings(count, varyings, bufferMode); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6181 | } |
| 6182 | } |
| 6183 | |
| 6184 | void __stdcall glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name) |
| 6185 | { |
| 6186 | EVENT("(GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, " |
| 6187 | "GLsizei* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)", |
| 6188 | program, index, bufSize, length, size, type, name); |
| 6189 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6190 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6191 | if (context) |
| 6192 | { |
| 6193 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6194 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6195 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6196 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6197 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6198 | |
| 6199 | if (bufSize < 0) |
| 6200 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6201 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6202 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6203 | } |
| 6204 | |
| 6205 | if (!gl::ValidProgram(context, program)) |
| 6206 | { |
| 6207 | return; |
| 6208 | } |
| 6209 | |
| 6210 | gl::Program *programObject = context->getProgram(program); |
| 6211 | ASSERT(programObject); |
| 6212 | |
| 6213 | if (index >= static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount())) |
| 6214 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6215 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6216 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6217 | } |
| 6218 | |
| 6219 | programObject->getTransformFeedbackVarying(index, bufSize, length, size, type, name); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6220 | } |
| 6221 | } |
| 6222 | |
| 6223 | void __stdcall glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) |
| 6224 | { |
| 6225 | EVENT("(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid* pointer = 0x%0.8p)", |
| 6226 | index, size, type, stride, pointer); |
| 6227 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6228 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6229 | if (context) |
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 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6232 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6233 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6234 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6235 | } |
| 6236 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6237 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6238 | { |
| 6239 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6240 | return; |
| 6241 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6242 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6243 | if (size < 1 || size > 4) |
| 6244 | { |
| 6245 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6246 | return; |
| 6247 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6248 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6249 | switch (type) |
| 6250 | { |
| 6251 | case GL_BYTE: |
| 6252 | case GL_UNSIGNED_BYTE: |
| 6253 | case GL_SHORT: |
| 6254 | case GL_UNSIGNED_SHORT: |
| 6255 | case GL_INT: |
| 6256 | case GL_UNSIGNED_INT: |
| 6257 | case GL_INT_2_10_10_10_REV: |
| 6258 | case GL_UNSIGNED_INT_2_10_10_10_REV: |
| 6259 | break; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6260 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6261 | default: |
| 6262 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6263 | return; |
| 6264 | } |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6265 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6266 | if (stride < 0) |
| 6267 | { |
| 6268 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6269 | return; |
| 6270 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6271 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6272 | if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4) |
| 6273 | { |
| 6274 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6275 | return; |
| 6276 | } |
| 6277 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6278 | // [OpenGL ES 3.0.2] Section 2.8 page 24: |
| 6279 | // An INVALID_OPERATION error is generated when a non-zero vertex array object |
| 6280 | // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point, |
| 6281 | // and the pointer argument is not NULL. |
| 6282 | 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] | 6283 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6284 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6285 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 1ab57be | 2013-04-13 03:38:39 +0000 | [diff] [blame] | 6286 | } |
| 6287 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6288 | context->getState().setVertexAttribState(index, context->getState().getTargetBuffer(GL_ARRAY_BUFFER), size, type, false, true, |
| 6289 | stride, pointer); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6290 | } |
| 6291 | } |
| 6292 | |
| 6293 | void __stdcall glGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) |
| 6294 | { |
| 6295 | EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 6296 | index, pname, params); |
| 6297 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6298 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6299 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6300 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6301 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6302 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6303 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6304 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6305 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6306 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6307 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6308 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6309 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6310 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6311 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6312 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6313 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6314 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6315 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6316 | { |
| 6317 | return; |
| 6318 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6319 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6320 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 6321 | { |
| 6322 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 6323 | for (int i = 0; i < 4; ++i) |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6324 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6325 | params[i] = currentValueData.IntValues[i]; |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6326 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6327 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6328 | else |
| 6329 | { |
| 6330 | *params = gl::QuerySingleVertexAttributeParameter<GLint>(attribState, pname); |
| 6331 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6332 | } |
| 6333 | } |
| 6334 | |
| 6335 | void __stdcall glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) |
| 6336 | { |
| 6337 | EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLuint* params = 0x%0.8p)", |
| 6338 | index, pname, params); |
| 6339 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6340 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6341 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6342 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6343 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6344 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6345 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6346 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6347 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6348 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6349 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6350 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6351 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6352 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6353 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6354 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6355 | const gl::VertexAttribute &attribState = context->getState().getVertexAttribState(index); |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6356 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6357 | if (!gl::ValidateGetVertexAttribParameters(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6358 | { |
| 6359 | return; |
| 6360 | } |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6361 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6362 | if (pname == GL_CURRENT_VERTEX_ATTRIB) |
| 6363 | { |
| 6364 | const gl::VertexAttribCurrentValueData ¤tValueData = context->getState().getVertexAttribCurrentValue(index); |
| 6365 | for (int i = 0; i < 4; ++i) |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6366 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6367 | params[i] = currentValueData.UnsignedIntValues[i]; |
Jamie Madill | a7d0586 | 2013-07-02 11:57:06 -0400 | [diff] [blame] | 6368 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6369 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6370 | else |
| 6371 | { |
| 6372 | *params = gl::QuerySingleVertexAttributeParameter<GLuint>(attribState, pname); |
| 6373 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6374 | } |
| 6375 | } |
| 6376 | |
| 6377 | void __stdcall glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) |
| 6378 | { |
| 6379 | EVENT("(GLuint index = %u, GLint x = %d, GLint y = %d, GLint z = %d, GLint w = %d)", |
| 6380 | index, x, y, z, w); |
| 6381 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6382 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6383 | if (context) |
| 6384 | { |
| 6385 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6386 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6387 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6388 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6389 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6390 | |
| 6391 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6392 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6393 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6394 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6395 | } |
| 6396 | |
| 6397 | GLint vals[4] = { x, y, z, w }; |
| 6398 | context->getState().setVertexAttribi(index, vals); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6399 | } |
| 6400 | } |
| 6401 | |
| 6402 | void __stdcall glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) |
| 6403 | { |
| 6404 | EVENT("(GLuint index = %u, GLuint x = %u, GLuint y = %u, GLuint z = %u, GLuint w = %u)", |
| 6405 | index, x, y, z, w); |
| 6406 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6407 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6408 | if (context) |
| 6409 | { |
| 6410 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6411 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6412 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6413 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6414 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6415 | |
| 6416 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6417 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6418 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6419 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6420 | } |
| 6421 | |
| 6422 | GLuint vals[4] = { x, y, z, w }; |
| 6423 | context->getState().setVertexAttribu(index, vals); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6424 | } |
| 6425 | } |
| 6426 | |
| 6427 | void __stdcall glVertexAttribI4iv(GLuint index, const GLint* v) |
| 6428 | { |
| 6429 | EVENT("(GLuint index = %u, const GLint* v = 0x%0.8p)", index, v); |
| 6430 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6431 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6432 | if (context) |
| 6433 | { |
| 6434 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6435 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6436 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6437 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6438 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6439 | |
| 6440 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6441 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6442 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6443 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6444 | } |
| 6445 | |
| 6446 | context->getState().setVertexAttribi(index, v); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6447 | } |
| 6448 | } |
| 6449 | |
| 6450 | void __stdcall glVertexAttribI4uiv(GLuint index, const GLuint* v) |
| 6451 | { |
| 6452 | EVENT("(GLuint index = %u, const GLuint* v = 0x%0.8p)", index, v); |
| 6453 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6454 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6455 | if (context) |
| 6456 | { |
| 6457 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6458 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6459 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6460 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a888586 | 2013-04-13 03:37:53 +0000 | [diff] [blame] | 6461 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6462 | |
| 6463 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 6464 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6465 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6466 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6467 | } |
| 6468 | |
| 6469 | context->getState().setVertexAttribu(index, v); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6470 | } |
| 6471 | } |
| 6472 | |
| 6473 | void __stdcall glGetUniformuiv(GLuint program, GLint location, GLuint* params) |
| 6474 | { |
| 6475 | EVENT("(GLuint program = %u, GLint location = %d, GLuint* params = 0x%0.8p)", |
| 6476 | program, location, params); |
| 6477 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6478 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6479 | if (context) |
| 6480 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 6481 | if (!ValidateGetUniformuiv(context, program, location, params)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6482 | { |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 6483 | return; |
shannon.woods%transgaming.com@gtempaccount.com | e229012 | 2013-04-13 03:41:07 +0000 | [diff] [blame] | 6484 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6485 | |
Jamie Madill | a502c74 | 2014-08-28 17:19:13 -0400 | [diff] [blame] | 6486 | gl::Program *programObject = context->getProgram(program); |
| 6487 | ASSERT(programObject); |
| 6488 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
Jamie Madill | 0063c51 | 2014-08-25 15:47:53 -0400 | [diff] [blame] | 6489 | ASSERT(programBinary); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6490 | |
Jamie Madill | 99a1e98 | 2014-08-25 15:47:54 -0400 | [diff] [blame] | 6491 | programBinary->getUniformuiv(location, params); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6492 | } |
| 6493 | } |
| 6494 | |
| 6495 | GLint __stdcall glGetFragDataLocation(GLuint program, const GLchar *name) |
| 6496 | { |
| 6497 | EVENT("(GLuint program = %u, const GLchar *name = 0x%0.8p)", |
| 6498 | program, name); |
| 6499 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6500 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6501 | if (context) |
| 6502 | { |
| 6503 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6504 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6505 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6506 | return -1; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6507 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6508 | |
| 6509 | if (program == 0) |
| 6510 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6511 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6512 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6513 | } |
| 6514 | |
| 6515 | gl::Program *programObject = context->getProgram(program); |
| 6516 | |
| 6517 | if (!programObject || !programObject->isLinked()) |
| 6518 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6519 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6520 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6521 | } |
| 6522 | |
| 6523 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 6524 | if (!programBinary) |
| 6525 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6526 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6527 | return -1; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6528 | } |
| 6529 | |
| 6530 | return programBinary->getFragDataLocation(name); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6531 | } |
| 6532 | |
| 6533 | return 0; |
| 6534 | } |
| 6535 | |
| 6536 | void __stdcall glUniform1ui(GLint location, GLuint v0) |
| 6537 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6538 | glUniform1uiv(location, 1, &v0); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6539 | } |
| 6540 | |
| 6541 | void __stdcall glUniform2ui(GLint location, GLuint v0, GLuint v1) |
| 6542 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6543 | const GLuint xy[] = { v0, v1 }; |
| 6544 | glUniform2uiv(location, 1, xy); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6545 | } |
| 6546 | |
| 6547 | void __stdcall glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) |
| 6548 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6549 | const GLuint xyz[] = { v0, v1, v2 }; |
| 6550 | glUniform3uiv(location, 1, xyz); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6551 | } |
| 6552 | |
| 6553 | void __stdcall glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) |
| 6554 | { |
shannon.woods%transgaming.com@gtempaccount.com | 8431b9c | 2013-04-13 03:40:17 +0000 | [diff] [blame] | 6555 | const GLuint xyzw[] = { v0, v1, v2, v3 }; |
| 6556 | glUniform4uiv(location, 1, xyzw); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6557 | } |
| 6558 | |
| 6559 | void __stdcall glUniform1uiv(GLint location, GLsizei count, const GLuint* value) |
| 6560 | { |
| 6561 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6562 | location, count, value); |
| 6563 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6564 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6565 | if (context) |
| 6566 | { |
| 6567 | if (!ValidateUniform(context, GL_UNSIGNED_INT, location, count)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6568 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6569 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6570 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6571 | |
| 6572 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6573 | programBinary->setUniform1uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6574 | } |
| 6575 | } |
| 6576 | |
| 6577 | void __stdcall glUniform2uiv(GLint location, GLsizei count, const GLuint* value) |
| 6578 | { |
| 6579 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6580 | location, count, value); |
| 6581 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6582 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6583 | if (context) |
| 6584 | { |
| 6585 | 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] | 6586 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6587 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6588 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6589 | |
| 6590 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6591 | programBinary->setUniform2uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6592 | } |
| 6593 | } |
| 6594 | |
| 6595 | void __stdcall glUniform3uiv(GLint location, GLsizei count, const GLuint* value) |
| 6596 | { |
| 6597 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value)", |
| 6598 | location, count, value); |
| 6599 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6600 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6601 | if (context) |
| 6602 | { |
| 6603 | 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] | 6604 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6605 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6606 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6607 | |
| 6608 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6609 | programBinary->setUniform3uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6610 | } |
| 6611 | } |
| 6612 | |
| 6613 | void __stdcall glUniform4uiv(GLint location, GLsizei count, const GLuint* value) |
| 6614 | { |
| 6615 | EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", |
| 6616 | location, count, value); |
| 6617 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6618 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6619 | if (context) |
| 6620 | { |
| 6621 | 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] | 6622 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6623 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 50ea4ab | 2013-04-13 03:40:36 +0000 | [diff] [blame] | 6624 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6625 | |
| 6626 | gl::ProgramBinary *programBinary = context->getState().getCurrentProgramBinary(); |
| 6627 | programBinary->setUniform4uiv(location, count, value); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6628 | } |
| 6629 | } |
| 6630 | |
| 6631 | void __stdcall glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value) |
| 6632 | { |
| 6633 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint* value = 0x%0.8p)", |
| 6634 | buffer, drawbuffer, value); |
| 6635 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6636 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6637 | if (context) |
| 6638 | { |
| 6639 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6640 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6641 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6642 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6643 | |
| 6644 | switch (buffer) |
| 6645 | { |
| 6646 | case GL_COLOR: |
| 6647 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6648 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6649 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6650 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6651 | } |
| 6652 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6653 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6654 | case GL_STENCIL: |
| 6655 | if (drawbuffer != 0) |
| 6656 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6657 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6658 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6659 | } |
| 6660 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6661 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6662 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6663 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6664 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6665 | } |
| 6666 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6667 | gl::Error error = context->clearBufferiv(buffer, drawbuffer, value); |
| 6668 | if (error.isError()) |
| 6669 | { |
| 6670 | context->recordError(error); |
| 6671 | return; |
| 6672 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6673 | } |
| 6674 | } |
| 6675 | |
| 6676 | void __stdcall glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value) |
| 6677 | { |
| 6678 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint* value = 0x%0.8p)", |
| 6679 | buffer, drawbuffer, value); |
| 6680 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6681 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6682 | if (context) |
| 6683 | { |
| 6684 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6685 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6686 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6687 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6688 | |
| 6689 | switch (buffer) |
| 6690 | { |
| 6691 | case GL_COLOR: |
| 6692 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6693 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6694 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6695 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6696 | } |
| 6697 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6698 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6699 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6700 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6701 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6702 | } |
| 6703 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6704 | gl::Error error = context->clearBufferuiv(buffer, drawbuffer, value); |
| 6705 | if (error.isError()) |
| 6706 | { |
| 6707 | context->recordError(error); |
| 6708 | return; |
| 6709 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6710 | } |
| 6711 | } |
| 6712 | |
| 6713 | void __stdcall glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value) |
| 6714 | { |
| 6715 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat* value = 0x%0.8p)", |
| 6716 | buffer, drawbuffer, value); |
| 6717 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6718 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6719 | if (context) |
| 6720 | { |
| 6721 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6722 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6723 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6724 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6725 | |
| 6726 | switch (buffer) |
| 6727 | { |
| 6728 | case GL_COLOR: |
| 6729 | if (drawbuffer < 0 || static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers) |
| 6730 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6731 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6732 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6733 | } |
| 6734 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6735 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6736 | case GL_DEPTH: |
| 6737 | if (drawbuffer != 0) |
| 6738 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6739 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6740 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6741 | } |
| 6742 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6743 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6744 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6745 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6746 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6747 | } |
| 6748 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6749 | gl::Error error = context->clearBufferfv(buffer, drawbuffer, value); |
| 6750 | if (error.isError()) |
| 6751 | { |
| 6752 | context->recordError(error); |
| 6753 | return; |
| 6754 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6755 | } |
| 6756 | } |
| 6757 | |
| 6758 | void __stdcall glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) |
| 6759 | { |
| 6760 | EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth, GLint stencil = %d)", |
| 6761 | buffer, drawbuffer, depth, stencil); |
| 6762 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6763 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6764 | if (context) |
| 6765 | { |
| 6766 | if (!ValidateClearBuffer(context)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6767 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6768 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 6769 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6770 | |
| 6771 | switch (buffer) |
| 6772 | { |
| 6773 | case GL_DEPTH_STENCIL: |
| 6774 | if (drawbuffer != 0) |
| 6775 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6776 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6777 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6778 | } |
| 6779 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6780 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6781 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6782 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6783 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6784 | } |
| 6785 | |
Geoff Lang | cc79b8c | 2014-07-25 13:48:02 -0400 | [diff] [blame] | 6786 | gl::Error error = context->clearBufferfi(buffer, drawbuffer, depth, stencil); |
| 6787 | if (error.isError()) |
| 6788 | { |
| 6789 | context->recordError(error); |
| 6790 | return; |
| 6791 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6792 | } |
| 6793 | } |
| 6794 | |
| 6795 | const GLubyte* __stdcall glGetStringi(GLenum name, GLuint index) |
| 6796 | { |
| 6797 | EVENT("(GLenum name = 0x%X, GLuint index = %u)", name, index); |
| 6798 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6799 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6800 | if (context) |
| 6801 | { |
| 6802 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6803 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6804 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6805 | return NULL; |
shannonwoods@chromium.org | 302df74 | 2013-05-30 00:05:54 +0000 | [diff] [blame] | 6806 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6807 | |
| 6808 | if (name != GL_EXTENSIONS) |
| 6809 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6810 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6811 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6812 | } |
| 6813 | |
| 6814 | if (index >= context->getExtensionStringCount()) |
| 6815 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6816 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6817 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6818 | } |
| 6819 | |
| 6820 | 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] | 6821 | } |
| 6822 | |
| 6823 | return NULL; |
| 6824 | } |
| 6825 | |
| 6826 | void __stdcall glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) |
| 6827 | { |
| 6828 | EVENT("(GLenum readTarget = 0x%X, GLenum writeTarget = 0x%X, GLintptr readOffset = %d, GLintptr writeOffset = %d, GLsizeiptr size = %d)", |
| 6829 | readTarget, writeTarget, readOffset, writeOffset, size); |
| 6830 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6831 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6832 | if (context) |
| 6833 | { |
| 6834 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6835 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6836 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6837 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 296c3f2 | 2013-04-13 03:39:39 +0000 | [diff] [blame] | 6838 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6839 | |
| 6840 | if (!gl::ValidBufferTarget(context, readTarget) || !gl::ValidBufferTarget(context, readTarget)) |
| 6841 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6842 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6843 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6844 | } |
| 6845 | |
| 6846 | gl::Buffer *readBuffer = context->getState().getTargetBuffer(readTarget); |
| 6847 | gl::Buffer *writeBuffer = context->getState().getTargetBuffer(writeTarget); |
| 6848 | |
| 6849 | if (!readBuffer || !writeBuffer) |
| 6850 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6851 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6852 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6853 | } |
| 6854 | |
Jamie Madill | cfaaf72 | 2014-07-31 10:47:54 -0400 | [diff] [blame] | 6855 | // Verify that readBuffer and writeBuffer are not currently mapped |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6856 | if (readBuffer->isMapped() || writeBuffer->isMapped()) |
| 6857 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6858 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6859 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6860 | } |
| 6861 | |
| 6862 | if (readOffset < 0 || writeOffset < 0 || size < 0 || |
| 6863 | static_cast<unsigned int>(readOffset + size) > readBuffer->getSize() || |
| 6864 | static_cast<unsigned int>(writeOffset + size) > writeBuffer->getSize()) |
| 6865 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6866 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6867 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6868 | } |
| 6869 | |
| 6870 | if (readBuffer == writeBuffer && abs(readOffset - writeOffset) < size) |
| 6871 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6872 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6873 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6874 | } |
| 6875 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6876 | // if size is zero, the copy is a successful no-op |
| 6877 | if (size > 0) |
| 6878 | { |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 6879 | gl::Error error = writeBuffer->copyBufferSubData(readBuffer, readOffset, writeOffset, size); |
| 6880 | if (error.isError()) |
| 6881 | { |
| 6882 | context->recordError(error); |
| 6883 | return; |
| 6884 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6885 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6886 | } |
| 6887 | } |
| 6888 | |
| 6889 | void __stdcall glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices) |
| 6890 | { |
| 6891 | EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLchar* const* uniformNames = 0x%0.8p, GLuint* uniformIndices = 0x%0.8p)", |
| 6892 | program, uniformCount, uniformNames, uniformIndices); |
| 6893 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6894 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6895 | if (context) |
| 6896 | { |
| 6897 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6898 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6899 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6900 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6901 | } |
| 6902 | |
| 6903 | if (uniformCount < 0) |
| 6904 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6905 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6906 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 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 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6915 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6916 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6917 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6918 | else |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 6919 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6920 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6921 | return; |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 6922 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6923 | } |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 6924 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6925 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 6926 | if (!programObject->isLinked() || !programBinary) |
| 6927 | { |
| 6928 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 6929 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6930 | uniformIndices[uniformId] = GL_INVALID_INDEX; |
shannonwoods@chromium.org | c2ed991 | 2013-05-30 00:05:33 +0000 | [diff] [blame] | 6931 | } |
| 6932 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6933 | else |
| 6934 | { |
| 6935 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 6936 | { |
| 6937 | uniformIndices[uniformId] = programBinary->getUniformIndex(uniformNames[uniformId]); |
| 6938 | } |
| 6939 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6940 | } |
| 6941 | } |
| 6942 | |
| 6943 | void __stdcall glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) |
| 6944 | { |
| 6945 | EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLuint* uniformIndices = 0x%0.8p, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 6946 | program, uniformCount, uniformIndices, pname, params); |
| 6947 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6948 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6949 | if (context) |
| 6950 | { |
| 6951 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6952 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6953 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6954 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6955 | } |
| 6956 | |
| 6957 | if (uniformCount < 0) |
| 6958 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6959 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6960 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6961 | } |
| 6962 | |
| 6963 | gl::Program *programObject = context->getProgram(program); |
| 6964 | |
| 6965 | if (!programObject) |
| 6966 | { |
| 6967 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6968 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6969 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 6970 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 6971 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6972 | else |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 6973 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6974 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 6975 | return; |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 6976 | } |
shannonwoods@chromium.org | 2a9a9d2 | 2013-05-30 00:05:40 +0000 | [diff] [blame] | 6977 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6978 | |
| 6979 | switch (pname) |
| 6980 | { |
| 6981 | case GL_UNIFORM_TYPE: |
| 6982 | case GL_UNIFORM_SIZE: |
| 6983 | case GL_UNIFORM_NAME_LENGTH: |
| 6984 | case GL_UNIFORM_BLOCK_INDEX: |
| 6985 | case GL_UNIFORM_OFFSET: |
| 6986 | case GL_UNIFORM_ARRAY_STRIDE: |
| 6987 | case GL_UNIFORM_MATRIX_STRIDE: |
| 6988 | case GL_UNIFORM_IS_ROW_MAJOR: |
| 6989 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6990 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6991 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 6992 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 6993 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 6994 | } |
| 6995 | |
| 6996 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 6997 | |
| 6998 | if (!programBinary && uniformCount > 0) |
| 6999 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7000 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7001 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7002 | } |
| 7003 | |
| 7004 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 7005 | { |
| 7006 | const GLuint index = uniformIndices[uniformId]; |
| 7007 | |
| 7008 | if (index >= (GLuint)programBinary->getActiveUniformCount()) |
| 7009 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7010 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7011 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7012 | } |
| 7013 | } |
| 7014 | |
| 7015 | for (int uniformId = 0; uniformId < uniformCount; uniformId++) |
| 7016 | { |
| 7017 | const GLuint index = uniformIndices[uniformId]; |
| 7018 | params[uniformId] = programBinary->getActiveUniformi(index, pname); |
| 7019 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7020 | } |
| 7021 | } |
| 7022 | |
| 7023 | GLuint __stdcall glGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) |
| 7024 | { |
| 7025 | EVENT("(GLuint program = %u, const GLchar* uniformBlockName = 0x%0.8p)", program, uniformBlockName); |
| 7026 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7027 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7028 | if (context) |
| 7029 | { |
| 7030 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7031 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7032 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7033 | return GL_INVALID_INDEX; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7034 | } |
| 7035 | |
| 7036 | gl::Program *programObject = context->getProgram(program); |
| 7037 | |
| 7038 | if (!programObject) |
| 7039 | { |
| 7040 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7041 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7042 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7043 | return GL_INVALID_INDEX; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7044 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7045 | else |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 7046 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7047 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7048 | return GL_INVALID_INDEX; |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 7049 | } |
shannonwoods@chromium.org | 4276625 | 2013-05-30 00:07:12 +0000 | [diff] [blame] | 7050 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7051 | |
| 7052 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7053 | if (!programBinary) |
| 7054 | { |
| 7055 | return GL_INVALID_INDEX; |
| 7056 | } |
| 7057 | |
| 7058 | return programBinary->getUniformBlockIndex(uniformBlockName); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7059 | } |
| 7060 | |
| 7061 | return 0; |
| 7062 | } |
| 7063 | |
| 7064 | void __stdcall glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) |
| 7065 | { |
| 7066 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", |
| 7067 | program, uniformBlockIndex, pname, params); |
| 7068 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7069 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7070 | if (context) |
| 7071 | { |
| 7072 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7073 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7074 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7075 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7076 | } |
| 7077 | gl::Program *programObject = context->getProgram(program); |
| 7078 | |
| 7079 | if (!programObject) |
| 7080 | { |
| 7081 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7082 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7083 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7084 | return; |
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 | else |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 7087 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7088 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7089 | return; |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 7090 | } |
shannonwoods@chromium.org | e7317ca | 2013-05-30 00:07:35 +0000 | [diff] [blame] | 7091 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7092 | |
| 7093 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7094 | |
| 7095 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 7096 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7097 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7098 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7099 | } |
| 7100 | |
| 7101 | switch (pname) |
| 7102 | { |
| 7103 | case GL_UNIFORM_BLOCK_BINDING: |
| 7104 | *params = static_cast<GLint>(programObject->getUniformBlockBinding(uniformBlockIndex)); |
| 7105 | break; |
| 7106 | |
| 7107 | case GL_UNIFORM_BLOCK_DATA_SIZE: |
| 7108 | case GL_UNIFORM_BLOCK_NAME_LENGTH: |
| 7109 | case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS: |
| 7110 | case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: |
| 7111 | case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: |
| 7112 | case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: |
| 7113 | programBinary->getActiveUniformBlockiv(uniformBlockIndex, pname, params); |
| 7114 | break; |
| 7115 | |
| 7116 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7117 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7118 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7119 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7120 | } |
| 7121 | } |
| 7122 | |
| 7123 | void __stdcall glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName) |
| 7124 | { |
| 7125 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLchar* uniformBlockName = 0x%0.8p)", |
| 7126 | program, uniformBlockIndex, bufSize, length, uniformBlockName); |
| 7127 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7128 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7129 | if (context) |
| 7130 | { |
| 7131 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7132 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7133 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7134 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7135 | } |
| 7136 | |
| 7137 | gl::Program *programObject = context->getProgram(program); |
| 7138 | |
| 7139 | if (!programObject) |
| 7140 | { |
| 7141 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7142 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7143 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7144 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7145 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7146 | else |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 7147 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7148 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7149 | return; |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 7150 | } |
shannonwoods@chromium.org | beb0278 | 2013-05-30 00:07:28 +0000 | [diff] [blame] | 7151 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7152 | |
| 7153 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7154 | |
| 7155 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 7156 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7157 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7158 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7159 | } |
| 7160 | |
| 7161 | programBinary->getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7162 | } |
| 7163 | } |
| 7164 | |
| 7165 | void __stdcall glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) |
| 7166 | { |
| 7167 | EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLuint uniformBlockBinding = %u)", |
| 7168 | program, uniformBlockIndex, uniformBlockBinding); |
| 7169 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7170 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7171 | if (context) |
| 7172 | { |
| 7173 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7174 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7175 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7176 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7177 | } |
| 7178 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7179 | if (uniformBlockBinding >= context->getCaps().maxUniformBufferBindings) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7180 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7181 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7182 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7183 | } |
| 7184 | |
| 7185 | gl::Program *programObject = context->getProgram(program); |
| 7186 | |
| 7187 | if (!programObject) |
| 7188 | { |
| 7189 | if (context->getShader(program)) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7190 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7191 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7192 | return; |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7193 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7194 | else |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 7195 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7196 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7197 | return; |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 7198 | } |
shannonwoods@chromium.org | 70eb1ea | 2013-05-30 00:07:20 +0000 | [diff] [blame] | 7199 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7200 | |
| 7201 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 7202 | |
| 7203 | // if never linked, there won't be any uniform blocks |
| 7204 | if (!programBinary || uniformBlockIndex >= programBinary->getActiveUniformBlockCount()) |
| 7205 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7206 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7207 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7208 | } |
| 7209 | |
| 7210 | programObject->bindUniformBlock(uniformBlockIndex, uniformBlockBinding); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7211 | } |
| 7212 | } |
| 7213 | |
| 7214 | void __stdcall glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount) |
| 7215 | { |
| 7216 | EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei instanceCount = %d)", |
| 7217 | mode, first, count, instanceCount); |
| 7218 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7219 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7220 | if (context) |
| 7221 | { |
| 7222 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7223 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7224 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7225 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7226 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7227 | |
| 7228 | // glDrawArraysInstanced |
| 7229 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7230 | } |
| 7231 | } |
| 7232 | |
| 7233 | void __stdcall glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount) |
| 7234 | { |
| 7235 | EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei instanceCount = %d)", |
| 7236 | mode, count, type, indices, instanceCount); |
| 7237 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7238 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7239 | if (context) |
| 7240 | { |
| 7241 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7242 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7243 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7244 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7245 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7246 | |
| 7247 | // glDrawElementsInstanced |
| 7248 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7249 | } |
| 7250 | } |
| 7251 | |
| 7252 | GLsync __stdcall glFenceSync(GLenum condition, GLbitfield flags) |
| 7253 | { |
| 7254 | EVENT("(GLenum condition = 0x%X, GLbitfield flags = 0x%X)", condition, flags); |
| 7255 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7256 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7257 | if (context) |
| 7258 | { |
| 7259 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7260 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7261 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7262 | return 0; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7263 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7264 | |
| 7265 | if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) |
| 7266 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7267 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7268 | return 0; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7269 | } |
| 7270 | |
| 7271 | if (flags != 0) |
| 7272 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7273 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7274 | return 0; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7275 | } |
| 7276 | |
| 7277 | return context->createFenceSync(condition); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7278 | } |
| 7279 | |
| 7280 | return NULL; |
| 7281 | } |
| 7282 | |
| 7283 | GLboolean __stdcall glIsSync(GLsync sync) |
| 7284 | { |
| 7285 | EVENT("(GLsync sync = 0x%0.8p)", sync); |
| 7286 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7287 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7288 | if (context) |
| 7289 | { |
| 7290 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7291 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7292 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7293 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7294 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7295 | |
| 7296 | return (context->getFenceSync(sync) != NULL); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7297 | } |
| 7298 | |
| 7299 | return GL_FALSE; |
| 7300 | } |
| 7301 | |
| 7302 | void __stdcall glDeleteSync(GLsync sync) |
| 7303 | { |
| 7304 | EVENT("(GLsync sync = 0x%0.8p)", sync); |
| 7305 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7306 | gl::Context *context = gl::getNonLostContext(); |
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 | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7311 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7312 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7313 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7314 | |
| 7315 | if (sync != static_cast<GLsync>(0) && !context->getFenceSync(sync)) |
| 7316 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7317 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7318 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7319 | } |
| 7320 | |
| 7321 | context->deleteFenceSync(sync); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7322 | } |
| 7323 | } |
| 7324 | |
| 7325 | GLenum __stdcall glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) |
| 7326 | { |
| 7327 | EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", |
| 7328 | sync, flags, timeout); |
| 7329 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7330 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7331 | if (context) |
| 7332 | { |
| 7333 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7334 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7335 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7336 | return GL_WAIT_FAILED; |
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 ((flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0) |
| 7340 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7341 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7342 | return GL_WAIT_FAILED; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7343 | } |
| 7344 | |
| 7345 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7346 | |
| 7347 | if (!fenceSync) |
| 7348 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7349 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7350 | return GL_WAIT_FAILED; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7351 | } |
| 7352 | |
| 7353 | return fenceSync->clientWait(flags, timeout); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7354 | } |
| 7355 | |
| 7356 | return GL_FALSE; |
| 7357 | } |
| 7358 | |
| 7359 | void __stdcall glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) |
| 7360 | { |
| 7361 | EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", |
| 7362 | sync, flags, timeout); |
| 7363 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7364 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7365 | if (context) |
| 7366 | { |
| 7367 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7368 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7369 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7370 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7371 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7372 | |
| 7373 | if (flags != 0) |
| 7374 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7375 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7376 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7377 | } |
| 7378 | |
| 7379 | if (timeout != GL_TIMEOUT_IGNORED) |
| 7380 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7381 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7382 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7383 | } |
| 7384 | |
| 7385 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7386 | |
| 7387 | if (!fenceSync) |
| 7388 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7389 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7390 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7391 | } |
| 7392 | |
| 7393 | fenceSync->serverWait(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7394 | } |
| 7395 | } |
| 7396 | |
| 7397 | void __stdcall glGetInteger64v(GLenum pname, GLint64* params) |
| 7398 | { |
| 7399 | EVENT("(GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", |
| 7400 | pname, params); |
| 7401 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7402 | gl::Context *context = gl::getNonLostContext(); |
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 | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7407 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7408 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7409 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7410 | |
| 7411 | GLenum nativeType; |
| 7412 | unsigned int numParams = 0; |
| 7413 | if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) |
| 7414 | { |
| 7415 | return; |
| 7416 | } |
| 7417 | |
| 7418 | if (nativeType == GL_INT_64_ANGLEX) |
| 7419 | { |
| 7420 | context->getInteger64v(pname, params); |
| 7421 | } |
| 7422 | else |
| 7423 | { |
| 7424 | CastStateValues(context, nativeType, pname, numParams, params); |
| 7425 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7426 | } |
| 7427 | } |
| 7428 | |
| 7429 | void __stdcall glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) |
| 7430 | { |
| 7431 | EVENT("(GLsync sync = 0x%0.8p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLint* values = 0x%0.8p)", |
| 7432 | sync, pname, bufSize, length, values); |
| 7433 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7434 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7435 | if (context) |
| 7436 | { |
| 7437 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7438 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7439 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7440 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7441 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7442 | |
| 7443 | if (bufSize < 0) |
| 7444 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7445 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7446 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7447 | } |
| 7448 | |
| 7449 | gl::FenceSync *fenceSync = context->getFenceSync(sync); |
| 7450 | |
| 7451 | if (!fenceSync) |
| 7452 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7453 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7454 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7455 | } |
| 7456 | |
| 7457 | switch (pname) |
| 7458 | { |
| 7459 | case GL_OBJECT_TYPE: values[0] = static_cast<GLint>(GL_SYNC_FENCE); break; |
| 7460 | case GL_SYNC_STATUS: values[0] = static_cast<GLint>(fenceSync->getStatus()); break; |
| 7461 | case GL_SYNC_CONDITION: values[0] = static_cast<GLint>(fenceSync->getCondition()); break; |
| 7462 | case GL_SYNC_FLAGS: values[0] = 0; break; |
| 7463 | |
| 7464 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7465 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7466 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7467 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7468 | } |
| 7469 | } |
| 7470 | |
| 7471 | void __stdcall glGetInteger64i_v(GLenum target, GLuint index, GLint64* data) |
| 7472 | { |
| 7473 | EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint64* data = 0x%0.8p)", |
| 7474 | target, index, data); |
| 7475 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7476 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7477 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7478 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7479 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7480 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7481 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7482 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7483 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7484 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7485 | const gl::Caps &caps = context->getCaps(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7486 | switch (target) |
| 7487 | { |
| 7488 | case GL_TRANSFORM_FEEDBACK_BUFFER_START: |
| 7489 | case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: |
| 7490 | case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 7491 | if (index >= caps.maxTransformFeedbackSeparateAttributes) |
| 7492 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7493 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7494 | return; |
Geoff Lang | 05881a0 | 2014-07-10 14:05:30 -0400 | [diff] [blame] | 7495 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7496 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7497 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7498 | case GL_UNIFORM_BUFFER_START: |
| 7499 | case GL_UNIFORM_BUFFER_SIZE: |
| 7500 | case GL_UNIFORM_BUFFER_BINDING: |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7501 | if (index >= caps.maxUniformBufferBindings) |
| 7502 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7503 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7504 | return; |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7505 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7506 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7507 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7508 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7509 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7510 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7511 | } |
| 7512 | |
| 7513 | if (!(context->getIndexedInteger64v(target, index, data))) |
| 7514 | { |
| 7515 | GLenum nativeType; |
| 7516 | unsigned int numParams = 0; |
| 7517 | if (!context->getIndexedQueryParameterInfo(target, &nativeType, &numParams)) |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7518 | { |
| 7519 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7520 | return; |
| 7521 | } |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7522 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7523 | if (numParams == 0) |
| 7524 | return; // it is known that pname is valid, but there are no parameters to return |
| 7525 | |
| 7526 | if (nativeType == GL_INT) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7527 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7528 | GLint *intParams = new GLint[numParams]; |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7529 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7530 | context->getIndexedIntegerv(target, index, intParams); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7531 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7532 | for (unsigned int i = 0; i < numParams; ++i) |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7533 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7534 | data[i] = static_cast<GLint64>(intParams[i]); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7535 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7536 | |
| 7537 | delete [] intParams; |
| 7538 | } |
| 7539 | else |
| 7540 | { |
| 7541 | UNREACHABLE(); |
Shannon Woods | 15934d5 | 2013-08-19 14:28:49 -0400 | [diff] [blame] | 7542 | } |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7543 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7544 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7545 | } |
| 7546 | |
| 7547 | void __stdcall glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) |
| 7548 | { |
| 7549 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", |
| 7550 | target, pname, params); |
| 7551 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7552 | gl::Context *context = gl::getNonLostContext(); |
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 | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7557 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7558 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7559 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7560 | |
| 7561 | if (!gl::ValidBufferTarget(context, target)) |
| 7562 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7563 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7564 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7565 | } |
| 7566 | |
| 7567 | if (!gl::ValidBufferParameter(context, pname)) |
| 7568 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7569 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7570 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7571 | } |
| 7572 | |
| 7573 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 7574 | |
| 7575 | if (!buffer) |
| 7576 | { |
| 7577 | // A null buffer means that "0" is bound to the requested buffer target |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7578 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7579 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7580 | } |
| 7581 | |
| 7582 | switch (pname) |
| 7583 | { |
| 7584 | case GL_BUFFER_USAGE: |
| 7585 | *params = static_cast<GLint64>(buffer->getUsage()); |
| 7586 | break; |
| 7587 | case GL_BUFFER_SIZE: |
| 7588 | *params = buffer->getSize(); |
| 7589 | break; |
| 7590 | case GL_BUFFER_ACCESS_FLAGS: |
| 7591 | *params = static_cast<GLint64>(buffer->getAccessFlags()); |
| 7592 | break; |
| 7593 | case GL_BUFFER_MAPPED: |
| 7594 | *params = static_cast<GLint64>(buffer->isMapped()); |
| 7595 | break; |
| 7596 | case GL_BUFFER_MAP_OFFSET: |
| 7597 | *params = buffer->getMapOffset(); |
| 7598 | break; |
| 7599 | case GL_BUFFER_MAP_LENGTH: |
| 7600 | *params = buffer->getMapLength(); |
| 7601 | break; |
| 7602 | default: UNREACHABLE(); break; |
| 7603 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7604 | } |
| 7605 | } |
| 7606 | |
| 7607 | void __stdcall glGenSamplers(GLsizei count, GLuint* samplers) |
| 7608 | { |
| 7609 | EVENT("(GLsizei count = %d, GLuint* samplers = 0x%0.8p)", count, samplers); |
| 7610 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7611 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7612 | if (context) |
| 7613 | { |
| 7614 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7615 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7616 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7617 | return; |
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 | if (count < 0) |
| 7621 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7622 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7623 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7624 | } |
| 7625 | |
| 7626 | for (int i = 0; i < count; i++) |
| 7627 | { |
| 7628 | samplers[i] = context->createSampler(); |
| 7629 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7630 | } |
| 7631 | } |
| 7632 | |
| 7633 | void __stdcall glDeleteSamplers(GLsizei count, const GLuint* samplers) |
| 7634 | { |
| 7635 | EVENT("(GLsizei count = %d, const GLuint* samplers = 0x%0.8p)", count, samplers); |
| 7636 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7637 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7638 | if (context) |
| 7639 | { |
| 7640 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7641 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7642 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7643 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7644 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7645 | |
| 7646 | if (count < 0) |
| 7647 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7648 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7649 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7650 | } |
| 7651 | |
| 7652 | for (int i = 0; i < count; i++) |
| 7653 | { |
| 7654 | context->deleteSampler(samplers[i]); |
| 7655 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7656 | } |
| 7657 | } |
| 7658 | |
| 7659 | GLboolean __stdcall glIsSampler(GLuint sampler) |
| 7660 | { |
| 7661 | EVENT("(GLuint sampler = %u)", sampler); |
| 7662 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7663 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7664 | if (context) |
| 7665 | { |
| 7666 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7667 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7668 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7669 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7670 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7671 | |
| 7672 | return context->isSampler(sampler); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7673 | } |
| 7674 | |
| 7675 | return GL_FALSE; |
| 7676 | } |
| 7677 | |
| 7678 | void __stdcall glBindSampler(GLuint unit, GLuint sampler) |
| 7679 | { |
| 7680 | EVENT("(GLuint unit = %u, GLuint sampler = %u)", unit, sampler); |
| 7681 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7682 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7683 | if (context) |
| 7684 | { |
| 7685 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7686 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7687 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7688 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7689 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7690 | |
| 7691 | if (sampler != 0 && !context->isSampler(sampler)) |
| 7692 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7693 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7694 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7695 | } |
| 7696 | |
Geoff Lang | 3a61c32 | 2014-07-10 13:01:54 -0400 | [diff] [blame] | 7697 | if (unit >= context->getCaps().maxCombinedTextureImageUnits) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7698 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7699 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7700 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7701 | } |
| 7702 | |
| 7703 | context->bindSampler(unit, sampler); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7704 | } |
| 7705 | } |
| 7706 | |
| 7707 | void __stdcall glSamplerParameteri(GLuint sampler, GLenum pname, GLint param) |
| 7708 | { |
| 7709 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint param = %d)", sampler, pname, param); |
| 7710 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7711 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7712 | if (context) |
| 7713 | { |
| 7714 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7715 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7716 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7717 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7718 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7719 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7720 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7721 | { |
| 7722 | return; |
| 7723 | } |
| 7724 | |
| 7725 | if (!gl::ValidateTexParamParameters(context, pname, param)) |
| 7726 | { |
| 7727 | return; |
| 7728 | } |
| 7729 | |
| 7730 | if (!context->isSampler(sampler)) |
| 7731 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7732 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7733 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7734 | } |
| 7735 | |
| 7736 | context->samplerParameteri(sampler, pname, param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7737 | } |
| 7738 | } |
| 7739 | |
| 7740 | void __stdcall glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param) |
| 7741 | { |
Jamie Madill | f6cc8cc | 2013-07-03 12:44:15 -0400 | [diff] [blame] | 7742 | glSamplerParameteri(sampler, pname, *param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7743 | } |
| 7744 | |
| 7745 | void __stdcall glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) |
| 7746 | { |
| 7747 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat param = %g)", sampler, pname, param); |
| 7748 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7749 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7750 | if (context) |
| 7751 | { |
| 7752 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7753 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7754 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7755 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7756 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7757 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7758 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7759 | { |
| 7760 | return; |
| 7761 | } |
| 7762 | |
| 7763 | if (!gl::ValidateTexParamParameters(context, pname, static_cast<GLint>(param))) |
| 7764 | { |
| 7765 | return; |
| 7766 | } |
| 7767 | |
| 7768 | if (!context->isSampler(sampler)) |
| 7769 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7770 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7771 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7772 | } |
| 7773 | |
| 7774 | context->samplerParameterf(sampler, pname, param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7775 | } |
| 7776 | } |
| 7777 | |
| 7778 | void __stdcall glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param) |
| 7779 | { |
Jamie Madill | f6cc8cc | 2013-07-03 12:44:15 -0400 | [diff] [blame] | 7780 | glSamplerParameterf(sampler, pname, *param); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7781 | } |
| 7782 | |
| 7783 | void __stdcall glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params) |
| 7784 | { |
| 7785 | EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", sampler, pname, params); |
| 7786 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7787 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7788 | if (context) |
| 7789 | { |
| 7790 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7791 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7792 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7793 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7794 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7795 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7796 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7797 | { |
| 7798 | return; |
| 7799 | } |
| 7800 | |
| 7801 | if (!context->isSampler(sampler)) |
| 7802 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7803 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7804 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7805 | } |
| 7806 | |
| 7807 | *params = context->getSamplerParameteri(sampler, pname); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7808 | } |
| 7809 | } |
| 7810 | |
| 7811 | void __stdcall glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params) |
| 7812 | { |
| 7813 | EVENT("(GLuint sample = %ur, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", sampler, pname, params); |
| 7814 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7815 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7816 | if (context) |
| 7817 | { |
| 7818 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7819 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7820 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7821 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7822 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7823 | |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7824 | if (!gl::ValidateSamplerObjectParameter(context, pname)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7825 | { |
| 7826 | return; |
| 7827 | } |
| 7828 | |
| 7829 | if (!context->isSampler(sampler)) |
| 7830 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7831 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7832 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7833 | } |
| 7834 | |
| 7835 | *params = context->getSamplerParameterf(sampler, pname); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7836 | } |
| 7837 | } |
| 7838 | |
| 7839 | void __stdcall glVertexAttribDivisor(GLuint index, GLuint divisor) |
| 7840 | { |
| 7841 | EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor); |
| 7842 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7843 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7844 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7845 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7846 | if (context->getClientVersion() < 3) |
| 7847 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7848 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7849 | return; |
| 7850 | } |
| 7851 | |
| 7852 | if (index >= gl::MAX_VERTEX_ATTRIBS) |
| 7853 | { |
| 7854 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 7855 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7856 | } |
| 7857 | |
| 7858 | context->setVertexAttribDivisor(index, divisor); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7859 | } |
| 7860 | } |
| 7861 | |
| 7862 | void __stdcall glBindTransformFeedback(GLenum target, GLuint id) |
| 7863 | { |
| 7864 | EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id); |
| 7865 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7866 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7867 | if (context) |
| 7868 | { |
| 7869 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7870 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7871 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7872 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7873 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7874 | |
| 7875 | switch (target) |
| 7876 | { |
| 7877 | case GL_TRANSFORM_FEEDBACK: |
| 7878 | { |
| 7879 | // Cannot bind a transform feedback object if the current one is started and not paused (3.0.2 pg 85 section 2.14.1) |
| 7880 | gl::TransformFeedback *curTransformFeedback = context->getState().getCurrentTransformFeedback(); |
| 7881 | if (curTransformFeedback && curTransformFeedback->isStarted() && !curTransformFeedback->isPaused()) |
| 7882 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7883 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7884 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7885 | } |
| 7886 | |
| 7887 | // Cannot bind a transform feedback object that does not exist (3.0.2 pg 85 section 2.14.1) |
| 7888 | if (context->getTransformFeedback(id) == NULL) |
| 7889 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7890 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7891 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7892 | } |
| 7893 | |
| 7894 | context->bindTransformFeedback(id); |
| 7895 | } |
| 7896 | break; |
| 7897 | |
| 7898 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7899 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 7900 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7901 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7902 | } |
| 7903 | } |
| 7904 | |
| 7905 | void __stdcall glDeleteTransformFeedbacks(GLsizei n, const GLuint* ids) |
| 7906 | { |
| 7907 | EVENT("(GLsizei n = %d, const GLuint* ids = 0x%0.8p)", n, ids); |
| 7908 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7909 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7910 | if (context) |
| 7911 | { |
| 7912 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7913 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7914 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7915 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7916 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7917 | |
| 7918 | for (int i = 0; i < n; i++) |
| 7919 | { |
| 7920 | context->deleteTransformFeedback(ids[i]); |
| 7921 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7922 | } |
| 7923 | } |
| 7924 | |
| 7925 | void __stdcall glGenTransformFeedbacks(GLsizei n, GLuint* ids) |
| 7926 | { |
| 7927 | EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); |
| 7928 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7929 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7930 | if (context) |
| 7931 | { |
| 7932 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7933 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7934 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7935 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7936 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7937 | |
| 7938 | for (int i = 0; i < n; i++) |
| 7939 | { |
| 7940 | ids[i] = context->createTransformFeedback(); |
| 7941 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7942 | } |
| 7943 | } |
| 7944 | |
| 7945 | GLboolean __stdcall glIsTransformFeedback(GLuint id) |
| 7946 | { |
| 7947 | EVENT("(GLuint id = %u)", id); |
| 7948 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7949 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7950 | if (context) |
| 7951 | { |
| 7952 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7953 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7954 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7955 | return GL_FALSE; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7956 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7957 | |
| 7958 | 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] | 7959 | } |
| 7960 | |
| 7961 | return GL_FALSE; |
| 7962 | } |
| 7963 | |
| 7964 | void __stdcall glPauseTransformFeedback(void) |
| 7965 | { |
| 7966 | EVENT("(void)"); |
| 7967 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7968 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7969 | if (context) |
| 7970 | { |
| 7971 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7972 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7973 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7974 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 7975 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7976 | |
| 7977 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 7978 | ASSERT(transformFeedback != NULL); |
| 7979 | |
| 7980 | // Current transform feedback must be started and not paused in order to pause (3.0.2 pg 86) |
| 7981 | if (!transformFeedback->isStarted() || transformFeedback->isPaused()) |
| 7982 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 7983 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 7984 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7985 | } |
| 7986 | |
| 7987 | transformFeedback->pause(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7988 | } |
| 7989 | } |
| 7990 | |
| 7991 | void __stdcall glResumeTransformFeedback(void) |
| 7992 | { |
| 7993 | EVENT("(void)"); |
| 7994 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7995 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 7996 | if (context) |
| 7997 | { |
| 7998 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 7999 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8000 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8001 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8002 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8003 | |
| 8004 | gl::TransformFeedback *transformFeedback = context->getState().getCurrentTransformFeedback(); |
| 8005 | ASSERT(transformFeedback != NULL); |
| 8006 | |
| 8007 | // Current transform feedback must be started and paused in order to resume (3.0.2 pg 86) |
| 8008 | if (!transformFeedback->isStarted() || !transformFeedback->isPaused()) |
| 8009 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8010 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8011 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8012 | } |
| 8013 | |
| 8014 | transformFeedback->resume(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8015 | } |
| 8016 | } |
| 8017 | |
| 8018 | void __stdcall glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary) |
| 8019 | { |
| 8020 | EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLenum* binaryFormat = 0x%0.8p, GLvoid* binary = 0x%0.8p)", |
| 8021 | program, bufSize, length, binaryFormat, binary); |
| 8022 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8023 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8024 | if (context) |
| 8025 | { |
| 8026 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8027 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8028 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8029 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8030 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8031 | |
| 8032 | // glGetProgramBinary |
| 8033 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8034 | } |
| 8035 | } |
| 8036 | |
| 8037 | void __stdcall glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length) |
| 8038 | { |
| 8039 | EVENT("(GLuint program = %u, GLenum binaryFormat = 0x%X, const GLvoid* binary = 0x%0.8p, GLsizei length = %d)", |
| 8040 | program, binaryFormat, binary, length); |
| 8041 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8042 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8043 | if (context) |
| 8044 | { |
| 8045 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8046 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8047 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8048 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8049 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8050 | |
| 8051 | // glProgramBinary |
| 8052 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8053 | } |
| 8054 | } |
| 8055 | |
| 8056 | void __stdcall glProgramParameteri(GLuint program, GLenum pname, GLint value) |
| 8057 | { |
| 8058 | EVENT("(GLuint program = %u, GLenum pname = 0x%X, GLint value = %d)", |
| 8059 | program, pname, value); |
| 8060 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8061 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8062 | if (context) |
| 8063 | { |
| 8064 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8065 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8066 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8067 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8068 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8069 | |
| 8070 | // glProgramParameteri |
| 8071 | UNIMPLEMENTED(); |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8072 | } |
| 8073 | } |
| 8074 | |
| 8075 | void __stdcall glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments) |
| 8076 | { |
| 8077 | EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p)", |
| 8078 | target, numAttachments, attachments); |
| 8079 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8080 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8081 | if (context) |
| 8082 | { |
| 8083 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8084 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8085 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8086 | return; |
shannonwoods@chromium.org | d63ef89 | 2013-05-30 00:10:56 +0000 | [diff] [blame] | 8087 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8088 | |
| 8089 | if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments)) |
| 8090 | { |
| 8091 | return; |
| 8092 | } |
| 8093 | |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8094 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 8095 | if (framebuffer && framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE) |
| 8096 | { |
| 8097 | framebuffer->invalidate(context->getCaps(), numAttachments, attachments); |
| 8098 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8099 | } |
| 8100 | } |
| 8101 | |
| 8102 | void __stdcall glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) |
| 8103 | { |
| 8104 | EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p, GLint x = %d, " |
| 8105 | "GLint y = %d, GLsizei width = %d, GLsizei height = %d)", |
| 8106 | target, numAttachments, attachments, x, y, width, height); |
| 8107 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8108 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8109 | if (context) |
| 8110 | { |
| 8111 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8112 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8113 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8114 | return; |
shannonwoods@chromium.org | d63ef89 | 2013-05-30 00:10:56 +0000 | [diff] [blame] | 8115 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8116 | |
| 8117 | if (!ValidateInvalidateFramebufferParameters(context, target, numAttachments, attachments)) |
| 8118 | { |
| 8119 | return; |
| 8120 | } |
| 8121 | |
Jamie Madill | 2d96b9e | 2014-08-29 15:46:47 -0400 | [diff] [blame] | 8122 | gl::Framebuffer *framebuffer = context->getState().getTargetFramebuffer(target); |
| 8123 | if (framebuffer && framebuffer->completeness() == GL_FRAMEBUFFER_COMPLETE) |
| 8124 | { |
| 8125 | framebuffer->invalidateSub(context->getCaps(), numAttachments, attachments, x, y, width, height); |
| 8126 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8127 | } |
| 8128 | } |
| 8129 | |
| 8130 | void __stdcall glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) |
| 8131 | { |
| 8132 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", |
| 8133 | target, levels, internalformat, width, height); |
| 8134 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8135 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8136 | if (context) |
| 8137 | { |
| 8138 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8139 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8140 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8141 | return; |
shannonwoods@chromium.org | 8757c06 | 2013-05-30 00:14:24 +0000 | [diff] [blame] | 8142 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8143 | |
| 8144 | if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, 1)) |
| 8145 | { |
| 8146 | return; |
| 8147 | } |
| 8148 | |
| 8149 | switch (target) |
| 8150 | { |
| 8151 | case GL_TEXTURE_2D: |
| 8152 | { |
| 8153 | gl::Texture2D *texture2d = context->getTexture2D(); |
| 8154 | texture2d->storage(levels, internalformat, width, height); |
| 8155 | } |
| 8156 | break; |
| 8157 | |
| 8158 | case GL_TEXTURE_CUBE_MAP: |
| 8159 | { |
| 8160 | gl::TextureCubeMap *textureCube = context->getTextureCubeMap(); |
| 8161 | textureCube->storage(levels, internalformat, width); |
| 8162 | } |
| 8163 | break; |
| 8164 | |
| 8165 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8166 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8167 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8168 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8169 | } |
| 8170 | } |
| 8171 | |
| 8172 | void __stdcall glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) |
| 8173 | { |
| 8174 | EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " |
| 8175 | "GLsizei height = %d, GLsizei depth = %d)", |
| 8176 | target, levels, internalformat, width, height, depth); |
| 8177 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8178 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8179 | if (context) |
| 8180 | { |
| 8181 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8182 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8183 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8184 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 14eb55e | 2013-04-13 03:35:06 +0000 | [diff] [blame] | 8185 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8186 | |
| 8187 | if (!ValidateES3TexStorageParameters(context, target, levels, internalformat, width, height, depth)) |
| 8188 | { |
| 8189 | return; |
| 8190 | } |
| 8191 | |
| 8192 | switch (target) |
| 8193 | { |
| 8194 | case GL_TEXTURE_3D: |
| 8195 | { |
| 8196 | gl::Texture3D *texture3d = context->getTexture3D(); |
| 8197 | texture3d->storage(levels, internalformat, width, height, depth); |
| 8198 | } |
| 8199 | break; |
| 8200 | |
| 8201 | case GL_TEXTURE_2D_ARRAY: |
| 8202 | { |
| 8203 | gl::Texture2DArray *texture2darray = context->getTexture2DArray(); |
| 8204 | texture2darray->storage(levels, internalformat, width, height, depth); |
| 8205 | } |
| 8206 | break; |
| 8207 | |
| 8208 | default: |
| 8209 | UNREACHABLE(); |
| 8210 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8211 | } |
| 8212 | } |
| 8213 | |
| 8214 | void __stdcall glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) |
| 8215 | { |
| 8216 | EVENT("(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, " |
| 8217 | "GLint* params = 0x%0.8p)", |
| 8218 | target, internalformat, pname, bufSize, params); |
| 8219 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8220 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8221 | if (context) |
| 8222 | { |
| 8223 | if (context->getClientVersion() < 3) |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8224 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8225 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8226 | return; |
shannonwoods@chromium.org | 705fc2f | 2013-05-30 00:17:14 +0000 | [diff] [blame] | 8227 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8228 | |
| 8229 | const gl::TextureCaps &formatCaps = context->getTextureCaps().get(internalformat); |
| 8230 | if (!formatCaps.renderable) |
| 8231 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8232 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8233 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8234 | } |
| 8235 | |
| 8236 | if (target != GL_RENDERBUFFER) |
| 8237 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8238 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8239 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8240 | } |
| 8241 | |
| 8242 | if (bufSize < 0) |
| 8243 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8244 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8245 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8246 | } |
| 8247 | |
| 8248 | switch (pname) |
| 8249 | { |
| 8250 | case GL_NUM_SAMPLE_COUNTS: |
| 8251 | if (bufSize != 0) |
Geoff Lang | 5f4c463 | 2014-07-03 13:46:52 -0400 | [diff] [blame] | 8252 | { |
| 8253 | *params = formatCaps.sampleCounts.size(); |
| 8254 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8255 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8256 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8257 | case GL_SAMPLES: |
Geoff Lang | 5f4c463 | 2014-07-03 13:46:52 -0400 | [diff] [blame] | 8258 | 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] | 8259 | break; |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8260 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8261 | default: |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8262 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8263 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8264 | } |
shannon.woods%transgaming.com@gtempaccount.com | a817175 | 2013-04-13 03:29:28 +0000 | [diff] [blame] | 8265 | } |
| 8266 | } |
| 8267 | |
| 8268 | // Extension functions |
| 8269 | |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8270 | void __stdcall glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, |
| 8271 | GLbitfield mask, GLenum filter) |
| 8272 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 8273 | 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] | 8274 | "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, " |
| 8275 | "GLbitfield mask = 0x%X, GLenum filter = 0x%X)", |
| 8276 | srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter); |
| 8277 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8278 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8279 | if (context) |
| 8280 | { |
| 8281 | if (!ValidateBlitFramebufferParameters(context, srcX0, srcY0, srcX1, srcY1, |
| 8282 | dstX0, dstY0, dstX1, dstY1, mask, filter, |
| 8283 | true)) |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8284 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8285 | return; |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8286 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8287 | |
| 8288 | context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, |
| 8289 | mask, filter); |
daniel@transgaming.com | 4cbc590 | 2010-08-24 19:20:26 +0000 | [diff] [blame] | 8290 | } |
| 8291 | } |
| 8292 | |
daniel@transgaming.com | fe4b827 | 2010-04-08 03:51:20 +0000 | [diff] [blame] | 8293 | void __stdcall glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, |
| 8294 | GLint border, GLenum format, GLenum type, const GLvoid* pixels) |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8295 | { |
apatrick@chromium.org | 0f4cefe | 2011-01-26 19:30:57 +0000 | [diff] [blame] | 8296 | 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] | 8297 | "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] | 8298 | "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] | 8299 | target, level, internalformat, width, height, depth, border, format, type, pixels); |
| 8300 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8301 | UNIMPLEMENTED(); // FIXME |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8302 | } |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8303 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8304 | void __stdcall glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8305 | GLenum *binaryFormat, void *binary) |
| 8306 | { |
apatrick@chromium.org | 90080e3 | 2012-07-09 22:15:33 +0000 | [diff] [blame] | 8307 | 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] | 8308 | program, bufSize, length, binaryFormat, binary); |
| 8309 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8310 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8311 | if (context) |
| 8312 | { |
| 8313 | gl::Program *programObject = context->getProgram(program); |
| 8314 | |
| 8315 | if (!programObject || !programObject->isLinked()) |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8316 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8317 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8318 | return; |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8319 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8320 | |
| 8321 | gl::ProgramBinary *programBinary = programObject->getProgramBinary(); |
| 8322 | |
| 8323 | if (!programBinary) |
| 8324 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8325 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8326 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8327 | } |
| 8328 | |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 8329 | if (!programBinary->save(binaryFormat, binary, bufSize, length)) |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8330 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8331 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8332 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8333 | } |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8334 | } |
| 8335 | } |
| 8336 | |
| 8337 | void __stdcall glProgramBinaryOES(GLuint program, GLenum binaryFormat, |
| 8338 | const void *binary, GLint length) |
| 8339 | { |
| 8340 | EVENT("(GLenum program = 0x%X, binaryFormat = 0x%x, binary = 0x%0.8p, length = %d)", |
| 8341 | program, binaryFormat, binary, length); |
| 8342 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8343 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8344 | if (context) |
| 8345 | { |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 8346 | const std::vector<GLenum> &programBinaryFormats = context->getCaps().programBinaryFormats; |
| 8347 | if (std::find(programBinaryFormats.begin(), programBinaryFormats.end(), binaryFormat) == programBinaryFormats.end()) |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8348 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8349 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8350 | return; |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8351 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8352 | |
| 8353 | gl::Program *programObject = context->getProgram(program); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8354 | if (!programObject) |
| 8355 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8356 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8357 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8358 | } |
| 8359 | |
Geoff Lang | 900013c | 2014-07-07 11:32:19 -0400 | [diff] [blame] | 8360 | context->setProgramBinary(program, binaryFormat, binary, length); |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8361 | } |
| 8362 | } |
| 8363 | |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8364 | void __stdcall glDrawBuffersEXT(GLsizei n, const GLenum *bufs) |
| 8365 | { |
| 8366 | EVENT("(GLenum n = %d, bufs = 0x%0.8p)", n, bufs); |
| 8367 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8368 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8369 | if (context) |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8370 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8371 | 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] | 8372 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8373 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8374 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8375 | } |
| 8376 | |
| 8377 | if (context->getState().getDrawFramebuffer()->id() == 0) |
| 8378 | { |
| 8379 | if (n != 1) |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8380 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8381 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8382 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8383 | } |
| 8384 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8385 | 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] | 8386 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8387 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8388 | return; |
shannon.woods%transgaming.com@gtempaccount.com | 2fa73c5 | 2013-04-13 03:37:20 +0000 | [diff] [blame] | 8389 | } |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8390 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8391 | else |
| 8392 | { |
| 8393 | for (int colorAttachment = 0; colorAttachment < n; colorAttachment++) |
| 8394 | { |
| 8395 | const GLenum attachment = GL_COLOR_ATTACHMENT0_EXT + colorAttachment; |
| 8396 | if (bufs[colorAttachment] != GL_NONE && bufs[colorAttachment] != attachment) |
| 8397 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8398 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8399 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8400 | } |
| 8401 | } |
| 8402 | } |
| 8403 | |
| 8404 | gl::Framebuffer *framebuffer = context->getState().getDrawFramebuffer(); |
| 8405 | |
| 8406 | for (unsigned int colorAttachment = 0; colorAttachment < static_cast<unsigned int>(n); colorAttachment++) |
| 8407 | { |
| 8408 | framebuffer->setDrawBufferState(colorAttachment, bufs[colorAttachment]); |
| 8409 | } |
| 8410 | |
| 8411 | for (unsigned int colorAttachment = n; colorAttachment < context->getCaps().maxDrawBuffers; colorAttachment++) |
| 8412 | { |
| 8413 | framebuffer->setDrawBufferState(colorAttachment, GL_NONE); |
| 8414 | } |
shannon.woods%transgaming.com@gtempaccount.com | 4059a38 | 2013-04-13 03:31:16 +0000 | [diff] [blame] | 8415 | } |
| 8416 | } |
| 8417 | |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8418 | void __stdcall glGetBufferPointervOES(GLenum target, GLenum pname, void** params) |
| 8419 | { |
| 8420 | EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params); |
| 8421 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8422 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8423 | if (context) |
| 8424 | { |
| 8425 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8426 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8427 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8428 | return; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8429 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8430 | |
| 8431 | if (pname != GL_BUFFER_MAP_POINTER) |
| 8432 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8433 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8434 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8435 | } |
| 8436 | |
| 8437 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8438 | |
| 8439 | if (!buffer || !buffer->isMapped()) |
| 8440 | { |
| 8441 | *params = NULL; |
| 8442 | } |
| 8443 | else |
| 8444 | { |
| 8445 | *params = buffer->getMapPointer(); |
| 8446 | } |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8447 | } |
| 8448 | } |
| 8449 | |
| 8450 | void * __stdcall glMapBufferOES(GLenum target, GLenum access) |
| 8451 | { |
| 8452 | EVENT("(GLenum target = 0x%X, GLbitfield access = 0x%X)", target, access); |
| 8453 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8454 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8455 | if (context) |
| 8456 | { |
| 8457 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8458 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8459 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8460 | return NULL; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8461 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8462 | |
| 8463 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8464 | |
| 8465 | if (buffer == NULL) |
| 8466 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8467 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8468 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8469 | } |
| 8470 | |
| 8471 | if (access != GL_WRITE_ONLY_OES) |
| 8472 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8473 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8474 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8475 | } |
| 8476 | |
| 8477 | if (buffer->isMapped()) |
| 8478 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8479 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8480 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8481 | } |
| 8482 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 8483 | gl::Error error = buffer->mapRange(0, buffer->getSize(), GL_MAP_WRITE_BIT); |
| 8484 | if (error.isError()) |
| 8485 | { |
| 8486 | context->recordError(error); |
| 8487 | return NULL; |
| 8488 | } |
| 8489 | |
| 8490 | return buffer->getMapPointer(); |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8491 | } |
| 8492 | |
| 8493 | return NULL; |
| 8494 | } |
| 8495 | |
| 8496 | GLboolean __stdcall glUnmapBufferOES(GLenum target) |
| 8497 | { |
| 8498 | EVENT("(GLenum target = 0x%X)", target); |
| 8499 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8500 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8501 | if (context) |
| 8502 | { |
| 8503 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8504 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8505 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8506 | return GL_FALSE; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8507 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8508 | |
| 8509 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8510 | |
| 8511 | if (buffer == NULL || !buffer->isMapped()) |
| 8512 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8513 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8514 | return GL_FALSE; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8515 | } |
| 8516 | |
| 8517 | // TODO: detect if we had corruption. if so, throw an error and return false. |
| 8518 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 8519 | gl::Error error = buffer->unmap(); |
| 8520 | if (error.isError()) |
| 8521 | { |
| 8522 | context->recordError(error); |
| 8523 | return GL_FALSE; |
| 8524 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8525 | |
| 8526 | return GL_TRUE; |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8527 | } |
| 8528 | |
| 8529 | return GL_FALSE; |
| 8530 | } |
| 8531 | |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8532 | void* __stdcall glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) |
| 8533 | { |
| 8534 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)", |
| 8535 | target, offset, length, access); |
| 8536 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8537 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8538 | if (context) |
| 8539 | { |
| 8540 | if (!gl::ValidBufferTarget(context, target)) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8541 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8542 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8543 | return NULL; |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8544 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8545 | |
| 8546 | if (offset < 0 || length < 0) |
| 8547 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8548 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8549 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8550 | } |
| 8551 | |
| 8552 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8553 | |
| 8554 | if (buffer == NULL) |
| 8555 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8556 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8557 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8558 | } |
| 8559 | |
| 8560 | // Check for buffer overflow |
| 8561 | size_t offsetSize = static_cast<size_t>(offset); |
| 8562 | size_t lengthSize = static_cast<size_t>(length); |
| 8563 | |
| 8564 | if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) || |
| 8565 | offsetSize + lengthSize > static_cast<size_t>(buffer->getSize())) |
| 8566 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8567 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8568 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8569 | } |
| 8570 | |
| 8571 | // Check for invalid bits in the mask |
| 8572 | GLbitfield allAccessBits = GL_MAP_READ_BIT | |
| 8573 | GL_MAP_WRITE_BIT | |
| 8574 | GL_MAP_INVALIDATE_RANGE_BIT | |
| 8575 | GL_MAP_INVALIDATE_BUFFER_BIT | |
| 8576 | GL_MAP_FLUSH_EXPLICIT_BIT | |
| 8577 | GL_MAP_UNSYNCHRONIZED_BIT; |
| 8578 | |
| 8579 | if (access & ~(allAccessBits)) |
| 8580 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8581 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8582 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8583 | } |
| 8584 | |
| 8585 | if (length == 0 || buffer->isMapped()) |
| 8586 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8587 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8588 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8589 | } |
| 8590 | |
| 8591 | // Check for invalid bit combinations |
| 8592 | if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0) |
| 8593 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8594 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8595 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8596 | } |
| 8597 | |
| 8598 | GLbitfield writeOnlyBits = GL_MAP_INVALIDATE_RANGE_BIT | |
| 8599 | GL_MAP_INVALIDATE_BUFFER_BIT | |
| 8600 | GL_MAP_UNSYNCHRONIZED_BIT; |
| 8601 | |
| 8602 | if ((access & GL_MAP_READ_BIT) != 0 && (access & writeOnlyBits) != 0) |
| 8603 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8604 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8605 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8606 | } |
| 8607 | |
| 8608 | if ((access & GL_MAP_WRITE_BIT) == 0 && (access & GL_MAP_FLUSH_EXPLICIT_BIT) != 0) |
| 8609 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8610 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8611 | return NULL; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8612 | } |
| 8613 | |
Geoff Lang | 2a1c15a | 2014-07-25 11:43:00 -0400 | [diff] [blame] | 8614 | gl::Error error = buffer->mapRange(offset, length, access); |
| 8615 | if (error.isError()) |
| 8616 | { |
| 8617 | context->recordError(error); |
| 8618 | return NULL; |
| 8619 | } |
| 8620 | |
| 8621 | return buffer->getMapPointer(); |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8622 | } |
| 8623 | |
| 8624 | return NULL; |
| 8625 | } |
| 8626 | |
| 8627 | void __stdcall glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length) |
| 8628 | { |
| 8629 | EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length); |
| 8630 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8631 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8632 | if (context) |
| 8633 | { |
| 8634 | if (offset < 0 || length < 0) |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8635 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8636 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8637 | return; |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8638 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8639 | |
| 8640 | if (!gl::ValidBufferTarget(context, target)) |
| 8641 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8642 | context->recordError(gl::Error(GL_INVALID_ENUM)); |
| 8643 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8644 | } |
| 8645 | |
| 8646 | gl::Buffer *buffer = context->getState().getTargetBuffer(target); |
| 8647 | |
| 8648 | if (buffer == NULL) |
| 8649 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8650 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8651 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8652 | } |
| 8653 | |
| 8654 | if (!buffer->isMapped() || (buffer->getAccessFlags() & GL_MAP_FLUSH_EXPLICIT_BIT) == 0) |
| 8655 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8656 | context->recordError(gl::Error(GL_INVALID_OPERATION)); |
| 8657 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8658 | } |
| 8659 | |
| 8660 | // Check for buffer overflow |
| 8661 | size_t offsetSize = static_cast<size_t>(offset); |
| 8662 | size_t lengthSize = static_cast<size_t>(length); |
| 8663 | |
| 8664 | if (!rx::IsUnsignedAdditionSafe(offsetSize, lengthSize) || |
| 8665 | offsetSize + lengthSize > static_cast<size_t>(buffer->getMapLength())) |
| 8666 | { |
Geoff Lang | b119668 | 2014-07-23 13:47:29 -0400 | [diff] [blame] | 8667 | context->recordError(gl::Error(GL_INVALID_VALUE)); |
| 8668 | return; |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8669 | } |
| 8670 | |
| 8671 | // We do not currently support a non-trivial implementation of FlushMappedBufferRange |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8672 | } |
| 8673 | } |
| 8674 | |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8675 | __eglMustCastToProperFunctionPointerType __stdcall glGetProcAddress(const char *procname) |
| 8676 | { |
| 8677 | struct Extension |
| 8678 | { |
| 8679 | const char *name; |
| 8680 | __eglMustCastToProperFunctionPointerType address; |
| 8681 | }; |
| 8682 | |
| 8683 | static const Extension glExtensions[] = |
| 8684 | { |
| 8685 | {"glTexImage3DOES", (__eglMustCastToProperFunctionPointerType)glTexImage3DOES}, |
daniel@transgaming.com | 0186813 | 2010-08-24 19:21:17 +0000 | [diff] [blame] | 8686 | {"glBlitFramebufferANGLE", (__eglMustCastToProperFunctionPointerType)glBlitFramebufferANGLE}, |
daniel@transgaming.com | 1fe96c9 | 2011-01-14 15:08:44 +0000 | [diff] [blame] | 8687 | {"glRenderbufferStorageMultisampleANGLE", (__eglMustCastToProperFunctionPointerType)glRenderbufferStorageMultisampleANGLE}, |
apatrick@chromium.org | d3bd0ad | 2010-08-30 18:55:36 +0000 | [diff] [blame] | 8688 | {"glDeleteFencesNV", (__eglMustCastToProperFunctionPointerType)glDeleteFencesNV}, |
| 8689 | {"glGenFencesNV", (__eglMustCastToProperFunctionPointerType)glGenFencesNV}, |
| 8690 | {"glIsFenceNV", (__eglMustCastToProperFunctionPointerType)glIsFenceNV}, |
| 8691 | {"glTestFenceNV", (__eglMustCastToProperFunctionPointerType)glTestFenceNV}, |
| 8692 | {"glGetFenceivNV", (__eglMustCastToProperFunctionPointerType)glGetFenceivNV}, |
| 8693 | {"glFinishFenceNV", (__eglMustCastToProperFunctionPointerType)glFinishFenceNV}, |
| 8694 | {"glSetFenceNV", (__eglMustCastToProperFunctionPointerType)glSetFenceNV}, |
zmo@google.com | a574f78 | 2011-10-03 21:45:23 +0000 | [diff] [blame] | 8695 | {"glGetTranslatedShaderSourceANGLE", (__eglMustCastToProperFunctionPointerType)glGetTranslatedShaderSourceANGLE}, |
daniel@transgaming.com | 0bd1f2f | 2011-11-11 04:19:03 +0000 | [diff] [blame] | 8696 | {"glTexStorage2DEXT", (__eglMustCastToProperFunctionPointerType)glTexStorage2DEXT}, |
daniel@transgaming.com | 709ed11 | 2011-11-12 03:18:10 +0000 | [diff] [blame] | 8697 | {"glGetGraphicsResetStatusEXT", (__eglMustCastToProperFunctionPointerType)glGetGraphicsResetStatusEXT}, |
| 8698 | {"glReadnPixelsEXT", (__eglMustCastToProperFunctionPointerType)glReadnPixelsEXT}, |
| 8699 | {"glGetnUniformfvEXT", (__eglMustCastToProperFunctionPointerType)glGetnUniformfvEXT}, |
| 8700 | {"glGetnUniformivEXT", (__eglMustCastToProperFunctionPointerType)glGetnUniformivEXT}, |
daniel@transgaming.com | 86bdb82 | 2012-01-20 18:24:39 +0000 | [diff] [blame] | 8701 | {"glGenQueriesEXT", (__eglMustCastToProperFunctionPointerType)glGenQueriesEXT}, |
| 8702 | {"glDeleteQueriesEXT", (__eglMustCastToProperFunctionPointerType)glDeleteQueriesEXT}, |
| 8703 | {"glIsQueryEXT", (__eglMustCastToProperFunctionPointerType)glIsQueryEXT}, |
| 8704 | {"glBeginQueryEXT", (__eglMustCastToProperFunctionPointerType)glBeginQueryEXT}, |
| 8705 | {"glEndQueryEXT", (__eglMustCastToProperFunctionPointerType)glEndQueryEXT}, |
| 8706 | {"glGetQueryivEXT", (__eglMustCastToProperFunctionPointerType)glGetQueryivEXT}, |
| 8707 | {"glGetQueryObjectuivEXT", (__eglMustCastToProperFunctionPointerType)glGetQueryObjectuivEXT}, |
shannon.woods%transgaming.com@gtempaccount.com | 77d9472 | 2013-04-13 03:34:22 +0000 | [diff] [blame] | 8708 | {"glDrawBuffersEXT", (__eglMustCastToProperFunctionPointerType)glDrawBuffersEXT}, |
daniel@transgaming.com | dce02fd | 2012-01-27 15:39:51 +0000 | [diff] [blame] | 8709 | {"glVertexAttribDivisorANGLE", (__eglMustCastToProperFunctionPointerType)glVertexAttribDivisorANGLE}, |
| 8710 | {"glDrawArraysInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawArraysInstancedANGLE}, |
| 8711 | {"glDrawElementsInstancedANGLE", (__eglMustCastToProperFunctionPointerType)glDrawElementsInstancedANGLE}, |
apatrick@chromium.org | 3ce8dbc | 2012-06-08 17:52:30 +0000 | [diff] [blame] | 8712 | {"glGetProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glGetProgramBinaryOES}, |
Shannon Woods | b380174 | 2014-03-27 14:59:19 -0400 | [diff] [blame] | 8713 | {"glProgramBinaryOES", (__eglMustCastToProperFunctionPointerType)glProgramBinaryOES}, |
| 8714 | {"glGetBufferPointervOES", (__eglMustCastToProperFunctionPointerType)glGetBufferPointervOES}, |
| 8715 | {"glMapBufferOES", (__eglMustCastToProperFunctionPointerType)glMapBufferOES}, |
Shannon Woods | 916e769 | 2014-03-27 16:58:22 -0400 | [diff] [blame] | 8716 | {"glUnmapBufferOES", (__eglMustCastToProperFunctionPointerType)glUnmapBufferOES}, |
| 8717 | {"glMapBufferRangeEXT", (__eglMustCastToProperFunctionPointerType)glMapBufferRangeEXT}, |
| 8718 | {"glFlushMappedBufferRangeEXT", (__eglMustCastToProperFunctionPointerType)glFlushMappedBufferRangeEXT}, }; |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8719 | |
shannon.woods@transgaming.com | d438fd4 | 2013-02-28 23:17:45 +0000 | [diff] [blame] | 8720 | for (unsigned int ext = 0; ext < ArraySize(glExtensions); ext++) |
daniel@transgaming.com | ce3d0f2 | 2010-05-04 03:35:14 +0000 | [diff] [blame] | 8721 | { |
| 8722 | if (strcmp(procname, glExtensions[ext].name) == 0) |
| 8723 | { |
| 8724 | return (__eglMustCastToProperFunctionPointerType)glExtensions[ext].address; |
| 8725 | } |
| 8726 | } |
| 8727 | |
| 8728 | return NULL; |
| 8729 | } |
| 8730 | |
daniel@transgaming.com | 17f548c | 2011-11-09 17:47:02 +0000 | [diff] [blame] | 8731 | // Non-public functions used by EGL |
| 8732 | |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 8733 | bool __stdcall glBindTexImage(egl::Surface *surface) |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8734 | { |
| 8735 | EVENT("(egl::Surface* surface = 0x%0.8p)", |
| 8736 | surface); |
| 8737 | |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8738 | gl::Context *context = gl::getNonLostContext(); |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8739 | if (context) |
| 8740 | { |
| 8741 | gl::Texture2D *textureObject = context->getTexture2D(); |
| 8742 | ASSERT(textureObject != NULL); |
| 8743 | |
| 8744 | if (textureObject->isImmutable()) |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8745 | { |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8746 | return false; |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8747 | } |
Geoff Lang | bfdea66 | 2014-07-23 14:16:32 -0400 | [diff] [blame] | 8748 | |
| 8749 | textureObject->bindTexImage(surface); |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8750 | } |
daniel@transgaming.com | 64a0fb2 | 2011-11-11 04:10:40 +0000 | [diff] [blame] | 8751 | |
| 8752 | return true; |
jbauman@chromium.org | ae34580 | 2011-03-30 22:04:25 +0000 | [diff] [blame] | 8753 | } |
| 8754 | |
daniel@transgaming.com | 4f39fd9 | 2010-03-08 20:26:45 +0000 | [diff] [blame] | 8755 | } |