| 113 | } |
| 114 | |
| 115 | void WrappedOpenGL::CopyTex2DMSToArray(GLuint &destArray, GLuint srcMS, GLint width, GLint height, |
| 116 | GLint arraySize, GLint samples, GLenum intFormat) |
| 117 | { |
| 118 | const ArrayMSPrograms &arrms = GetArrayMS(); |
| 119 | |
| 120 | intFormat = GetSizedFormat(intFormat); |
| 121 | |
| 122 | bool needInit = false; |
| 123 | |
| 124 | // create temporary texture array, which we'll initialise to be the width/height in same format, |
| 125 | // with the same number of array slices as multi samples. |
| 126 | if(destArray == 0) |
| 127 | { |
| 128 | GL.glGenTextures(1, &destArray); |
| 129 | GL.glBindTexture(eGL_TEXTURE_2D_ARRAY, destArray); |
| 130 | |
| 131 | needInit = true; |
| 132 | } |
| 133 | |
| 134 | bool failed = false; |
| 135 | |
| 136 | if(!HasExt[ARB_compute_shader]) |
| 137 | { |
| 138 | RDCWARN( |
| 139 | "Can't copy multisampled texture to array for serialisation without ARB_compute_shader."); |
| 140 | failed = true; |
| 141 | } |
| 142 | |
| 143 | if(!failed && !HasExt[ARB_texture_view]) |
| 144 | { |
| 145 | RDCWARN("Can't copy multisampled texture to array for serialisation without ARB_texture_view."); |
| 146 | failed = true; |
| 147 | } |
| 148 | |
| 149 | if(!failed && !HasExt[ARB_texture_storage]) |
| 150 | { |
| 151 | RDCWARN( |
| 152 | "Can't copy multisampled texture to array for serialisation without ARB_texture_view, and " |
| 153 | "ARB_texture_view requires ARB_texture_storage."); |
| 154 | failed = true; |
| 155 | } |
| 156 | |
| 157 | if(!arrms.MS2Array || (IsDepthStencilFormat(intFormat) && !arrms.DepthMS2Array)) |
| 158 | { |
| 159 | failed = true; |
| 160 | } |
| 161 | |
| 162 | if(failed) |
| 163 | { |
| 164 | // create using the non-storage API which is always available, so the texture is at least valid |
| 165 | // (but with undefined/empty contents). |
| 166 | if(needInit) |
| 167 | { |
| 168 | GL.glTextureImage3DEXT(destArray, eGL_TEXTURE_2D_ARRAY, 0, intFormat, width, height, |
| 169 | arraySize * samples, 0, GetBaseFormat(intFormat), |
| 170 | GetDataType(intFormat), NULL); |
| 171 | GL.glTextureParameteriEXT(destArray, eGL_TEXTURE_2D_ARRAY, eGL_TEXTURE_MAX_LEVEL, 0); |
| 172 | } |
no test coverage detected