Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit abaeb41

Browse files
mspangCommit Bot
authored andcommitted
Vulkan: Fix setupDraw when VK_EXT_transform_feedback is not enabled
There's no dirty bit handler if VK_EXT_transform_feedback disabled, but we're setting that dirty bit in syncState. This results in calling a null method pointer. Skip the invalidate if the extension is not enabled. gl::LogMessage::~LogMessage() at ./../../third_party/angle/src/common/debug.cpp:0 rx::ContextVk::setupDraw(gl::Context const*, gl::PrimitiveMode, int, int, int, gl::DrawElementsType, void const*, angle::BitSetT<11ul, unsigned long, unsigned long>, rx::vk::priv::SecondaryCommandBuffer**) at ./../../third_party/angle/src/libANGLE/renderer/vulkan/ContextVk.cpp:844 rx::ContextVk::drawArrays(gl::Context const*, gl::PrimitiveMode, int, int) at ./../../third_party/angle/src/libANGLE/renderer/vulkan/ContextVk.cpp:1698 gl::Context::drawArrays(gl::PrimitiveMode, int, int) at ./../../third_party/angle/src/libANGLE/Context.inl.h:112 gl::DrawArrays(unsigned int, int, int) at ./../../third_party/angle/src/libGLESv2/entry_points_gles_2_0_autogen.cpp:926 (anonymous namespace)::AttributeLayoutNonIndexed::Draw(int, unsigned int, unsigned short const*) at ./../../third_party/angle/src/tests/gl_tests/AttributeLayoutTest.cpp:431 (anonymous namespace)::AttributeLayoutTest::Run(bool) at ./../../third_party/angle/src/tests/gl_tests/AttributeLayoutTest.cpp:305 [This stack is from the added assert; calling a null function pointer crashes without producing a useful stack trace.] Bug: angleproject:4326 Change-Id: I036ae322bddc4865229fa3fe7ea72a4344b99f83 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2011408 Commit-Queue: Michael Spang <spang@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org>
1 parent 13881af commit abaeb41

File tree

6 files changed

+34
-3
lines changed

6 files changed

+34
-3
lines changed

src/libANGLE/renderer/vulkan/ContextVk.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,7 @@ angle::Result ContextVk::setupDraw(const gl::Context *context,
841841
// Flush any relevant dirty bits.
842842
for (size_t dirtyBit : dirtyBits)
843843
{
844+
ASSERT(mGraphicsDirtyBitHandlers[dirtyBit]);
844845
ANGLE_TRY((this->*mGraphicsDirtyBitHandlers[dirtyBit])(context, *commandBufferOut));
845846
}
846847

@@ -1026,6 +1027,7 @@ angle::Result ContextVk::setupDispatch(const gl::Context *context,
10261027
// Flush any relevant dirty bits.
10271028
for (size_t dirtyBit : dirtyBits)
10281029
{
1030+
ASSERT(mComputeDirtyBitHandlers[dirtyBit]);
10291031
ANGLE_TRY((this->*mComputeDirtyBitHandlers[dirtyBit])(context, *commandBufferOut));
10301032
}
10311033

@@ -2749,7 +2751,10 @@ void ContextVk::onDrawFramebufferChange(FramebufferVk *framebufferVk)
27492751

27502752
void ContextVk::invalidateCurrentTransformFeedbackBuffers()
27512753
{
2752-
mGraphicsDirtyBits.set(DIRTY_BIT_TRANSFORM_FEEDBACK_BUFFERS);
2754+
if (getFeatures().supportsTransformFeedbackExtension.enabled)
2755+
{
2756+
mGraphicsDirtyBits.set(DIRTY_BIT_TRANSFORM_FEEDBACK_BUFFERS);
2757+
}
27532758
if (getFeatures().emulateTransformFeedback.enabled)
27542759
{
27552760
mGraphicsDirtyBits.set(DIRTY_BIT_DESCRIPTOR_SETS);

src/tests/gl_tests/DrawBuffersTest.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,10 @@ TEST_P(DrawBuffersTestES3, 2DArrayTextures)
641641

642642
// Use this to select which configurations (e.g. which renderer, which GLES major version) these
643643
// tests should be run against.
644-
ANGLE_INSTANTIATE_TEST_ES2_AND_ES3(DrawBuffersTest);
645-
644+
ANGLE_INSTANTIATE_TEST(DrawBuffersTest,
645+
ANGLE_ALL_TEST_PLATFORMS_ES2,
646+
ANGLE_ALL_TEST_PLATFORMS_ES3,
647+
WithNoTransformFeedback(ES2_VULKAN()));
646648
ANGLE_INSTANTIATE_TEST_ES3(DrawBuffersWebGL2Test);
647649

648650
ANGLE_INSTANTIATE_TEST_ES3(DrawBuffersTestES3);

src/tests/test_utils/angle_test_configs.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,15 @@ std::ostream &operator<<(std::ostream &stream, const PlatformParameters &pp)
196196
stream << "_CommandGraph";
197197
}
198198

199+
if (pp.eglParameters.transformFeedbackFeature == EGL_FALSE)
200+
{
201+
stream << "_NoTransformFeedback";
202+
}
203+
else if (pp.eglParameters.transformFeedbackFeature == EGL_TRUE)
204+
{
205+
stream << "_TransformFeedback";
206+
}
207+
199208
return stream;
200209
}
201210

src/tests/test_utils/angle_test_configs.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,14 @@ inline PlatformParameters WithNoCommandGraph(const PlatformParameters &params)
213213
withNoCommandGraph.eglParameters.commandGraphFeature = EGL_FALSE;
214214
return withNoCommandGraph;
215215
}
216+
217+
inline PlatformParameters WithNoTransformFeedback(const PlatformParameters &params)
218+
{
219+
PlatformParameters withNoTransformFeedback = params;
220+
withNoTransformFeedback.eglParameters.transformFeedbackFeature = EGL_FALSE;
221+
return withNoTransformFeedback;
222+
}
223+
216224
} // namespace angle
217225

218226
#endif // ANGLE_TEST_CONFIGS_H_

util/EGLPlatformParameters.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ struct EGLPlatformParameters
5959
EGLint debugLayersEnabled = EGL_DONT_CARE;
6060
EGLint contextVirtualization = EGL_DONT_CARE;
6161
EGLint commandGraphFeature = EGL_DONT_CARE;
62+
EGLint transformFeedbackFeature = EGL_DONT_CARE;
6263
angle::PlatformMethods *platformMethods = nullptr;
6364
};
6465

util/EGLWindow.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,12 @@ bool EGLWindow::initializeDisplay(OSWindow *osWindow,
182182
disabledFeatureOverrides.push_back("command_graph");
183183
}
184184

185+
if (params.transformFeedbackFeature == EGL_FALSE)
186+
{
187+
disabledFeatureOverrides.push_back("supports_transform_feedback_extension");
188+
disabledFeatureOverrides.push_back("emulate_transform_feedback");
189+
}
190+
185191
if (!disabledFeatureOverrides.empty())
186192
{
187193
if (strstr(extensionString, "EGL_ANGLE_feature_control") == nullptr)

0 commit comments

Comments
 (0)