Page MenuHome

gpu.types.GPUOffScreen: accept format argument to set internal color attachment texture format
ClosedPublic

Authored by Iyad Ahmed (iyadahmed2001) on Dec 22 2021, 10:17 AM.

Details

Summary

Some projects need more than 8bit RGBA offscreens, this patch adds the ability to accept color format and defaults to RGBA8 so existing code should not be affected

current formats allowed by patch:

  • RGBA8 (default)
  • RGBA16
  • RGBA16F
  • RGBA32F

Diff Detail

Repository
rB Blender

Event Timeline

Iyad Ahmed (iyadahmed2001) requested review of this revision.Dec 22 2021, 10:17 AM
Iyad Ahmed (iyadahmed2001) created this revision.
Iyad Ahmed (iyadahmed2001) edited the summary of this revision. (Show Details)

but actually you know, this patch still makes it a million times easier

I would expose more supported formats for it to be useful.

I would add support for:
RGBA16F
RGBA32F

Other formats may have side effects on the drawing pipeline.

I would expose more supported formats for it to be useful.

I would add support for:
RGBA16F
RGBA32F

Other formats may have side effects on the drawing pipeline.

agree will add them now

Iyad Ahmed (iyadahmed2001) edited the summary of this revision. (Show Details)

Add RGBA 16F and 32F

This revision is now accepted and ready to land.Dec 29 2021, 12:43 AM

Thanks for the patch, looks good to me.
But I'm having trouble applying it in order to land it.
Is it based on master?

Thanks for the patch, looks good to me.
But I'm having trouble applying it in order to land it.
Is it based on master?

Hi yes based on master, one moment let me rebase

No I still can't apply the patch.

$ arc patch D13650
 INFO  Base commit is not in local repository; trying to fetch.
fatal: Needed a single revision
fatal: Unable to find current revision in submodule path 'release/datafiles/locale'
Created and checked out branch arcpatch-D13650.
Checking patch source/blender/python/gpu/gpu_py_offscreen.c...
error: while searching for:
/** \name GPUOffScreen Common Utilities?
 * \{ */?
?
static int pygpu_offscreen_valid_check(BPyGPUOffScreen *py_ofs)?
{?
  if (UNLIKELY(py_ofs->ofs == NULL)) {?

error: patch failed: source/blender/python/gpu/gpu_py_offscreen.c:65
error: while searching for:
?
  GPUOffScreen *ofs = NULL;?
  int width, height;?
  char err_out[256];?
?
  static const char *_keywords[] = {"width", "height", NULL};?
  static _PyArg_Parser _parser = {"ii:GPUOffScreen.__new__", _keywords, 0};?
  if (!_PyArg_ParseTupleAndKeywordsFast(args, kwds, &_parser, &width, &height)) {?
    return NULL;?
  }?
?
  if (GPU_context_active_get()) {?
    ofs = GPU_offscreen_create(width, height, true, GPU_RGBA8, err_out);?
  }?
  else {?
    STRNCPY(err_out, "No active GPU context found");?

error: patch failed: source/blender/python/gpu/gpu_py_offscreen.c:219
error: while searching for:
};?
?
PyDoc_STRVAR(pygpu_offscreen__tp_doc,?
             ".. class:: GPUOffScreen(width, height)\n"?
             "\n"?
             "   This object gives access to off screen buffers.\n"?
             "\n"?
             "   :arg width: Horizontal dimension of the buffer.\n"?
             "   :type width: int\n"?
             "   :arg height: Vertical dimension of the buffer.\n"?
             "   :type height: int\n");?
PyTypeObject BPyGPUOffScreen_Type = {?
    PyVarObject_HEAD_INIT(NULL, 0).tp_name = "GPUOffScreen",?
    .tp_basicsize = sizeof(BPyGPUOffScreen),?

error: patch failed: source/blender/python/gpu/gpu_py_offscreen.c:456
Applying patch source/blender/python/gpu/gpu_py_offscreen.c with 3 rejects...
Rejected hunk #1.
Rejected hunk #2.
Rejected hunk #3.

 Patch Failed!
Usage Exception: Unable to apply patch!

I will try manually.

  • Testing with patch update