diff options
author | Niklas Haas <git@haasn.xyz> | 2017-09-08 04:27:53 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.xyz> | 2017-09-12 02:57:45 +0200 |
commit | 0c2cb69597f52592bdb58312d9987978cb86a9d3 (patch) | |
tree | 59883f675f41c3302c5b8603f038754993037cd2 /video/out/opengl/ra.h | |
parent | 3faf1fb0a4482712b2177af2f72ef8877f8adc10 (diff) | |
download | mpv-0c2cb69597f52592bdb58312d9987978cb86a9d3.tar.bz2 mpv-0c2cb69597f52592bdb58312d9987978cb86a9d3.tar.xz |
vo_opengl: generalize UBO packing/handling
This is simultaneously generalized into two directions:
1. Support more sc_uniform types (needed for SC_UNIFORM_TYPE_PUSHC)
2. Support more flexible packing (needed for both PUSHC and ra_d3d11)
Diffstat (limited to 'video/out/opengl/ra.h')
-rw-r--r-- | video/out/opengl/ra.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/video/out/opengl/ra.h b/video/out/opengl/ra.h index 81078da41f..46a69f2ff5 100644 --- a/video/out/opengl/ra.h +++ b/video/out/opengl/ra.h @@ -186,6 +186,9 @@ enum ra_vartype { RA_VARTYPE_COUNT }; +// Returns the host size of a ra_vartype, or 0 for abstract vartypes (e.g. tex) +size_t ra_vartype_size(enum ra_vartype type); + // Represents a uniform, texture input parameter, and similar things. struct ra_renderpass_input { const char *name; // name as used in the shader @@ -204,7 +207,16 @@ struct ra_renderpass_input { int binding; }; -size_t ra_render_pass_input_data_size(struct ra_renderpass_input *input); +// Represents the layout requirements of an input value +struct ra_layout { + size_t align; // the alignment requirements (always a power of two) + size_t stride; // the delta between two rows of an array/matrix + size_t size; // the total size of the input +}; + +// Returns the host layout of a render pass input. Returns {0} for renderpass +// inputs without a corresponding host representation (e.g. textures/buffers) +struct ra_layout ra_renderpass_input_layout(struct ra_renderpass_input *input); enum ra_blend { RA_BLEND_ZERO, @@ -370,6 +382,10 @@ struct ra_fns { // NULL then all buffers are always usable. bool (*buf_poll)(struct ra *ra, struct ra_buf *buf); + // Returns the layout requirements of a uniform buffer element. Optional, + // but must be implemented if RA_CAP_BUF_RO is supported. + struct ra_layout (*uniform_layout)(struct ra_renderpass_input *inp); + // Clear the dst with the given color (rgba) and within the given scissor. // dst must have dst->params.render_dst==true. Content outside of the // scissor is preserved. |