Hi Ken,

I've just hacked through it!! 
Turns out that things just got a little bit complicated after the 
"ES31ForTesting" context was added.

The final list of hacks:

* In gpu/command_buffer/services/gl_utils.cc
In PopulateNumericCapabilities():
Skip IsES31ForTestingContext check. Always set "minor_version" to 1

* In gpu/command_buffer/services/service_utils.cc
In GenerateGLContextAttribs():
Changing "client_minor_es_version" from 0 to 1.

* In gpu/command_buffer/services/gles2_cmd_decoder.cc
In GetCapabilities():
Changing " minor_version " from 0 to 1.

* In gpu/command_buffer/services/gles2_cmd_decoder_passthrough_handlers.cc
and 
gpu/command_buffer/services/gles2_cmd_decoder_passthrough_handlers_autogen.cc 
Skip all "if(!IsES31ForTestingContext ())" checks.
Commented out all of them because not sure how to run 
"build_cmd_buffer_lib.py".

Thanks.

Fei

On Tuesday, May 17, 2022 at 1:48:03 AM UTC+8 杨飞 wrote:

> Hi Ken,
>
> Thanks for answering.
>
> I haven't given up on this yet. But there's something really difficult for 
> me to get through.
>
> To make it clear, I'm not attempting to bring back the dropped "WebGL2 
> compute" feature. 
> Instead, I just want to enable an underlying GLES3.1 context (powered by 
> ANGLE), so that I can use it in my own fork of Chromium, internally in C++ 
> code.
> Therefore, it won't envolve exposing any addition APIs to JavaScript. It's 
> just about the context creation.
>
> I made some progress by doing to following hacks:
>
> * In gpu/command_buffer/client/implementation_base.cc
> Forcing the capabilites to version 3.1 by:
> In constructor ImplementationBase::ImplementationBase():
>
> if (capabilities_.major_version == 3)
> {
>       capabilities_.minor_version = 1;
>       capabilities_.max_shader_storage_buffer_bindings = 32768;
>  }
>
> * In gpu/command_buffer/services/service_utils.cc
> In GenerateGLContextAttribs():
> Changing "client_minor_es_version" from 0 to 1.
>
> Currently, I'm able to compile a compute shader, creating and binding 
> SSBOs, 
> but it still crashes when I call GLES2Interface::DispatchCompute() to 
> launch a compute shader. (STATUS_ACCESS_VIOLATION)
>
> I feel I still hadn't found the correct places where the GLES context 
> creation is happening, where Blink tells ANGLE which GLES version to use.
>
> I'll really appreciate you if you point me to the correct place to look 
> at. The source code is just too Huge.
>
> Thanks!!
>
> Fei
>
> On Tuesday, May 10, 2022 at 5:44:31 AM UTC+8 Kenneth Russell wrote:
>
>> Hi Fei,
>>
>> Several years ago there was much discussion about which direction to take 
>> web graphics standards - either continue to extend WebGL toward OpenGL ES 
>> 3.1/3.2, or pursue the new family of low-level explicit graphics APIs 
>> (D3D12/Metal/Vulkan). After much investigation it was decided to leave the 
>> legacy behind and pursue a new standard, WebGPU. There is a tremendous 
>> amount of cross-industry momentum behind WebGPU; the first version, and 
>> implementations, will ship later this year.
>>
>> I recommend you abandon the course of trying to get an OpenGL ES 3.1 
>> JavaScript binding in Chromium, and instead see whether you can achieve 
>> what you want using the existing WebGPU implementation in Chromium, as well 
>> as Dawn, Chromium's native implementation of the API.
>>
>> https://gpuweb.github.io/gpuweb/
>> https://gpuweb.github.io/gpuweb/explainer/
>> https://dawn.googlesource.com/dawn/
>>
>> Best,
>>
>> -Ken
>>
>>
>>
>> On Mon, May 9, 2022 at 5:02 AM 杨飞 <[email protected]> wrote:
>>
>>> Hi everyone.
>>>
>>> I've asked a similar question in chromium-dev, then I realized here 
>>> might be the better place to ask.
>>>
>>> I'm trying to hack Blink (in Chromium) to embed a native 3D rendering 
>>> engine behind Chromium. In addtion, I want it to shared the same context as 
>>> the WebGL2 context of a Canvas.
>>>
>>> The problem is that OpenGL ES 3.1 features are disabled by default. For 
>>> example, when I try to call GLES2Interface::CreateShader with 
>>> GL_COMPUTE_SHADER, I got "GL_INVALID_ENUM: OpenGL ES 3.1 Required". That 
>>> basically means, the features of GLES2Interface are the same as those 
>>> already exposed as WebGL. 
>>>
>>> I therefore wonder, is there an easy way to enable the OpenGL ES 3.1 
>>> features during Chromium building? Maybe using some gn args? 
>>>
>>> Here is my project (without involving Chromium): 
>>> https://github.com/fynv/Three.V8
>>>
>>> The whole purpose of the attempt is to try to utilize the native OpenGL 
>>> features which are not exposed through WebGL. But it looks like, if the 
>>> GLES 3.1 features are enabled in 
>>> GLES2Interface, they will also be exposed to WebGL. Is that the case?
>>>
>>> Thanks
>>>
>>> Fei
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "blink-dev" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To view this discussion on the web visit 
>>> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/7ce0a611-68b0-4433-9dbb-7af6f8d74a6dn%40chromium.org
>>>  
>>> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/7ce0a611-68b0-4433-9dbb-7af6f8d74a6dn%40chromium.org?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/f7fbefb6-9304-43cc-8610-08487e950690n%40chromium.org.

Reply via email to