Commit 5c6a3c24 by Nicolas Capens Committed by Nicolas Capens

Remove the GL_NV_read_depth_stencil extension

Remove it root and stem to ensure there can't be any usage of it, since it cannot be efficiently supported by ANGLE with SwiftShader Vulkan without major changes. Bug: b/147536183 Bug: b/147762087 Change-Id: Ib413e7c7f8d13ee22a5201e34163f592db572d86 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40112 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarLingfeng Yang <lfy@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 5fc197dc
...@@ -3394,7 +3394,6 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum ...@@ -3394,7 +3394,6 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum
switch(format) switch(format)
{ {
case GL_DEPTH_COMPONENT: // GL_NV_read_depth case GL_DEPTH_COMPONENT: // GL_NV_read_depth
case GL_DEPTH_STENCIL_OES: // GL_NV_read_depth_stencil
renderTarget = framebuffer->getDepthBuffer(); renderTarget = framebuffer->getDepthBuffer();
break; break;
case GL_STENCIL_INDEX_OES: // GL_NV_read_stencil case GL_STENCIL_INDEX_OES: // GL_NV_read_stencil
...@@ -3414,64 +3413,12 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum ...@@ -3414,64 +3413,12 @@ void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum
sw::SliceRect dstRect(0, 0, width, height, 0); sw::SliceRect dstRect(0, 0, width, height, 0);
srcRect.clip(0.0f, 0.0f, (float)renderTarget->getWidth(), (float)renderTarget->getHeight()); srcRect.clip(0.0f, 0.0f, (float)renderTarget->getWidth(), (float)renderTarget->getHeight());
if(format != GL_DEPTH_STENCIL_OES) // The blitter only handles reading either depth or stencil. ASSERT(format != GL_DEPTH_STENCIL_OES); // The blitter only handles reading either depth or stencil.
{
sw::Surface *externalSurface = sw::Surface::create(width, height, 1, es2::ConvertReadFormatType(format, type), pixels, outputPitch, outputPitch * outputHeight); sw::Surface *externalSurface = sw::Surface::create(width, height, 1, es2::ConvertReadFormatType(format, type), pixels, outputPitch, outputPitch * outputHeight);
device->blit(renderTarget, srcRect, externalSurface, dstRect, false, false, false); device->blit(renderTarget, srcRect, externalSurface, dstRect, false, false, false);
externalSurface->lockExternal(0, 0, 0, sw::LOCK_READONLY, sw::PUBLIC); externalSurface->lockExternal(0, 0, 0, sw::LOCK_READONLY, sw::PUBLIC);
externalSurface->unlockExternal(); externalSurface->unlockExternal();
delete externalSurface; delete externalSurface;
}
else // format == GL_DEPTH_STENCIL_OES
{
ASSERT(renderTarget->getInternalFormat() == sw::FORMAT_D32F_LOCKABLE);
float *depth = (float*)renderTarget->lockInternal((int)srcRect.x0, (int)srcRect.y0, 0, sw::LOCK_READONLY, sw::PUBLIC);
uint8_t *stencil = (uint8_t*)renderTarget->lockStencil((int)srcRect.x0, (int)srcRect.y0, 0, sw::PUBLIC);
switch(type)
{
case GL_UNSIGNED_INT_24_8_OES:
{
uint32_t *output = (uint32_t*)pixels;
for(int y = 0; y < height; y++)
{
for(int x = 0; x < width; x++)
{
output[x] = ((uint32_t)roundf(depth[x] * 0xFFFFFF00) & 0xFFFFFF00) | stencil[x];
}
depth += renderTarget->getInternalPitchP();
stencil += renderTarget->getStencilPitchB();
(uint8_t*&)output += outputPitch;
}
}
break;
case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
{
struct D32FS8 { float depth32f; unsigned int stencil24_8; };
D32FS8 *output = (D32FS8*)pixels;
for(int y = 0; y < height; y++)
{
for(int x = 0; x < width; x++)
{
output[x].depth32f = depth[x];
output[x].stencil24_8 = stencil[x];
}
depth += renderTarget->getInternalPitchP();
stencil += renderTarget->getStencilPitchB();
(uint8_t*&)output += outputPitch;
}
}
break;
default: UNREACHABLE(type);
}
renderTarget->unlockInternal();
renderTarget->unlockStencil();
}
renderTarget->release(); renderTarget->release();
} }
...@@ -4602,7 +4549,6 @@ const GLubyte *Context::getExtensions(GLuint index, GLuint *numExt) const ...@@ -4602,7 +4549,6 @@ const GLubyte *Context::getExtensions(GLuint index, GLuint *numExt) const
"GL_NV_fence", "GL_NV_fence",
// "GL_NV_framebuffer_blit", // b/147536183 // "GL_NV_framebuffer_blit", // b/147536183
"GL_NV_read_depth", "GL_NV_read_depth",
"GL_NV_read_depth_stencil",
"GL_NV_read_stencil", "GL_NV_read_stencil",
}; };
......
...@@ -679,51 +679,6 @@ namespace es2 ...@@ -679,51 +679,6 @@ namespace es2
return true; return true;
} }
// GL_NV_read_depth_stencil
if(format == GL_DEPTH_STENCIL_OES)
{
Renderbuffer *depthbuffer = framebuffer->getDepthbuffer();
if(!depthbuffer)
{
return error(GL_INVALID_OPERATION, false);
}
GLint internalformat = depthbuffer->getFormat();
switch(type)
{
case GL_UNSIGNED_INT_24_8_OES:
switch(internalformat)
{
case GL_DEPTH24_STENCIL8:
break;
case GL_DEPTH32F_STENCIL8:
return error(GL_INVALID_OPERATION, false);
default:
UNREACHABLE(internalformat);
return error(GL_INVALID_OPERATION, false);
}
break;
case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
switch(internalformat)
{
case GL_DEPTH32F_STENCIL8:
break;
case GL_DEPTH24_STENCIL8:
return error(GL_INVALID_OPERATION, false);
default:
UNREACHABLE(internalformat);
return error(GL_INVALID_OPERATION, false);
}
break;
default:
return error(GL_INVALID_ENUM, false);
}
return true;
}
// GL_NV_read_stencil // GL_NV_read_stencil
if(format == GL_STENCIL_INDEX_OES) if(format == GL_STENCIL_INDEX_OES)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment