Commit Graph

86 Commits

Author SHA1 Message Date
4c95899098 GPU: Rename GPU_shader_get_uniform to GPU_shader_get_uniform_ensure
This is in order to make the API more multithread friendly inside the
draw manager.

GPU_shader_get_uniform will only serve to query the shader interface and
not do any GL call, making it threadsafe.

For now it only print a warning if the uniform was not queried before.
2019-01-17 19:44:01 +01:00
72e2a0cfb6 Cleanup: py-gpu error checks
Move gpu initialization checks to the start of each function instead
of mixing with argument parsing.
2019-01-03 01:08:26 +11:00
d07bc44a96 Revert file rename from T59773 fix
Mixing file rename with other changes should be avoided.

Using 'module_py_api' convention here
is in keeping with imbuf, idprop, blf & bmesh.
No reason for gpu to have a different convention.
2019-01-03 00:55:07 +11:00
945007b32e Fix T59773: Raise exception if the gpu module is used in backgound mode.
Instead of crashing, an error message is displayed if a function of the gpu module is called without a GPU context.

Reviewers: brecht, campbellbarton, JacquesLucke, mont29

Subscribers: abdelmatinboulbayam, amir.shehata

Differential Revision: https://developer.blender.org/D4143
2019-01-02 10:01:46 -02:00
f0b5a9da01 Cleanup: style, unused 2018-11-20 08:53:00 +11:00
3f59bdc1bd PyAPI: GPUOffscreen: Add context manager for the bind method to work with the with statement.
Differential Revision: https://developer.blender.org/D3918
2018-11-19 10:16:27 -02:00
6fe1b7158b Py API Docs: Fix wrong type 2018-11-19 10:29:10 +01:00
4fbde56f51 Py API: Fix documentation/actual behavior missmatch in gpu.matrix 2018-11-15 17:10:32 +01:00
4d04235d5f Py API Docs: Fix formatting 2018-11-15 16:54:29 +01:00
69a9bcc206 minor cleanup 2018-11-14 13:06:11 +01:00
61ecd3d24e minor cleanup 2018-11-14 13:06:10 +01:00
8778656692 minor api docs fix 2018-11-14 12:33:10 +01:00
92166ecd91 Py API: Remove GPUShader.transform_feedback_enable/disable
It couldn't really be used in the current implementation, so it is better to remove it instead of confusing everyone.
2018-11-14 12:27:09 +01:00
72369c638d Cleanup: python doc-strings
Indentation & trailing space.
2018-11-14 09:05:07 +11:00
dc6ba4f2ec Py API: fix parameter order in offscreen.draw_view3d 2018-11-13 16:23:31 +01:00
c8975b0fc7 Py API Docs: GPUVertFormat documentation 2018-11-13 15:25:51 +01:00
444f1fd423 Py API Docs: Cleanup 2018-11-13 15:25:51 +01:00
3f478f4260 Py API Docs: GPUIndexBuf documentation 2018-11-13 15:25:51 +01:00
6ae84ddc6e Py API Docs: GPUBatch documentation 2018-11-13 13:00:18 +01:00
Dalai Felinto
49a7bcafd9 gpu.offscreen, fix pydoc, example and rename modelviewmatrix > viewmatrix
Technically this is only the view matrix, not model view matrix.
And view layer was missing from the pydoc.
2018-11-09 13:54:38 -02:00
Dalai Felinto
88d621a68f BKE_id_is_in_gobal_main > BKE_id_is_in_global_main 2018-11-09 10:59:31 -02:00
64ec05b64d Cleanup: remove some useless BKE_library and BKE_main includes.
Makes it simpler to make some changes...

