diff --git a/src/client/graphics/webgl_context.cpp b/src/client/graphics/webgl_context.cpp index 9e60d485b..e0612b709 100644 --- a/src/client/graphics/webgl_context.cpp +++ b/src/client/graphics/webgl_context.cpp @@ -1639,6 +1639,7 @@ namespace endor maxVertexUniformBlocks = initResp->maxVertexUniformBlocks; maxVertexUniformComponents = initResp->maxVertexUniformComponents; minProgramTexelOffset = initResp->minProgramTexelOffset; + uniformBufferOffsetAlignment = 1; // Will be queried on first access maxClientWaitTimeout = initResp->maxClientWaitTimeout; maxCombinedFragmentUniformComponents = initResp->maxCombinedFragmentUniformComponents; maxCombinedVertexUniformComponents = initResp->maxCombinedVertexUniformComponents; @@ -2023,6 +2024,22 @@ namespace endor return maxUniformBlockSize; else if (pname == WebGL2IntegerParameterName::kMaxTextureLodBias) return maxTextureLODBias; + else if (pname == WebGL2IntegerParameterName::kUniformBufferOffsetAlignment) + { + // Query once and cache + if (uniformBufferOffsetAlignment == 1) + { + auto req = GetIntegervCommandBufferRequest(static_cast(pname)); + sendCommandBufferRequest(req, true); + auto resp = recvResponse(COMMAND_BUFFER_GET_INTEGERV_RES, req); + if (resp != nullptr) + { + uniformBufferOffsetAlignment = resp->value; + delete resp; + } + } + return uniformBufferOffsetAlignment; + } else if (pname == WebGL2IntegerParameterName::kExtMaxViewsOvr) return OVR_maxViews; @@ -2038,6 +2055,22 @@ namespace endor return v; } + bool WebGL2Context::getParameterV2(WebGL2BooleanParameterName pname) + { + auto req = GetBooleanvCommandBufferRequest(static_cast(pname)); + sendCommandBufferRequest(req, true); + + auto resp = recvResponse(COMMAND_BUFFER_GET_BOOLEANV_RES, req); + if (resp == nullptr) [[unlikely]] + { + string msg = "Failed to get boolean parameter(" + to_string(static_cast(pname)) + "): timeout."; + throw runtime_error(msg); + } + auto v = resp->value; + delete resp; + return v; + } + shared_ptr WebGL2Context::getQuery(WebGLQueryTarget target, int pname) { NOT_IMPLEMENTED(); diff --git a/src/client/graphics/webgl_context.hpp b/src/client/graphics/webgl_context.hpp index 32567de43..8acf0548f 100644 --- a/src/client/graphics/webgl_context.hpp +++ b/src/client/graphics/webgl_context.hpp @@ -96,6 +96,8 @@ namespace endor kDepthWrite = WEBGL_DEPTH_WRITEMASK, kDither = WEBGL_DITHER, kPolygonOffsetFill = WEBGL_POLYGON_OFFSET_FILL, + kSampleAlphaToCoverage = WEBGL_SAMPLE_ALPHA_TO_COVERAGE, + kSampleCoverage = WEBGL_SAMPLE_COVERAGE, kSampleCoverageInvert = WEBGL_SAMPLE_COVERAGE_INVERT, kScissorTest = WEBGL_SCISSOR_TEST, kStencilTest = WEBGL_STENCIL_TEST, @@ -186,6 +188,11 @@ namespace endor kVersion = WEBGL_VERSION, }; + enum class WebGL2BooleanParameterName + { + kRasterizerDiscard = WEBGL2_RASTERIZER_DISCARD, + }; + enum class WebGL2IntegerParameterName { kMax3DTextureSize = WEBGL2_MAX_3D_TEXTURE_SIZE, @@ -216,6 +223,7 @@ namespace endor kMaxServerWaitTimeout = WEBGL2_MAX_SERVER_WAIT_TIMEOUT, kMaxUniformBlockSize = WEBGL2_MAX_UNIFORM_BLOCK_SIZE, kMaxTextureLodBias = WEBGL2_MAX_TEXTURE_LOD_BIAS, + kUniformBufferOffsetAlignment = WEBGL2_UNIFORM_BUFFER_OFFSET_ALIGNMENT, kExtMaxViewsOvr = WEBGL2_EXT_MAX_VIEWS_OVR, }; @@ -917,6 +925,7 @@ namespace endor std::optional length = std::nullopt); int getFragDataLocation(std::shared_ptr program, const std::string &name); int getParameterV2(WebGL2IntegerParameterName pname); + bool getParameterV2(WebGL2BooleanParameterName pname); std::shared_ptr getQuery(WebGLQueryTarget target, int pname); int getUniformBlockIndex(std::shared_ptr program, const std::string &uniformBlockName); @@ -1020,6 +1029,7 @@ namespace endor int maxVertexUniformBlocks; int maxVertexUniformComponents; int minProgramTexelOffset; + int uniformBufferOffsetAlignment; int64_t maxClientWaitTimeout; int64_t maxCombinedFragmentUniformComponents; int64_t maxCombinedVertexUniformComponents; diff --git a/src/client/script_bindings/webgl/active_info.cpp b/src/client/script_bindings/webgl/active_info.cpp index c0f9d3e81..803ffe763 100644 --- a/src/client/script_bindings/webgl/active_info.cpp +++ b/src/client/script_bindings/webgl/active_info.cpp @@ -60,5 +60,5 @@ namespace endor } } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor diff --git a/src/client/script_bindings/webgl/active_info.hpp b/src/client/script_bindings/webgl/active_info.hpp index b125c893c..c2d6c9080 100644 --- a/src/client/script_bindings/webgl/active_info.hpp +++ b/src/client/script_bindings/webgl/active_info.hpp @@ -38,5 +38,5 @@ namespace endor }; } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor \ No newline at end of file diff --git a/src/client/script_bindings/webgl/framebuffer.cpp b/src/client/script_bindings/webgl/framebuffer.cpp index dbe790869..d38e0687c 100644 --- a/src/client/script_bindings/webgl/framebuffer.cpp +++ b/src/client/script_bindings/webgl/framebuffer.cpp @@ -31,5 +31,5 @@ namespace endor { } } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor \ No newline at end of file diff --git a/src/client/script_bindings/webgl/framebuffer.hpp b/src/client/script_bindings/webgl/framebuffer.hpp index c54189e65..fd3ab4ec2 100644 --- a/src/client/script_bindings/webgl/framebuffer.hpp +++ b/src/client/script_bindings/webgl/framebuffer.hpp @@ -37,5 +37,5 @@ namespace endor }; } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor diff --git a/src/client/script_bindings/webgl/object.cpp b/src/client/script_bindings/webgl/object.cpp index b03f846b5..78779213d 100644 --- a/src/client/script_bindings/webgl/object.cpp +++ b/src/client/script_bindings/webgl/object.cpp @@ -28,5 +28,5 @@ namespace endor // WebGLObject is a base class, typically not instantiated directly } } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor diff --git a/src/client/script_bindings/webgl/object.hpp b/src/client/script_bindings/webgl/object.hpp index cd48b93ae..f69bb78c8 100644 --- a/src/client/script_bindings/webgl/object.hpp +++ b/src/client/script_bindings/webgl/object.hpp @@ -45,5 +45,5 @@ namespace endor }; } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor \ No newline at end of file diff --git a/src/client/script_bindings/webgl/program.cpp b/src/client/script_bindings/webgl/program.cpp index e4a68a6f8..8c21d7e26 100644 --- a/src/client/script_bindings/webgl/program.cpp +++ b/src/client/script_bindings/webgl/program.cpp @@ -20,5 +20,5 @@ namespace endor } } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor \ No newline at end of file diff --git a/src/client/script_bindings/webgl/program.hpp b/src/client/script_bindings/webgl/program.hpp index ede29c134..0971e7271 100644 --- a/src/client/script_bindings/webgl/program.hpp +++ b/src/client/script_bindings/webgl/program.hpp @@ -32,5 +32,5 @@ namespace endor WebGLProgram(v8::Isolate *isolate, const v8::FunctionCallbackInfo &args); }; } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor diff --git a/src/client/script_bindings/webgl/renderbuffer.cpp b/src/client/script_bindings/webgl/renderbuffer.cpp index 7f512b63d..d858602e8 100644 --- a/src/client/script_bindings/webgl/renderbuffer.cpp +++ b/src/client/script_bindings/webgl/renderbuffer.cpp @@ -19,5 +19,5 @@ namespace endor // WebGLRenderbuffer objects are created by WebGL context, not by user code } } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor diff --git a/src/client/script_bindings/webgl/renderbuffer.hpp b/src/client/script_bindings/webgl/renderbuffer.hpp index a9651c800..581ff1b2e 100644 --- a/src/client/script_bindings/webgl/renderbuffer.hpp +++ b/src/client/script_bindings/webgl/renderbuffer.hpp @@ -33,5 +33,5 @@ namespace endor }; } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor \ No newline at end of file diff --git a/src/client/script_bindings/webgl/texture.cpp b/src/client/script_bindings/webgl/texture.cpp index 3b51f5dfa..3d034839c 100644 --- a/src/client/script_bindings/webgl/texture.cpp +++ b/src/client/script_bindings/webgl/texture.cpp @@ -27,5 +27,5 @@ namespace endor { } } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor diff --git a/src/client/script_bindings/webgl/texture.hpp b/src/client/script_bindings/webgl/texture.hpp index b40acad08..9272d305c 100644 --- a/src/client/script_bindings/webgl/texture.hpp +++ b/src/client/script_bindings/webgl/texture.hpp @@ -45,5 +45,5 @@ namespace endor }; } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor \ No newline at end of file diff --git a/src/client/script_bindings/webgl/uniform_location.cpp b/src/client/script_bindings/webgl/uniform_location.cpp index 597a73e97..ce71bd5d6 100644 --- a/src/client/script_bindings/webgl/uniform_location.cpp +++ b/src/client/script_bindings/webgl/uniform_location.cpp @@ -47,5 +47,5 @@ namespace endor } } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor diff --git a/src/client/script_bindings/webgl/uniform_location.hpp b/src/client/script_bindings/webgl/uniform_location.hpp index a5e7de1f2..a1f98b66d 100644 --- a/src/client/script_bindings/webgl/uniform_location.hpp +++ b/src/client/script_bindings/webgl/uniform_location.hpp @@ -44,5 +44,5 @@ namespace endor }; } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor \ No newline at end of file diff --git a/src/client/script_bindings/webgl/vertex_array.cpp b/src/client/script_bindings/webgl/vertex_array.cpp index 3e6ed5f0a..48e8e644b 100644 --- a/src/client/script_bindings/webgl/vertex_array.cpp +++ b/src/client/script_bindings/webgl/vertex_array.cpp @@ -20,5 +20,5 @@ namespace endor { } } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor diff --git a/src/client/script_bindings/webgl/vertex_array.hpp b/src/client/script_bindings/webgl/vertex_array.hpp index 7ba162aa3..a4a03cc1d 100644 --- a/src/client/script_bindings/webgl/vertex_array.hpp +++ b/src/client/script_bindings/webgl/vertex_array.hpp @@ -33,5 +33,5 @@ namespace endor }; } // namespace webgl - } // namespace script_bindings + } // namespace script_bindings } // namespace endor \ No newline at end of file diff --git a/src/client/script_bindings/webgl/webgl_rendering_context.cpp b/src/client/script_bindings/webgl/webgl_rendering_context.cpp index 7c9351388..daae9578d 100644 --- a/src/client/script_bindings/webgl/webgl_rendering_context.cpp +++ b/src/client/script_bindings/webgl/webgl_rendering_context.cpp @@ -4348,6 +4348,8 @@ namespace endor case WEBGL_DEPTH_WRITEMASK: case WEBGL_DITHER: case WEBGL_POLYGON_OFFSET_FILL: + case WEBGL_SAMPLE_ALPHA_TO_COVERAGE: + case WEBGL_SAMPLE_COVERAGE: case WEBGL_SAMPLE_COVERAGE_INVERT: case WEBGL_SCISSOR_TEST: case WEBGL_STENCIL_TEST: @@ -4395,6 +4397,7 @@ namespace endor { switch (pname) { + case WEBGL2_MAX_3D_TEXTURE_SIZE: case WEBGL2_MAX_ARRAY_TEXTURE_LAYERS: case WEBGL2_MAX_COLOR_ATTACHMENTS: case WEBGL2_MAX_COMBINED_UNIFORM_BLOCKS: @@ -4422,6 +4425,7 @@ namespace endor case WEBGL2_MAX_SERVER_WAIT_TIMEOUT: case WEBGL2_MAX_UNIFORM_BLOCK_SIZE: case WEBGL2_MAX_TEXTURE_LOD_BIAS: + case WEBGL2_UNIFORM_BUFFER_OFFSET_ALIGNMENT: case WEBGL2_EXT_MAX_VIEWS_OVR: { auto value = handle() @@ -4429,6 +4433,13 @@ namespace endor jsValue = Integer::New(isolate, value); break; } + case WEBGL2_RASTERIZER_DISCARD: + { + jsValue = Boolean::New(isolate, + handle() + ->getParameterV2(static_cast(pname))); + break; + } default: break; }