mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1170855 - Part 6: Implement Sampler binding tracking. r=jgilbert
This commit is contained in:
parent
cd610c142c
commit
f1e0264cff
@ -36,6 +36,12 @@ WebGL2Context::DeleteSampler(WebGLSampler* sampler)
|
||||
if (!sampler || sampler->IsDeleted())
|
||||
return;
|
||||
|
||||
for (int n = 0; n < mGLMaxTextureUnits; n++) {
|
||||
if (mBoundSamplers[n] == sampler) {
|
||||
mBoundSamplers[n] = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
sampler->RequestDelete();
|
||||
}
|
||||
|
||||
@ -74,6 +80,8 @@ WebGL2Context::BindSampler(GLuint unit, WebGLSampler* sampler)
|
||||
return ErrorInvalidOperation("bindSampler: binding deleted sampler");
|
||||
|
||||
WebGLContextUnchecked::BindSampler(unit, sampler);
|
||||
|
||||
mBoundSamplers[unit] = sampler;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -109,9 +109,7 @@ WebGL2Context::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
|
||||
return WebGLObjectAsJSValue(cx, mBoundReadFramebuffer.get(), rv);
|
||||
|
||||
case LOCAL_GL_SAMPLER_BINDING:
|
||||
// TODO: Implement bound sampler tracking
|
||||
//return WebGLObjectAsJSValue(cx, mBoundSamplers[mActiveTexture].get(), rv);
|
||||
return JS::NullValue();
|
||||
return WebGLObjectAsJSValue(cx, mBoundSamplers[mActiveTexture].get(), rv);
|
||||
|
||||
case LOCAL_GL_TEXTURE_BINDING_2D_ARRAY:
|
||||
// TODO: Implement gl.TEXTURE_2D_ARRAY
|
||||
|
@ -325,6 +325,7 @@ WebGLContext::DestroyResourcesAndContext()
|
||||
mBound2DTextures.Clear();
|
||||
mBoundCubeMapTextures.Clear();
|
||||
mBound3DTextures.Clear();
|
||||
mBoundSamplers.Clear();
|
||||
mBoundArrayBuffer = nullptr;
|
||||
mBoundCopyReadBuffer = nullptr;
|
||||
mBoundCopyWriteBuffer = nullptr;
|
||||
@ -1949,6 +1950,7 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WebGLContext,
|
||||
mBound2DTextures,
|
||||
mBoundCubeMapTextures,
|
||||
mBound3DTextures,
|
||||
mBoundSamplers,
|
||||
mBoundArrayBuffer,
|
||||
mBoundCopyReadBuffer,
|
||||
mBoundCopyWriteBuffer,
|
||||
|
@ -1435,6 +1435,7 @@ protected:
|
||||
nsTArray<WebGLRefPtr<WebGLTexture> > mBound2DTextures;
|
||||
nsTArray<WebGLRefPtr<WebGLTexture> > mBoundCubeMapTextures;
|
||||
nsTArray<WebGLRefPtr<WebGLTexture> > mBound3DTextures;
|
||||
nsTArray<WebGLRefPtr<WebGLSampler> > mBoundSamplers;
|
||||
|
||||
void ResolveTexturesForDraw() const;
|
||||
|
||||
|
@ -1755,6 +1755,7 @@ WebGLContext::InitAndValidateGL()
|
||||
mBound2DTextures.Clear();
|
||||
mBoundCubeMapTextures.Clear();
|
||||
mBound3DTextures.Clear();
|
||||
mBoundSamplers.Clear();
|
||||
|
||||
mBoundArrayBuffer = nullptr;
|
||||
mBoundTransformFeedbackBuffer = nullptr;
|
||||
@ -1798,6 +1799,7 @@ WebGLContext::InitAndValidateGL()
|
||||
mBound2DTextures.SetLength(mGLMaxTextureUnits);
|
||||
mBoundCubeMapTextures.SetLength(mGLMaxTextureUnits);
|
||||
mBound3DTextures.SetLength(mGLMaxTextureUnits);
|
||||
mBoundSamplers.SetLength(mGLMaxTextureUnits);
|
||||
|
||||
if (MinCapabilityMode()) {
|
||||
mGLMaxTextureSize = MINVALUE_GL_MAX_TEXTURE_SIZE;
|
||||
|
Loading…
Reference in New Issue
Block a user