xgl: Add xglCmdBlitImage entry point
authorCourtney Goeltzenleuchter <courtney@LunarG.com>
Sun, 8 Mar 2015 23:02:18 +0000 (17:02 -0600)
committerChia-I Wu <olv@lunarg.com>
Thu, 16 Apr 2015 09:33:25 +0000 (17:33 +0800)
Part one of adding support for abitrary scaled blits and format conversions.
Just interface here. Functionality to follow.
bug #13071
alpha rev: r29665

icd/nulldrv/nulldrv.c
include/xgl.h
include/xglLayer.h
layers/draw_state.c
layers/mem_tracker.cpp
xgl.py

index 2db8f64..6c4894f 100644 (file)
@@ -915,6 +915,18 @@ ICD_EXPORT void XGLAPI xglCmdCopyImage(
     NULLDRV_LOG_FUNC;
 }
 
+ICD_EXPORT void XGLAPI xglCmdBlitImage(
+    XGL_CMD_BUFFER                              cmdBuffer,
+    XGL_IMAGE                                   srcImage,
+    XGL_IMAGE_LAYOUT                            srcLayout,
+    XGL_IMAGE                                   destImage,
+    XGL_IMAGE_LAYOUT                            destLayout,
+    uint32_t                                    regionCount,
+    const XGL_IMAGE_BLIT*                       pRegions)
+{
+    NULLDRV_LOG_FUNC;
+}
+
 ICD_EXPORT void XGLAPI xglCmdCopyBufferToImage(
     XGL_CMD_BUFFER                              cmdBuffer,
     XGL_BUFFER                                  srcBuffer,
index 1955f8a..8c2cacc 100644 (file)
@@ -33,7 +33,7 @@
 #include "xglPlatform.h"
 
 // XGL API version supported by this file
-#define XGL_API_VERSION XGL_MAKE_VERSION(0, 57, 1)
+#define XGL_API_VERSION XGL_MAKE_VERSION(0, 57, 2)
 
 #ifdef __cplusplus
 extern "C"
@@ -196,7 +196,7 @@ typedef enum _XGL_ATTACHMENT_LOAD_OP
     XGL_ATTACHMENT_LOAD_OP_LOAD                             = 0x00000000,
     XGL_ATTACHMENT_LOAD_OP_CLEAR                            = 0x00000001,
     XGL_ATTACHMENT_LOAD_OP_DONT_CARE                        = 0x00000002,
-    
+
     XGL_ATTACHMENT_LOAD_OP_BEGIN_RANGE                      = XGL_ATTACHMENT_LOAD_OP_LOAD,
     XGL_ATTACHMENT_LOAD_OP_END_RANGE                        = XGL_ATTACHMENT_LOAD_OP_DONT_CARE,
     XGL_NUM_ATTACHMENT_LOAD_OP                              = (XGL_ATTACHMENT_LOAD_OP_END_RANGE - XGL_ATTACHMENT_LOAD_OP_BEGIN_RANGE + 1),
@@ -208,7 +208,7 @@ typedef enum _XGL_ATTACHMENT_STORE_OP
     XGL_ATTACHMENT_STORE_OP_STORE                           = 0x00000000,
     XGL_ATTACHMENT_STORE_OP_RESOLVE_MSAA                    = 0x00000001,
     XGL_ATTACHMENT_STORE_OP_DONT_CARE                       = 0x00000002,
-    
+
     XGL_ATTACHMENT_STORE_OP_BEGIN_RANGE                     = XGL_ATTACHMENT_STORE_OP_STORE,
     XGL_ATTACHMENT_STORE_OP_END_RANGE                       = XGL_ATTACHMENT_STORE_OP_DONT_CARE,
     XGL_NUM_ATTACHMENT_STORE_OP                             = (XGL_ATTACHMENT_STORE_OP_END_RANGE - XGL_ATTACHMENT_STORE_OP_BEGIN_RANGE + 1),
@@ -1186,12 +1186,12 @@ typedef enum _XGL_IMAGE_USAGE_FLAGS
     XGL_IMAGE_USAGE_SHADER_ACCESS_READ_BIT                  = 0x00000001,   // shader read (e.g. texture, image)
     XGL_IMAGE_USAGE_SHADER_ACCESS_WRITE_BIT                 = 0x00000002,   // shader write (e.g. image)
     XGL_IMAGE_USAGE_SHADER_ACCESS_ATOMIC_BIT                = 0x00000004,   // shader atomic operations (e.g. image)
-    XGL_IMAGE_USAGE_TRANSFER_SOURCE_BIT                     = 0x00000008,   // used as a source for copies 
+    XGL_IMAGE_USAGE_TRANSFER_SOURCE_BIT                     = 0x00000008,   // used as a source for copies
     XGL_IMAGE_USAGE_TRANSFER_DESTINATION_BIT                = 0x00000010,   // used as a destination for copies
     XGL_IMAGE_USAGE_TEXTURE_BIT                             = 0x00000020,   // opaque texture (2d, 3d, etc.)
     XGL_IMAGE_USAGE_IMAGE_BIT                               = 0x00000040,   // opaque image (2d, 3d, etc.)
     XGL_IMAGE_USAGE_COLOR_ATTACHMENT_BIT                    = 0x00000080,   // framebuffer color attachment
-    XGL_IMAGE_USAGE_DEPTH_STENCIL_BIT                       = 0x00000100,   // framebuffer depth/stencil 
+    XGL_IMAGE_USAGE_DEPTH_STENCIL_BIT                       = 0x00000100,   // framebuffer depth/stencil
     XGL_MAX_ENUM(_XGL_IMAGE_USAGE_FLAGS)
 } XGL_IMAGE_USAGE_FLAGS;
 
