From b0451eab72d3754797b59b31812c9dbdc0b2e259 Mon Sep 17 00:00:00 2001
From: foreman
Date: Wed, 5 Nov 2014 18:30:40 -0500
Subject: [PATCH] P4 to Git Change 1094113 by gandryey@gera-dev-w7 on
2014/11/05 18:22:34
ECR #304775 - CL-GL depth buffer interop
- Make the changes necessary for the depth buffer interop support. Currently the extension is disabled, because the conformance tests have multiple bugs.
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_gl.cpp#45 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_memobj.cpp#71 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#231 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#197 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpusettings.cpp#292 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLContext.cpp#66 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp#101 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDeviceGL.cpp#20 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.cpp#113 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#217 edit
---
opencl/api/opencl/amdocl/cl_gl.cpp | 2 +-
opencl/api/opencl/amdocl/cl_memobj.cpp | 31 +++++++++++++++++++++++++-
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/opencl/api/opencl/amdocl/cl_gl.cpp b/opencl/api/opencl/amdocl/cl_gl.cpp
index d253c895de..f4d32c92cf 100644
--- a/opencl/api/opencl/amdocl/cl_gl.cpp
+++ b/opencl/api/opencl/amdocl/cl_gl.cpp
@@ -1873,7 +1873,7 @@ clCreateFromGLTextureAMD(
LogWarning("Cannot get numbers of samples of GL \"texture\" object");
return static_cast(0);
}
- if (numSamples > 1 && ! (amdContext.devices()[0]->settings().depthMSAAInterop_) ) {
+ if (numSamples > 1) {
*not_null(errcode_ret) = CL_INVALID_IMAGE_FORMAT_DESCRIPTOR;
LogWarning("MSAA \"texture\" object is not suppoerted for the device");
return static_cast(0);
diff --git a/opencl/api/opencl/amdocl/cl_memobj.cpp b/opencl/api/opencl/amdocl/cl_memobj.cpp
index 6b92e6d6d5..aa2f90abdb 100644
--- a/opencl/api/opencl/amdocl/cl_memobj.cpp
+++ b/opencl/api/opencl/amdocl/cl_memobj.cpp
@@ -2302,6 +2302,10 @@ RUNTIME_ENTRY(cl_int, clEnqueueReadImage, (
return CL_INVALID_OPERATION;
}
+ if (srcImage->getImageFormat().image_channel_order == CL_DEPTH_STENCIL) {
+ return CL_INVALID_OPERATION;
+ }
+
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
if (NULL == queue) {
return CL_INVALID_COMMAND_QUEUE;
@@ -2481,6 +2485,10 @@ RUNTIME_ENTRY(cl_int, clEnqueueWriteImage, (
return CL_INVALID_OPERATION;
}
+ if (dstImage->getImageFormat().image_channel_order == CL_DEPTH_STENCIL) {
+ return CL_INVALID_OPERATION;
+ }
+
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
if (NULL == queue) {
return CL_INVALID_COMMAND_QUEUE;
@@ -2646,10 +2654,14 @@ RUNTIME_ENTRY(cl_int, clEnqueueCopyImage, (
return CL_INVALID_CONTEXT;
}
- if(srcImage->getImageFormat() != dstImage->getImageFormat()) {
+ if (srcImage->getImageFormat() != dstImage->getImageFormat()) {
return CL_IMAGE_FORMAT_MISMATCH;
}
+ if (srcImage->getImageFormat().image_channel_order == CL_DEPTH_STENCIL) {
+ return CL_INVALID_OPERATION;
+ }
+
amd::Coord3D srcOrigin(src_origin[0], src_origin[1], src_origin[2]);
amd::Coord3D dstOrigin(dst_origin[0], dst_origin[1], dst_origin[2]);
amd::Coord3D copyRegion(region[0], region[1], region[2]);
@@ -2824,6 +2836,10 @@ RUNTIME_ENTRY(cl_int, clEnqueueCopyImageToBuffer, (
return CL_INVALID_CONTEXT;
}
+ if (srcImage->getImageFormat().image_channel_order == CL_DEPTH_STENCIL) {
+ return CL_INVALID_OPERATION;
+ }
+
amd::Coord3D srcOrigin(src_origin[0], src_origin[1], src_origin[2]);
amd::Coord3D dstOffset(dst_offset, 0, 0);
amd::Coord3D srcRegion(region[0], region[1], region[2]);
@@ -2971,6 +2987,10 @@ RUNTIME_ENTRY(cl_int, clEnqueueCopyBufferToImage, (
return CL_INVALID_CONTEXT;
}
+ if (dstImage->getImageFormat().image_channel_order == CL_DEPTH_STENCIL) {
+ return CL_INVALID_OPERATION;
+ }
+
amd::Coord3D dstOrigin(dst_origin[0], dst_origin[1], dst_origin[2]);
amd::Coord3D srcOffset(src_offset, 0, 0);
amd::Coord3D dstRegion(region[0], region[1], region[2]);
@@ -3392,6 +3412,11 @@ RUNTIME_ENTRY_RET(void *, clEnqueueMapImage, (
return NULL;
}
+ if (srcImage->getImageFormat().image_channel_order == CL_DEPTH_STENCIL) {
+ *not_null(errcode_ret) = CL_INVALID_OPERATION;
+ return NULL;
+ }
+
amd::HostQueue* queue = as_amd(command_queue)->asHostQueue();
if (NULL == queue) {
*not_null(errcode_ret) = CL_INVALID_COMMAND_QUEUE;
@@ -4584,6 +4609,10 @@ RUNTIME_ENTRY(cl_int, clEnqueueFillImage, (
return CL_INVALID_CONTEXT;
}
+ if (fillImage->getImageFormat().image_channel_order == CL_DEPTH_STENCIL) {
+ return CL_INVALID_OPERATION;
+ }
+
amd::Coord3D fillOrigin(origin[0], origin[1], origin[2]);
amd::Coord3D fillRegion(region[0], region[1], region[2]);
if(!fillImage->validateRegion(fillOrigin, fillRegion)) {