Closed
Bug 686732
Opened 14 years ago
Closed 14 years ago
Implement minimal-capabilities WebGL mode
Categories
(Core :: Graphics: CanvasWebGL, defect)
Core
Graphics: CanvasWebGL
Tracking
()
RESOLVED
FIXED
mozilla10
People
(Reporter: bjacob, Assigned: posidron)
Details
(Keywords: dev-doc-complete)
Attachments
(1 file, 2 obsolete files)
16.17 KB,
patch
|
bjacob
:
review+
|
Details | Diff | Splinter Review |
Would be nice to allow webdevs to ensure that their WebGL page will work everywhere.
In this mode all capabilities like MAX_TEXTURE_SIZE should be set to the minimum allowed value as per the spec,
http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf
section 6.2 State Tables.
Also this mode should disable all WebGL extensions.
The code to change is in content/canvas/src, especially InitAndValidateGL in WebGLContextValidate.cpp, and the patch would do something like
PRBool restricted_minimal_mode =
Preferences::GetBool("webgl.restricted_minimal_mode", PR_FALSE);
if (restricted_minimal_mode) {
mGLMaxTextureSize = 64;
} else {
gl->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &mGLMaxTextureSize);
}
Also, to disable extensions, you could edit WebGLContext::GetExtension, I think if you return NS_OK right away with *retval=null then it will prevent any extension from getting enabled. And you want to edit WebGLContext::GetSupportedExtensions too to avoid advertising any extension.
Assignee | ||
Updated•14 years ago
|
Assignee: nobody → cdiehl
Assignee | ||
Comment 1•14 years ago
|
||
Implements minimum capability mode in WebGL.
Benoit, latest review + changes compiled without errors but please verify again and let me know what you think and what could be changed/added. :-)
Attachment #560471 -
Flags: review?(bjacob)
Reporter | ||
Comment 2•14 years ago
|
||
Sorry for the long delay replying. Your patch is really perfect by itself, but I realize now that some of the min values from the spec are so low that all pages are going to fail in this mode, so I now think that instead of sticking stricly to the min values from the spec, we should sometimes instead follow what is supported by all the hardware around. Specifically, I think that these three min values:
+#define MINVALUE_GL_MAX_TEXTURE_SIZE 64 // Page 162
+#define MINVALUE_GL_MAX_CUBE_MAP_TEXTURE_SIZE 16 // Page 162
+#define MINVALUE_GL_MAX_RENDERBUFFER_SIZE 1 // Page 164
are the ones that we need to change to match the real world. I propose these values instead:
+#define MINVALUE_GL_MAX_TEXTURE_SIZE 1024
+#define MINVALUE_GL_MAX_CUBE_MAP_TEXTURE_SIZE 512
+#define MINVALUE_GL_MAX_RENDERBUFFER_SIZE 1024
Please update the comments to explain what the min values from the spec are (64, 16, 1) and why we're not using them (they're too stupidly low, all the hardware supports much higher values).
Assignee | ||
Comment 3•14 years ago
|
||
(In reply to Benoit Jacob [:bjacob] from comment #2)
> +#define MINVALUE_GL_MAX_TEXTURE_SIZE 1024
> +#define MINVALUE_GL_MAX_CUBE_MAP_TEXTURE_SIZE 512
> +#define MINVALUE_GL_MAX_RENDERBUFFER_SIZE 1024
I have attached a new version with your recommendations.
> Please update the comments to explain what the min values from the spec are
> (64, 16, 1) and why we're not using them (they're too stupidly low, all the
> hardware supports much higher values).
Those are the minimum values of TEXTURE_SIZE, CUBE_MAP_TEXTURE_SIZE, RENDERBUFFER_SIZE, which are defined in the specification on page 162 and 164.
Attachment #564258 -
Flags: review?(bjacob)
Reporter | ||
Comment 4•14 years ago
|
||
Comment on attachment 564258 [details] [diff] [review]
Implement minimum capability mode in WebGL
Review of attachment 564258 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good, thanks!
Attachment #564258 -
Flags: review?(bjacob) → review+
Reporter | ||
Updated•14 years ago
|
Attachment #560471 -
Attachment is obsolete: true
Attachment #560471 -
Flags: review?(bjacob)
Reporter | ||
Comment 5•14 years ago
|
||
Comment on attachment 564258 [details] [diff] [review]
Implement minimum capability mode in WebGL
Review of attachment 564258 [details] [diff] [review]:
-----------------------------------------------------------------
I've been too quick to review this! It had a really nasty typo. Thankfully a conformance test caught it.
::: content/canvas/src/WebGLContextValidate.cpp
@@ +609,5 @@
> + // On the public_webgl list, "problematic GetParameter pnames" thread, the following formula was given:
> + // mGLMaxVaryingVectors = min (GL_MAX_VERTEX_OUTPUT_COMPONENTS, GL_MAX_FRAGMENT_INPUT_COMPONENTS) / 4
> + GLint maxVertexOutputComponents,
> + minFragmentInputComponents;
> + gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_OUTPUT_COMPONENTS, &mGLMaxVertexUniformVectors);
This typo here (mGLMaxVertexUniformVectors instead of maxVertexOutputComponents) took me a while to debug! it was causing failures in gl-get-calls.html.
Assignee | ||
Comment 6•14 years ago
|
||
Corrected in the following patch. I have no idea why I touched this code, I am sorry!
Attachment #564258 -
Attachment is obsolete: true
Attachment #566727 -
Flags: review?(bjacob)
Reporter | ||
Comment 7•14 years ago
|
||
Comment on attachment 566727 [details] [diff] [review]
Implement minimum capability mode in WebGL
This is on tryserver already:
https://tbpl.mozilla.org/?tree=Try&rev=ce4f36d45d7a
Attachment #566727 -
Flags: review?(bjacob) → review+
Reporter | ||
Comment 8•14 years ago
|
||
Reporter | ||
Comment 9•14 years ago
|
||
pushed to inbound:
http://hg.mozilla.org/integration/mozilla-inbound/rev/7170a4b7a58d
congrats!
Assignee | ||
Comment 10•14 years ago
|
||
Wow, this is very exiting! Thanks for your support Benoit!
Comment 11•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
Updated•14 years ago
|
Keywords: dev-doc-needed
Comment 12•14 years ago
|
||
Documented:
https://developer.mozilla.org/en/WebGL#WebGL_debugging_and_testing
Firefox 10 for developers updated.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•