@@ -1698,6 +1698,7 @@ typedef struct _XGL_PEER_IMAGE_OPEN_INFO
 {
     XGL_IMAGE                               originalImage;
 } XGL_PEER_IMAGE_OPEN_INFO;
+
 typedef struct _XGL_SUBRESOURCE_LAYOUT
 {
     XGL_GPU_SIZE                            offset;                 // Specified in bytes
@@ -1779,6 +1780,16 @@ typedef struct _XGL_IMAGE_COPY
     XGL_EXTENT3D                            extent;
 } XGL_IMAGE_COPY;
 
+typedef struct _XGL_IMAGE_BLIT
+{
+    XGL_IMAGE_SUBRESOURCE                   srcSubresource;
+    XGL_OFFSET3D                            srcOffset;
+    XGL_EXTENT3D                            srcExtent;
+    XGL_IMAGE_SUBRESOURCE                   destSubresource;
+    XGL_OFFSET3D                            destOffset;
+    XGL_EXTENT3D                            destExtent;
+} XGL_IMAGE_BLIT;
+
 typedef struct _XGL_BUFFER_IMAGE_COPY
 {
     XGL_GPU_SIZE                            bufferOffset;           // Specified in bytes
@@ -1865,11 +1876,6 @@ typedef struct _XGL_COMPUTE_PIPELINE_CREATE_INFO
     XGL_PIPELINE_SHADER                     cs;
     XGL_FLAGS                               flags;      // XGL_PIPELINE_CREATE_FLAGS
     XGL_DESCRIPTOR_SET_LAYOUT               lastSetLayout;
-    // For local size fields zero is treated an invalid value
-    uint32_t                                localSizeX;
-    uint32_t                                localSizeY;
-    uint32_t                                localSizeZ;
-
 } XGL_COMPUTE_PIPELINE_CREATE_INFO;
 
 typedef struct _XGL_VERTEX_INPUT_BINDING_DESCRIPTION
