diff options
author | Thomas Dinges <dingto> | 2022-09-22 18:27:51 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-09-22 18:32:43 +0300 |
commit | 697b447c2069bbbbaa9929aab0ea1f66ef8bf4d0 (patch) | |
tree | f5c78b102b5c1478fb1dbd262b23508f5f072e33 /source/blender/gpu/GPU_material.h | |
parent | bb63b98d1ff5acfd24dff9b5e72175f82f5bca26 (diff) |
Metal: MTLContext implementation and immediate mode rendering support.
MTLContext provides functionality for command encoding, binding management and graphics device management. MTLImmediate provides simple draw enablement with dynamically encoded data. These draws utilise temporary scratch buffer memory to provide minimal bandwidth overhead during workload submission.
This patch also contains empty placeholders for MTLBatch and MTLDrawList to enable testing of first pixels on-screen without failure.
The Metal API also requires access to the GHOST_Context to ensure the same pre-initialized Metal GPU device is used by the viewport. Given the explicit nature of Metal, explicit control is also needed over presentation, to ensure correct work scheduling and rendering pipeline state.
Authored by Apple: Michael Parkin-White
Ref T96261
(The diff is based on 043f59cb3b5835ba1a0bbf6f1cbad080b527f7f6)
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D15953
Diffstat (limited to 'source/blender/gpu/GPU_material.h')
-rw-r--r-- | source/blender/gpu/GPU_material.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h index 922988bf95a..11500f5af60 100644 --- a/source/blender/gpu/GPU_material.h +++ b/source/blender/gpu/GPU_material.h @@ -117,6 +117,15 @@ typedef enum eGPUMaterialStatus { GPU_MAT_SUCCESS, } eGPUMaterialStatus; +/* GPU_MAT_OPTIMIZATION_SKIP for cases where we do not + * plan to perform optimization on a given material. */ +typedef enum eGPUMaterialOptimizationStatus { + GPU_MAT_OPTIMIZATION_SKIP = 0, + GPU_MAT_OPTIMIZATION_READY, + GPU_MAT_OPTIMIZATION_QUEUED, + GPU_MAT_OPTIMIZATION_SUCCESS, +} eGPUMaterialOptimizationStatus; + typedef enum eGPUDefaultValue { GPU_DEFAULT_0 = 0, GPU_DEFAULT_1, @@ -246,6 +255,15 @@ struct Scene *GPU_material_scene(GPUMaterial *material); struct GPUPass *GPU_material_get_pass(GPUMaterial *material); struct GPUShader *GPU_material_get_shader(GPUMaterial *material); const char *GPU_material_get_name(GPUMaterial *material); + +/** + * Material Optimization. + * \note Compiles optimal version of shader graph, populating mat->optimized_pass. + * This operation should always be deferred until existing compilations have completed. + * Default un-optimized materials will still exist for interactive material editing performance. + */ +void GPU_material_optimize(GPUMaterial *mat); + /** * Return can be NULL if it's a world material. */ @@ -256,6 +274,13 @@ struct Material *GPU_material_get_material(GPUMaterial *material); eGPUMaterialStatus GPU_material_status(GPUMaterial *mat); void GPU_material_status_set(GPUMaterial *mat, eGPUMaterialStatus status); +/** + * Return status for async optimization jobs. + */ +eGPUMaterialOptimizationStatus GPU_material_optimization_status(GPUMaterial *mat); +void GPU_material_optimization_status_set(GPUMaterial *mat, eGPUMaterialOptimizationStatus status); +bool GPU_material_optimization_ready(GPUMaterial *mat); + struct GPUUniformBuf *GPU_material_uniform_buffer_get(GPUMaterial *material); /** * Create dynamic UBO from parameters |