mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1563076 - Forbid BeginTransformFeedback with a buffer bound to multiple indices. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D36688 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
1a58163ed7
commit
4a5a04abc8
@ -1096,6 +1096,9 @@ class WebGLContext : public nsICanvasRenderingContextInternal,
|
||||
|
||||
// -
|
||||
|
||||
void GenErrorIllegalUse(GLenum useTarget, uint32_t useId, GLenum boundTarget,
|
||||
uint32_t boundId) const;
|
||||
|
||||
bool ValidateBufferForNonTf(const WebGLBuffer&, GLenum nonTfTarget,
|
||||
uint32_t nonTfId) const;
|
||||
|
||||
|
@ -202,10 +202,10 @@ bool WebGLContext::ValidateStencilParamsForDrawCall() const {
|
||||
|
||||
// -
|
||||
|
||||
static void GenErrorIllegalUse(const WebGLContext& webgl,
|
||||
const GLenum useTarget, const uint32_t useId,
|
||||
const GLenum boundTarget,
|
||||
const uint32_t boundId) {
|
||||
void WebGLContext::GenErrorIllegalUse(const GLenum useTarget,
|
||||
const uint32_t useId,
|
||||
const GLenum boundTarget,
|
||||
const uint32_t boundId) const {
|
||||
const auto fnName = [&](const GLenum target, const uint32_t id) {
|
||||
auto name = nsCString(EnumString(target).c_str());
|
||||
if (id != static_cast<uint32_t>(-1)) {
|
||||
@ -215,10 +215,10 @@ static void GenErrorIllegalUse(const WebGLContext& webgl,
|
||||
};
|
||||
const auto& useName = fnName(useTarget, useId);
|
||||
const auto& boundName = fnName(boundTarget, boundId);
|
||||
webgl.GenerateError(LOCAL_GL_INVALID_OPERATION,
|
||||
"Illegal use of buffer at %s"
|
||||
" while also bound to %s.",
|
||||
useName.BeginReading(), boundName.BeginReading());
|
||||
GenerateError(LOCAL_GL_INVALID_OPERATION,
|
||||
"Illegal use of buffer at %s"
|
||||
" while also bound to %s.",
|
||||
useName.BeginReading(), boundName.BeginReading());
|
||||
}
|
||||
|
||||
bool WebGLContext::ValidateBufferForNonTf(const WebGLBuffer& nonTfBuffer,
|
||||
@ -236,7 +236,7 @@ bool WebGLContext::ValidateBufferForNonTf(const WebGLBuffer& nonTfBuffer,
|
||||
const auto& tfBuffer = tfAttribs[tfId].mBufferBinding;
|
||||
if (&nonTfBuffer == tfBuffer) {
|
||||
dupe = true;
|
||||
GenErrorIllegalUse(*this, nonTfTarget, nonTfId,
|
||||
GenErrorIllegalUse(nonTfTarget, nonTfId,
|
||||
LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER, tfId);
|
||||
}
|
||||
}
|
||||
@ -285,7 +285,7 @@ bool WebGLContext::ValidateBuffersForTf(
|
||||
for (const auto& tf : tfBuffers) {
|
||||
if (nonTf && tf.buffer == nonTf) {
|
||||
dupe = true;
|
||||
GenErrorIllegalUse(*this, LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER, tf.id,
|
||||
GenErrorIllegalUse(LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER, tf.id,
|
||||
nonTfTarget, nonTfId);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "GLContext.h"
|
||||
#include "mozilla/dom/WebGL2RenderingContextBinding.h"
|
||||
#include "mozilla/IntegerRange.h"
|
||||
#include "WebGL2Context.h"
|
||||
#include "WebGLProgram.h"
|
||||
|
||||
@ -73,6 +74,16 @@ void WebGLTransformFeedback::BeginTransformFeedback(GLenum primMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto iBound : IntegerRange(mIndexedBindings.size())) {
|
||||
const auto& bound = mIndexedBindings[iBound].mBufferBinding.get();
|
||||
if (iBound != i && buffer == bound) {
|
||||
mContext->GenErrorIllegalUse(
|
||||
LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER, static_cast<uint32_t>(i),
|
||||
LOCAL_GL_TRANSFORM_FEEDBACK_BUFFER, static_cast<uint32_t>(iBound));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const size_t vertCapacity = buffer->ByteLength() / 4 / componentsPerVert;
|
||||
minVertCapacity = std::min(minVertCapacity, vertCapacity);
|
||||
}
|
||||
|
@ -7381,8 +7381,6 @@ subsuite = webgl2-core
|
||||
subsuite = webgl2-core
|
||||
[generated/test_2_conformance2__transform_feedback__same-buffer-two-binding-points.html]
|
||||
subsuite = webgl2-core
|
||||
fail-if = 1
|
||||
skip-if = (os == 'win')
|
||||
[generated/test_2_conformance2__transform_feedback__simultaneous_binding.html]
|
||||
subsuite = webgl2-core
|
||||
[generated/test_2_conformance2__transform_feedback__switching-objects.html]
|
||||
|
@ -176,10 +176,6 @@ fail-if = 1
|
||||
|
||||
[generated/test_2_conformance2__textures__misc__tex-unpack-params-with-flip-y-and-premultiply-alpha.html]
|
||||
fail-if = 1
|
||||
[generated/test_2_conformance2__transform_feedback__same-buffer-two-binding-points.html]
|
||||
fail-if = 1
|
||||
# ABORT_ON_ERROR from ANGLE
|
||||
skip-if = (os == 'win')
|
||||
|
||||
########################################################################
|
||||
# Complicated
|
||||
|
Loading…
Reference in New Issue
Block a user