Commit Graph

45 Commits

Author SHA1 Message Date
9a9f39e466 Cleanup: remove redundant 'char *' casts 2019-12-20 10:42:57 +11:00
0ec6564668 Cleanup: unused headers (GPU) 2019-09-14 00:22:24 +10:00
14b2c41216 Cleanup: doxy sections 2019-08-02 12:30:57 +10:00
f2da21e052 Python GPU Shader: Fix crash when uniform is not found.
Error in string format.
2019-06-05 08:45:12 -03:00
e12c08e8d1 ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.

For details on usage and instructions for migrating branches
without conflicts, see:

https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-17 06:21:24 +02:00
de13d0a80c doxygen: add newline after \file
While \file doesn't need an argument, it can't have another doxy
command after it.
2019-02-18 08:22:12 +11:00
eef4077f18 Cleanup: remove redundant doxygen \file argument
Move \ingroup onto same line to be more compact and
make it clear the file is in the group.
2019-02-06 15:45:22 +11:00
744f633986 Cleanup: trailing commas
Needed for clan-format not to wrap onto one line.
2019-02-03 14:59:11 +11:00
65ec7ec524 Cleanup: remove redundant, invalid info from headers
BF-admins agree to remove header information that isn't useful,
to reduce noise.

- BEGIN/END license blocks

  Developers should add non license comments as separate comment blocks.
  No need for separator text.

- Contributors

  This is often invalid, outdated or misleading
  especially when splitting files.

  It's more useful to git-blame to find out who has developed the code.

See P901 for script to perform these edits.
2019-02-02 01:36:28 +11:00
f20dbc293f Cleanup: blank lines over doxy headers 2019-01-26 21:43:24 +11:00
2e4f1b592f Cleanup: use eGPU prefix for GPU enum types 2019-01-23 14:16:03 +11:00
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
69a9bcc206 minor cleanup 2018-11-14 13:06:11 +01:00
61ecd3d24e minor cleanup 2018-11-14 13:06: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
444f1fd423 Py API Docs: Cleanup 2018-11-13 15:25:51 +01:00
a8e9959e07 API Docs: gpu api introduction + examples 2018-11-05 19:28:28 +01:00
974d158f3f PyAPI: GPU: improve GPUShader.from_builtin and GPUShader.code_from_builtin description. 2018-10-30 11:38:42 -03: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
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
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
c15439bcdc Cleanup: use PyModule_AddIntConstant 2018-10-04 23:53:57 -03:00
ee6c8be183 GPU Python: rename methods "shader_from_builtin" and "shader_code_from_builtin" to "from_builtin" and "code_from_builtin". 2018-10-04 13:51:21 -03:00
b183f57a9e GPU Python: Fix assert in PySequence_Fast_GET_SIZE 2018-10-04 13:49:06 -03:00
46eb050c9d Cleanup: remove single backtick quotes
This isn't valid RST.
2018-10-04 13:08:28 +10:00
ffa15f4b4a Python GPU: GPUBatch and GPUShader refactor.
The changes are:
- The shader now is passed as a parameter of the batch `draw` method (batch.draw(shader)). Since the batch always has to set a shader before drawing;
- The batch methods to specify a value to a uniform have been removed. Uniforms are parameters of the program (here called shader). If you change a uniform, it changes in all batchs that use the same program;
- New methods were added to set uniforms by the shader;
- The `batch.program_set_builtin` was removed. It is a duplicate of `program_set` but without a shader object. We need the shader object to configure the uniform;

Differential Revision: https://developer.blender.org/D3752
2018-10-03 23:34:27 -03:00
1e647a570d Python GPU module: replace PyArg_ParseTupleAndKeywords by _PyArg_ParseTupleAndKeywordsFast
part of T47811 ("for faster argument parsing").
2018-09-27 00:22:57 -03:00
08c7733c13 Cleanup: style 2018-09-21 08:11:50 +10:00
Dalai Felinto
425cfdd5be GPU Python API: shader.uniform_float
The existing alternative is to use a buffer and call
uniform_vector_float which is overkill for such a simple operation.
2018-09-20 19:51:06 +00:00
Dalai Felinto
e316e41f84 Typo on pydoc for uniform_int 2018-09-20 19:49:08 +00:00
9fb9604c19 gpu.shader module: Do not free builtin shaders. 2018-09-20 15:21:59 -03:00
9c2dc808ce gpu.shader.builtin module: Add GPU_SHADER_2D_IMAGE. 2018-09-20 13:55:43 -03:00
83d4328ce7 PyDoc: add gpu.shader
Also some syntax corrections.
2018-09-15 10:35:03 +10:00
1287965089 GPU module: Initial implementation of the gpu.shader submodule.
Differential Revision: https://developer.blender.org/D3688
2018-09-14 09:46:19 -03:00