mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
b=738872; implement WebGL OES_texture_half_float; part 3 - desktop GL compat; r=jgilbert
This commit is contained in:
parent
a988bc2a34
commit
9e20208adb
@ -88,7 +88,11 @@ bool WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const
|
|||||||
case OES_texture_float_linear:
|
case OES_texture_float_linear:
|
||||||
return gl->IsSupported(GLFeature::texture_float_linear);
|
return gl->IsSupported(GLFeature::texture_float_linear);
|
||||||
case OES_texture_half_float:
|
case OES_texture_half_float:
|
||||||
return gl->IsExtensionSupported(GLContext::OES_texture_half_float);
|
// If we have Feature::texture_half_float, we must not be on ES2
|
||||||
|
// and need to translate HALF_FLOAT_OES -> HALF_FLOAT. We do that
|
||||||
|
// right before making the relevant calls.
|
||||||
|
return gl->IsExtensionSupported(GLContext::OES_texture_half_float) ||
|
||||||
|
gl->IsSupported(GLFeature::texture_half_float);
|
||||||
case OES_vertex_array_object:
|
case OES_vertex_array_object:
|
||||||
return WebGLExtensionVertexArray::IsSupported(this);
|
return WebGLExtensionVertexArray::IsSupported(this);
|
||||||
case EXT_texture_filter_anisotropic:
|
case EXT_texture_filter_anisotropic:
|
||||||
|
@ -3674,16 +3674,25 @@ GLenum WebGLContext::CheckedTexImage2D(GLenum target,
|
|||||||
type != imageInfo.Type();
|
type != imageInfo.Type();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// convert type for half float if not on GLES2
|
||||||
|
GLenum realType = type;
|
||||||
|
if (realType == LOCAL_GL_HALF_FLOAT_OES && !gl->IsGLES2()) {
|
||||||
|
realType = LOCAL_GL_HALF_FLOAT;
|
||||||
|
}
|
||||||
|
|
||||||
if (sizeMayChange) {
|
if (sizeMayChange) {
|
||||||
UpdateWebGLErrorAndClearGLError();
|
UpdateWebGLErrorAndClearGLError();
|
||||||
gl->fTexImage2D(target, level, internalFormat, width, height, border, format, type, data);
|
|
||||||
|
gl->fTexImage2D(target, level, internalFormat, width, height, border, format, realType, data);
|
||||||
|
|
||||||
GLenum error = LOCAL_GL_NO_ERROR;
|
GLenum error = LOCAL_GL_NO_ERROR;
|
||||||
UpdateWebGLErrorAndClearGLError(&error);
|
UpdateWebGLErrorAndClearGLError(&error);
|
||||||
return error;
|
return error;
|
||||||
} else {
|
|
||||||
gl->fTexImage2D(target, level, internalFormat, width, height, border, format, type, data);
|
|
||||||
return LOCAL_GL_NO_ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gl->fTexImage2D(target, level, internalFormat, width, height, border, format, realType, data);
|
||||||
|
|
||||||
|
return LOCAL_GL_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -3972,13 +3981,19 @@ WebGLContext::TexSubImage2D_base(GLenum target, GLint level,
|
|||||||
// There are checks above to ensure that this won't overflow.
|
// There are checks above to ensure that this won't overflow.
|
||||||
size_t dstStride = RoundedToNextMultipleOf(dstPlainRowSize, mPixelStoreUnpackAlignment).value();
|
size_t dstStride = RoundedToNextMultipleOf(dstPlainRowSize, mPixelStoreUnpackAlignment).value();
|
||||||
|
|
||||||
|
// convert type for half float if not on GLES2
|
||||||
|
GLenum realType = type;
|
||||||
|
if (realType == LOCAL_GL_HALF_FLOAT_OES && !gl->IsGLES2()) {
|
||||||
|
realType = LOCAL_GL_HALF_FLOAT;
|
||||||
|
}
|
||||||
|
|
||||||
if (actualSrcFormat == dstFormat &&
|
if (actualSrcFormat == dstFormat &&
|
||||||
srcPremultiplied == mPixelStorePremultiplyAlpha &&
|
srcPremultiplied == mPixelStorePremultiplyAlpha &&
|
||||||
srcStride == dstStride &&
|
srcStride == dstStride &&
|
||||||
!mPixelStoreFlipY)
|
!mPixelStoreFlipY)
|
||||||
{
|
{
|
||||||
// no conversion, no flipping, so we avoid copying anything and just pass the source pointer
|
// no conversion, no flipping, so we avoid copying anything and just pass the source pointer
|
||||||
gl->fTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
|
gl->fTexSubImage2D(target, level, xoffset, yoffset, width, height, format, realType, pixels);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3989,7 +4004,7 @@ WebGLContext::TexSubImage2D_base(GLenum target, GLint level,
|
|||||||
actualSrcFormat, srcPremultiplied,
|
actualSrcFormat, srcPremultiplied,
|
||||||
dstFormat, mPixelStorePremultiplyAlpha, dstTexelSize);
|
dstFormat, mPixelStorePremultiplyAlpha, dstTexelSize);
|
||||||
|
|
||||||
gl->fTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, convertedData);
|
gl->fTexSubImage2D(target, level, xoffset, yoffset, width, height, format, realType, convertedData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ public:
|
|||||||
static const size_t sMinDrawBuffers = 4;
|
static const size_t sMinDrawBuffers = 4;
|
||||||
/*
|
/*
|
||||||
WEBGL_draw_buffers does not give a minal value for GL_MAX_DRAW_BUFFERS. But, we request
|
WEBGL_draw_buffers does not give a minal value for GL_MAX_DRAW_BUFFERS. But, we request
|
||||||
for GL_MAX_DRAW_BUFFERS = 4 at least to be able to use all requested color attachements.
|
for GL_MAX_DRAW_BUFFERS = 4 at least to be able to use all requested color attachments.
|
||||||
See DrawBuffersWEBGL in WebGLExtensionDrawBuffers.cpp inner comments for more informations.
|
See DrawBuffersWEBGL in WebGLExtensionDrawBuffers.cpp inner comments for more informations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user