mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-24 21:58:06 +00:00
Bug 1320030 - Handle program and shader object deletion differently. - r=ethlin
MozReview-Commit-ID: 4wSZ81lFP6e
This commit is contained in:
parent
406baa7c7d
commit
1f193e4f38
@ -1641,14 +1641,35 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateObject(const char* funcName, const WebGLDeletableObject& object) {
|
||||
bool ValidateObject(const char* funcName, const WebGLDeletableObject& object,
|
||||
bool isShaderOrProgram = false)
|
||||
{
|
||||
if (!ValidateObjectAllowDeleted(funcName, object))
|
||||
return false;
|
||||
|
||||
if (object.IsDeleteRequested()) {
|
||||
ErrorInvalidOperation("%s: Object argument cannot be marked for deletion.",
|
||||
if (isShaderOrProgram) {
|
||||
/* GLES 3.0.5 p45:
|
||||
* "Commands that accept shader or program object names will generate the
|
||||
* error INVALID_VALUE if the provided name is not the name of either a
|
||||
* shader or program object[.]"
|
||||
* Further, shaders and programs appear to be different from other objects,
|
||||
* in that their lifetimes are better defined. However, they also appear to
|
||||
* allow use of objects marked for deletion, and only reject
|
||||
* actually-destroyed objects.
|
||||
*/
|
||||
if (object.IsDeleted()) {
|
||||
ErrorInvalidValue("%s: Shader or program object argument cannot have been"
|
||||
" deleted.",
|
||||
funcName);
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (object.IsDeleteRequested()) {
|
||||
ErrorInvalidOperation("%s: Object argument cannot have been marked for"
|
||||
" deletion.",
|
||||
funcName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1656,6 +1677,11 @@ public:
|
||||
|
||||
////
|
||||
|
||||
bool ValidateObject(const char* funcName, const WebGLProgram& object);
|
||||
bool ValidateObject(const char* funcName, const WebGLShader& object);
|
||||
|
||||
////
|
||||
|
||||
bool ValidateIsObject(const char* funcName,
|
||||
const WebGLDeletableObject* object) const
|
||||
{
|
||||
|
@ -57,6 +57,18 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
bool
|
||||
WebGLContext::ValidateObject(const char* funcName, const WebGLProgram& object)
|
||||
{
|
||||
return ValidateObject(funcName, object, true);
|
||||
}
|
||||
|
||||
bool
|
||||
WebGLContext::ValidateObject(const char* funcName, const WebGLShader& object)
|
||||
{
|
||||
return ValidateObject(funcName, object, true);
|
||||
}
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::gfx;
|
||||
using namespace mozilla::gl;
|
||||
|
@ -49,7 +49,7 @@ private:
|
||||
explicit WebGLDeletableObject(WebGLContext* webgl)
|
||||
: WebGLContextBoundObject(webgl)
|
||||
, mDeletionStatus(Default)
|
||||
{}
|
||||
{ }
|
||||
|
||||
~WebGLDeletableObject() {
|
||||
MOZ_ASSERT(mDeletionStatus == Deleted,
|
||||
@ -149,7 +149,7 @@ private:
|
||||
nsAutoRefCnt mWebGLRefCnt;
|
||||
|
||||
public:
|
||||
WebGLRefCountedObject(WebGLContext* webgl)
|
||||
explicit WebGLRefCountedObject(WebGLContext* webgl)
|
||||
: WebGLDeletableObject(webgl)
|
||||
{ }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user