| 237 | } |
| 238 | |
| 239 | void WrappedOpenGL::CopyDepthTex2DMSToArray(GLuint &destArray, GLuint srcMS, GLint width, |
| 240 | GLint height, GLint arraySize, GLint samples, |
| 241 | GLenum intFormat) |
| 242 | { |
| 243 | GLMarkerRegion renderoverlay("CopyDepthTex2DMSToArray"); |
| 244 | |
| 245 | const ArrayMSPrograms &arrms = GetArrayMS(); |
| 246 | |
| 247 | GLRenderState rs; |
| 248 | rs.FetchState(this); |
| 249 | |
| 250 | GLuint vao = 0; |
| 251 | GL.glGenVertexArrays(1, &vao); |
| 252 | GL.glBindVertexArray(vao); |
| 253 | |
| 254 | GLuint texs[3]; |
| 255 | GL.glGenTextures(3, texs); |
| 256 | GL.glTextureView(texs[0], eGL_TEXTURE_2D_ARRAY, destArray, intFormat, 0, 1, 0, arraySize * samples); |
| 257 | GL.glTextureView(texs[1], eGL_TEXTURE_2D_MULTISAMPLE_ARRAY, srcMS, intFormat, 0, 1, 0, arraySize); |
| 258 | GL.glTextureView(texs[2], eGL_TEXTURE_2D_MULTISAMPLE_ARRAY, srcMS, intFormat, 0, 1, 0, arraySize); |
| 259 | GL.glTextureParameteriEXT(texs[0], eGL_TEXTURE_2D_ARRAY, eGL_TEXTURE_BASE_LEVEL, 0); |
| 260 | GL.glTextureParameteriEXT(texs[0], eGL_TEXTURE_2D_ARRAY, eGL_TEXTURE_MAX_LEVEL, 0); |
| 261 | |
| 262 | GLuint fbo = 0; |
| 263 | GL.glGenFramebuffers(1, &fbo); |
| 264 | GL.glBindFramebuffer(eGL_FRAMEBUFFER, fbo); |
| 265 | GL.glDrawBuffers(0, NULL); |
| 266 | |
| 267 | GL.glUseProgram(arrms.DepthMS2Array); |
| 268 | GL.glViewport(0, 0, width, height); |
| 269 | |
| 270 | GL.glDisable(eGL_CULL_FACE); |
| 271 | GL.glDisable(eGL_BLEND); |
| 272 | GL.glDisable(eGL_SCISSOR_TEST); |
| 273 | if(!IsGLES) |
| 274 | GL.glPolygonMode(eGL_FRONT_AND_BACK, eGL_FILL); |
| 275 | GL.glEnable(eGL_DEPTH_TEST); |
| 276 | GL.glEnable(eGL_STENCIL_TEST); |
| 277 | GL.glDepthFunc(eGL_ALWAYS); |
| 278 | GL.glDepthMask(GL_TRUE); |
| 279 | GL.glStencilOp(eGL_REPLACE, eGL_REPLACE, eGL_REPLACE); |
| 280 | GL.glStencilMask(0xff); |
| 281 | |
| 282 | uint32_t numStencil = 1; |
| 283 | GLenum attach = eGL_DEPTH_ATTACHMENT; |
| 284 | |
| 285 | switch(GetBaseFormat(intFormat)) |
| 286 | { |
| 287 | case eGL_DEPTH_STENCIL: |
| 288 | numStencil = 256; |
| 289 | attach = eGL_DEPTH_STENCIL_ATTACHMENT; |
| 290 | break; |
| 291 | case eGL_DEPTH_COMPONENT: |
| 292 | numStencil = 1; |
| 293 | attach = eGL_DEPTH_ATTACHMENT; |
| 294 | break; |
| 295 | case eGL_STENCIL_INDEX: |
| 296 | numStencil = 256; |
nothing calls this directly
no test coverage detected