From 314643423b6688dd0e6f47a9dd2d4db05d6927f0 Mon Sep 17 00:00:00 2001 From: foreman Date: Fri, 22 Jun 2018 17:50:28 -0400 Subject: [PATCH] P4 to Git Change 1571960 by skeely@skeely_LC_linux on 2018/06/22 17:44:33 SWDEV-155716 - Fetch backing buffer of texture buffers for use with GL buffer APIs. Don't assume that texture buffer names will be the same as the backing store's buffer name. It is illegal (but unchecked) in GL to use a texture object name in a buffer object API. Affected files ... ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_gl.cpp#60 edit [ROCm/clr commit: f89e4f89a1afe30e6e34c16ca062115b3e7e61a3] --- projects/clr/opencl/api/opencl/amdocl/cl_gl.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/clr/opencl/api/opencl/amdocl/cl_gl.cpp b/projects/clr/opencl/api/opencl/amdocl/cl_gl.cpp index a3b6318b69..e34c9e09a3 100644 --- a/projects/clr/opencl/api/opencl/amdocl/cl_gl.cpp +++ b/projects/clr/opencl/api/opencl/amdocl/cl_gl.cpp @@ -1696,7 +1696,16 @@ cl_mem clCreateFromGLTextureAMD(Context& amdContext, cl_mem_flags clFlags, GLenu GLint size; // In case target is GL_TEXTURE_BUFFER - amdContext.glenv()->glBindBuffer_(glTarget, texture); + GLint backingBuffer; + clearGLErrors(amdContext); + amdContext.glenv()->glGetTexLevelParameteriv_( + glTarget, 0, GL_TEXTURE_BUFFER_DATA_STORE_BINDING, &backingBuffer); + if (GL_NO_ERROR != (glErr = amdContext.glenv()->glGetError_())) { + *not_null(errcode_ret) = CL_INVALID_IMAGE_FORMAT_DESCRIPTOR; + LogWarning("Cannot get backing buffer for GL \"texture buffer\" object"); + return static_cast(0); + } + amdContext.glenv()->glBindBuffer_(glTarget, backingBuffer); // Get GL texture format and check if it's compatible with CL format clearGLErrors(amdContext);