@@ -2326,6 +2332,7 @@ typedef void       (XGLAPI *xglCmdDispatchType)(XGL_CMD_BUFFER cmdBuffer, uint32
 typedef void       (XGLAPI *xglCmdDispatchIndirectType)(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER buffer, XGL_GPU_SIZE offset);
 typedef void       (XGLAPI *xglCmdCopyBufferType)(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER srcBuffer, XGL_BUFFER destBuffer, uint32_t regionCount, const XGL_BUFFER_COPY* pRegions);
 typedef void       (XGLAPI *xglCmdCopyImageType)(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE destImage, uint32_t regionCount, const XGL_IMAGE_COPY* pRegions);
+typedef void       (XGLAPI *xglCmdBlitImageType)(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE_LAYOUT srcLayout, XGL_IMAGE destImage, XGL_IMAGE_LAYOUT destLayout, uint32_t regionCount, const XGL_IMAGE_BLIT* pRegions);
 typedef void       (XGLAPI *xglCmdCopyBufferToImageType)(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER srcBuffer, XGL_IMAGE destImage, uint32_t regionCount, const XGL_BUFFER_IMAGE_COPY* pRegions);
 typedef void       (XGLAPI *xglCmdCopyImageToBufferType)(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_BUFFER destBuffer, uint32_t regionCount, const XGL_BUFFER_IMAGE_COPY* pRegions);
 typedef void       (XGLAPI *xglCmdCloneImageDataType)(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE_LAYOUT srcImageLayout, XGL_IMAGE destImage, XGL_IMAGE_LAYOUT destImageLayout);
@@ -2859,6 +2866,15 @@ void XGLAPI xglCmdCopyImage(
     uint32_t                                    regionCount,
     const XGL_IMAGE_COPY*                       pRegions);
 
+void XGLAPI xglCmdBlitImage(
+    XGL_CMD_BUFFER                              cmdBuffer,
+    XGL_IMAGE                                   srcImage,
+    XGL_IMAGE_LAYOUT                            srcLayout,
+    XGL_IMAGE                                   destImage,
+    XGL_IMAGE_LAYOUT                            destLayout,
+    uint32_t                                    regionCount,
+    const XGL_IMAGE_BLIT*                       pRegions);
+
 void XGLAPI xglCmdCopyBufferToImage(
     XGL_CMD_BUFFER                              cmdBuffer,
     XGL_BUFFER                                  srcBuffer,
index 05fa5ec..81da19e 100644 (file)
@@ -116,6 +116,7 @@ typedef struct _XGL_LAYER_DISPATCH_TABLE
     xglCmdDispatchIndirectType CmdDispatchIndirect;
     xglCmdCopyBufferType CmdCopyBuffer;
     xglCmdCopyImageType CmdCopyImage;
+    xglCmdBlitImageType CmdBlitImage;
     xglCmdCopyBufferToImageType CmdCopyBufferToImage;
     xglCmdCopyImageToBufferType CmdCopyImageToBuffer;
     xglCmdCloneImageDataType CmdCloneImageData;
index 9fa0cc2..c655b57 100644 (file)
@@ -2340,6 +2340,23 @@ XGL_LAYER_EXPORT void XGLAPI xglCmdCopyImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE
     nextTable.CmdCopyImage(cmdBuffer, srcImage, destImage, regionCount, pRegions);
 }
 
+XGL_LAYER_EXPORT void XGLAPI xglCmdBlitImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE_LAYOUT srcLayout,
+                                             XGL_IMAGE destImage, XGL_IMAGE_LAYOUT destLayout,
+                                             uint32_t regionCount, const XGL_IMAGE_BLIT* pRegions)
+{
+    GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer);
+    if (pCB) {
+        updateCBTracking(cmdBuffer);
+        addCmd(pCB, CMD_COPYIMAGE);
+    }
+    else {
+        char str[1024];
+        sprintf(str, "Attempt to use CmdBuffer %p that doesn't exist!", (void*)cmdBuffer);
+        layerCbMsg(XGL_DBG_MSG_ERROR, XGL_VALIDATION_LEVEL_0, cmdBuffer, 0, DRAWSTATE_INVALID_CMD_BUFFER, "DS", str);
+    }
+    nextTable.CmdBlitImage(cmdBuffer, srcImage, srcLayout, destImage, destLayout, regionCount, pRegions);
+}
+
 XGL_LAYER_EXPORT void XGLAPI xglCmdCopyBufferToImage(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER srcBuffer, XGL_IMAGE destImage, uint32_t regionCount, const XGL_BUFFER_IMAGE_COPY* pRegions)
 {
     GLOBAL_CB_NODE* pCB = getCBNode(cmdBuffer);
index c68dc97..768c60b 100644 (file)
@@ -1473,8 +1473,15 @@ XGL_LAYER_EXPORT void XGLAPI xglCmdCopyImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE
     nextTable.CmdCopyImage(cmdBuffer, srcImage, destImage, regionCount, pRegions);
 }
 
-XGL_LAYER_EXPORT void XGLAPI xglCmdCopyBufferToImage(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER srcBuffer, XGL_IMAGE destImage,
-    uint32_t regionCount, const XGL_BUFFER_IMAGE_COPY* pRegions)
+XGL_LAYER_EXPORT void XGLAPI xglCmdBlitImage(XGL_CMD_BUFFER cmdBuffer, XGL_IMAGE srcImage, XGL_IMAGE_LAYOUT srcLayout,
+                                             XGL_IMAGE destImage, uint32_t regionCount, XGL_IMAGE_LAYOUT destLayout,
+                                             const XGL_IMAGE_BLIT* pRegions)
+{
+    // TODO : Each image will have mem mapping so track them
+    nextTable.CmdBlitImage(cmdBuffer, srcImage, srcLayout, destImage, destLayout, regionCount, pRegions);
+}
+
+XGL_LAYER_EXPORT void XGLAPI xglCmdCopyBufferToImage(XGL_CMD_BUFFER cmdBuffer, XGL_BUFFER srcBuffer, XGL_IMAGE destImage, uint32_t regionCount, const XGL_BUFFER_IMAGE_COPY* pRegions)
 {
     // TODO : Track this
     loader_platform_thread_lock_mutex(&globalLock);
diff --git a/xgl.py b/xgl.py
index 6afe794..ef3e8c7 100644 (file)
--- a/xgl.py
+++ b/xgl.py
@@ -676,6 +676,15 @@ core = Extension(
              Param("uint32_t", "regionCount"),
              Param("const XGL_IMAGE_COPY*", "pRegions")]),
 
+        Proto("void", "CmdBlitImage",
+            [Param("XGL_CMD_BUFFER", "cmdBuffer"),
+             Param("XGL_IMAGE", "srcImage"),
+             Param("XGL_IMAGE_LAYOUT", "srcLayout"),
+             Param("XGL_IMAGE", "destImage"),
+             Param("XGL_IMAGE_LAYOUT", "destLayout"),
+             Param("uint32_t", "regionCount"),
+             Param("const XGL_IMAGE_BLIT*", "pRegions")]),
+
         Proto("void", "CmdCopyBufferToImage",
             [Param("XGL_CMD_BUFFER", "cmdBuffer"),
              Param("XGL_BUFFER", "srcBuffer"),