@@ -229,23 +229,45 @@ draw_submit_2d_drawlist(PyObject* self, PyObject* args)
229229 float fWidth = 0.0f ;
230230 float fHeight = 0.0f ;
231231 int iSampleCount = 1 ;
232+ PyObject * ptPythonAttachmentInfo = NULL ;
232233
233234 static const char * apcKeywords [] = {
234235 "drawlist" ,
235- "encoder " ,
236+ "commandBuffer " ,
236237 "width" ,
237238 "height" ,
238239 "sampleCount" ,
240+ "attachmentInfo" ,
239241 NULL ,
240242 };
241243
242- if (!pl_parse_args ("OOffi " , (const char * * )apcKeywords , args , NULL , __FUNCTION__ ,
243- & ptPythonDrawlist , & ptPythonEncoder , & fWidth , & fHeight , & iSampleCount ))
244+ if (!pl_parse_args ("OOffiO " , (const char * * )apcKeywords , args , NULL , __FUNCTION__ ,
245+ & ptPythonDrawlist , & ptPythonEncoder , & fWidth , & fHeight , & iSampleCount , & ptPythonAttachmentInfo ))
244246 return NULL ;
245247
246248 plDrawList2D * ptDrawlist = PyCapsule_GetPointer (ptPythonDrawlist , "plDrawList2D" );
247- plRenderEncoder * ptEncoder = PyCapsule_GetPointer (ptPythonEncoder , "plRenderEncoder" );
248- gptDraw -> submit_2d_drawlist (ptDrawlist , ptEncoder , fWidth , fHeight , (uint32_t )iSampleCount );
249+ plCommandBuffer * ptCmdBuffer = PyCapsule_GetPointer (ptPythonEncoder , "plCommandBuffer" );
250+
251+ plRenderAttachmentInfo tInfo = {0 };
252+ PyObject * ptPythonAttachmentDepth = PyObject_GetAttrString (ptPythonAttachmentInfo , "eDepthFormat" );
253+ PyLong_AsInt32 (ptPythonAttachmentDepth , & tInfo .eDepthFormat );
254+ Py_DECREF (ptPythonAttachmentDepth );
255+
256+ ptPythonAttachmentDepth = PyObject_GetAttrString (ptPythonAttachmentInfo , "eStencilFormat" );
257+ PyLong_AsInt32 (ptPythonAttachmentDepth , & tInfo .eStencilFormat );
258+ Py_DECREF (ptPythonAttachmentDepth );
259+
260+ ptPythonAttachmentDepth = PyObject_GetAttrString (ptPythonAttachmentInfo , "aeColorFormats" );
261+ Py_ssize_t pySize = PyList_Size (ptPythonAttachmentDepth );
262+ for (Py_ssize_t i = 0 ; i < pySize ; ++ i )
263+ {
264+ PyObject * ptColor = PyList_GetItem (ptPythonAttachmentDepth , i );
265+ PyLong_AsInt32 (ptColor , & tInfo .aeColorFormats [i ]);
266+ }
267+ Py_DECREF (ptPythonAttachmentDepth );
268+
269+
270+ gptDraw -> submit_2d_drawlist (ptDrawlist , ptCmdBuffer , fWidth , fHeight , (uint32_t )iSampleCount , & tInfo );
249271 Py_RETURN_NONE ;
250272}
251273
@@ -259,26 +281,49 @@ draw_submit_3d_drawlist(PyObject* self, PyObject* args)
259281 PyObject * ptPythonMVP = NULL ;
260282 int iFlags = 0 ;
261283 int iSampleCount = 1 ;
284+ PyObject * ptPythonAttachmentInfo = NULL ;
262285
263286 static const char * apcKeywords [] = {
264287 "drawlist" ,
265- "encoder " ,
288+ "commandBuffer " ,
266289 "width" ,
267290 "height" ,
268291 "mvp" ,
269292 "flags" ,
270293 "sampleCount" ,
294+ "attachmentInfo" ,
271295 NULL ,
272296 };
273297
274- if (!pl_parse_args ("OOffOii " , (const char * * )apcKeywords , args , NULL , __FUNCTION__ ,
275- & ptPythonDrawlist , & ptPythonEncoder , & fWidth , & fHeight , & ptPythonMVP , & iFlags , & iSampleCount ))
298+ if (!pl_parse_args ("OOffOiiO " , (const char * * )apcKeywords , args , NULL , __FUNCTION__ ,
299+ & ptPythonDrawlist , & ptPythonEncoder , & fWidth , & fHeight , & ptPythonMVP , & iFlags , & iSampleCount , & ptPythonAttachmentInfo ))
276300 return NULL ;
277301
302+
303+
278304 plDrawList3D * ptDrawlist = PyCapsule_GetPointer (ptPythonDrawlist , "plDrawList3D" );
279- plRenderEncoder * ptEncoder = PyCapsule_GetPointer (ptPythonEncoder , "plRenderEncoder" );
305+ plCommandBuffer * ptCmdBuffer = PyCapsule_GetPointer (ptPythonEncoder , "plCommandBuffer" );
306+
307+ plRenderAttachmentInfo tInfo = {0 };
308+ PyObject * ptPythonAttachmentDepth = PyObject_GetAttrString (ptPythonAttachmentInfo , "eDepthFormat" );
309+ PyLong_AsInt32 (ptPythonAttachmentDepth , & tInfo .eDepthFormat );
310+ Py_DECREF (ptPythonAttachmentDepth );
311+
312+ ptPythonAttachmentDepth = PyObject_GetAttrString (ptPythonAttachmentInfo , "eStencilFormat" );
313+ PyLong_AsInt32 (ptPythonAttachmentDepth , & tInfo .eStencilFormat );
314+ Py_DECREF (ptPythonAttachmentDepth );
315+
316+ ptPythonAttachmentDepth = PyObject_GetAttrString (ptPythonAttachmentInfo , "aeColorFormats" );
317+ Py_ssize_t pySize = PyList_Size (ptPythonAttachmentDepth );
318+ for (Py_ssize_t i = 0 ; i < pySize ; ++ i )
319+ {
320+ PyObject * ptColor = PyList_GetItem (ptPythonAttachmentDepth , i );
321+ PyLong_AsInt32 (ptColor , & tInfo .aeColorFormats [i ]);
322+ }
323+ Py_DECREF (ptPythonAttachmentDepth );
324+
280325 pyplMat4 * m = (pyplMat4 * )ptPythonMVP ;
281- gptDraw -> submit_3d_drawlist (ptDrawlist , ptEncoder , fWidth , fHeight , & m -> m , iFlags , (uint32_t )iSampleCount );
326+ gptDraw -> submit_3d_drawlist (ptDrawlist , ptCmdBuffer , fWidth , fHeight , & m -> m , iFlags , (uint32_t )iSampleCount , & tInfo );
282327 Py_RETURN_NONE ;
283328}
284329
0 commit comments