Also fix order of some includes (use alphabetical please).
2018-11-07 20:58:54 +01:00
a145c7dc62 Cleanup: No need to save/restor frame buffer twice 2018-11-06 15:46:07 +01:00
a8e9959e07 API Docs: gpu api introduction + examples 2018-11-05 19:28:28 +01:00
8d496c2f85 Cleanup: rename PyAPI VertBatch to Batch
Only used for internal functions, follow 'GPU_batch.h' naming.
2018-10-31 12:34:10 +11:00
b1d2db2c77 Fix leak in successive calls to Batch.program_set 2018-10-31 12:32:57 +11:00
205eac3038 PyAPI: add check for exceeding batch VBO limit 2018-10-31 12:11:38 +11:00
1a865b4ff0 Cleanup: batch Python API
Add utility function to raise an error.
2018-10-31 12:02:22 +11:00
756d1502e4 Fix missing error returns in batch API 2018-10-31 11:55:28 +11:00
974d158f3f PyAPI: GPU: improve GPUShader.from_builtin and GPUShader.code_from_builtin description. 2018-10-30 11:38:42 -03:00
c750ebe113 PyAPI: remove GPUVertFormat() creation from a list
We already have `attr_add` method,
best not have two ways to do the same thing.

See: D3830
2018-10-29 11:08:55 +11:00
41a284212a Cleanup: fix compiler warnings. 2018-10-28 17:46:51 +01:00
065d19e223 Fix parsing single int for uniform_int
This worked for float but not int.
2018-10-26 11:59:49 +11:00
1d8ba9d618 PyAPI: Make GPUVertFormat() argument optional 2018-10-26 08:06:05 +11:00
6ed9fcbabc PyAPI: rename GPL VertBuf.attr_fill identifier to id
This is used elsewhere in the API and its a common abbreviation.
2018-10-25 20:34:23 +11:00
341306995b Fix: buffer overflow when creating gpu.types.GPUIndexBuf 2018-10-24 10:57:46 +02:00
0589368615 GPUShader: shader.uniform_float, matrix parsing
Add checks to parse 3x3 or 4x4 matrices,
also use error from `mathutils_array_parse` instead of overwriting.
2018-10-24 18:47:36 +11:00
fc3d771801 GPUShader: shader.uniform_float parameters
Allow to pass in single numbers, sequences and mathutils.* types into `shader.uniform_float`.

Reviewers: mano-wii

Differential Revision: https://developer.blender.org/D3820
2018-10-23 10:19:08 +02:00
e5182fa101 Cleanup: rename VertBuf.fill_attribute > attr_fill 2018-10-23 10:50:48 +11:00
59054d5eba Python API: fix docstrings 2018-10-22 15:01:25 +02:00
e333765d3e Python GPU: Best description for exceptions 2018-10-12 15:48:55 -03:00
d29f98e3f2 Python GPU: Use PyC_AsArray_FAST in GPUVertBuf.fill_attribute.
This allows you to use other types of sequences besides tuples.
2018-10-10 13:39:03 -03:00
5e88d103f7 Python GPU: Use PyC_AsArray_FAST when initing GPUIndexBuff.
This allows you to use other types of sequences besides tuples.
2018-10-10 13:39:02 -03:00
b0b547bd1e Python GPU: Update shader.from_builtin and shader.code_from_builtin description. 2018-10-09 12:18:28 -03:00
8fc8131bc9 GPU Python: Use string literals in shader.from_builtin and shader.code_from_builtin.
Also, the gpu.shader.builtin submodule becomes obsolete, so it has been removed.
2018-10-09 12:07:06 -03:00
9560fe60e4 Python API: new GPUShader.format_calc() method
Reviewers: mano-wii, fclem, campbellbarton

Differential Revision: https://developer.blender.org/D3772
2018-10-09 11:17:29 +02:00
cf03658adb Fix misuse of Py_INCREF in module creation.
Differential Revision: https://developer.blender.org/D3697
2018-10-08 20:01:55 -03:00
d592eb510e Cleanup: naming 2018-10-09 09:25:33 +11:00
d022794cad Cleanup: rename checks for Python struct strings
Using 'format' prefix made this read as if t was for string formatting.

Use 'PyC_StructFmt' prefix instead since these values are compatible
with formatting from Python's 'struct' module.
2018-10-08 08:37:32 +11:00
91bfea5b05 CPython: py_capi_utils: use more descriptive names for format string utilities. 2018-10-07 12:21:09 -03:00