[Mesa-dev] [PATCH 1/7] gallium: Add PIPE_CAP_FRAMEBUFFER_LAYERS
Brian Paul
brianp at vmware.com
Mon Feb 1 15:51:41 UTC 2016
On 01/30/2016 11:25 PM, Edward O'Callaghan wrote:
> Add PIPE_CAP to determine the number of layers for
> a framebuffer for GL_ARB_framebuffer_no_attachments.
>
> Signed-off-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
> ---
> src/gallium/docs/source/screen.rst | 2 ++
> src/gallium/drivers/freedreno/freedreno_screen.c | 1 +
> src/gallium/drivers/i915/i915_screen.c | 1 +
> src/gallium/drivers/ilo/ilo_screen.c | 1 +
> src/gallium/drivers/llvmpipe/lp_screen.c | 1 +
> src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 +
> src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 +
> src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 +
> src/gallium/drivers/r300/r300_screen.c | 1 +
> src/gallium/drivers/r600/r600_pipe.c | 1 +
> src/gallium/drivers/radeonsi/si_pipe.c | 1 +
> src/gallium/drivers/softpipe/sp_screen.c | 1 +
> src/gallium/drivers/svga/svga_screen.c | 1 +
> src/gallium/drivers/vc4/vc4_screen.c | 1 +
> src/gallium/drivers/virgl/virgl_screen.c | 1 +
> src/gallium/include/pipe/p_defines.h | 1 +
> src/mesa/state_tracker/st_extensions.c | 13 +++++++++++++
> 17 files changed, 30 insertions(+)
>
> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
> index b461810..c04c5e4 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -306,6 +306,8 @@ The integer capabilities:
> * ``PIPE_CAP_GENERATE_MIPMAP``: Indicates whether pipe_context::generate_mipmap
> is supported.
> * ``PIPE_CAP_STRING_MARKER``: Whether pipe->emit_string_marker() is supported.
> +* ``PIPE_CAP_MAX_FRAMEBUFFER_LAYERS``: Whether `framebuffer_no_attachments`
> + will be available in contexts.
This isn't very clear to me. The PIPE_CAP_MAX_FRAMEBUFFER_LAYERS name
indicates a max value for something, but the description sounds like a
boolean.
It sounds like there's two things being expressed here:
1. can the driver render when the framebuffer has no surfaces?
2. what is the max number of texture layers which can be read/written
when there's no framebuffer surfaces?
And would this value (if non-zero) ever be different than
PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS?
-Brian
BTW, for patches 2, 3, 6: Reviewed-by: Brian Paul <brianp at vmware.com>
>
>
> .. _pipe_capf:
> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
> index 640f50f..11fc54a 100644
> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> @@ -248,6 +248,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
> case PIPE_CAP_INVALIDATE_BUFFER:
> case PIPE_CAP_GENERATE_MIPMAP:
> + case PIPE_CAP_MAX_FRAMEBUFFER_LAYERS:
> return 0;
>
> case PIPE_CAP_MAX_VIEWPORTS:
> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
> index 6b0ab58..d0cb3d4 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -262,6 +262,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
> case PIPE_CAP_INVALIDATE_BUFFER:
> case PIPE_CAP_GENERATE_MIPMAP:
> case PIPE_CAP_STRING_MARKER:
> + case PIPE_CAP_MAX_FRAMEBUFFER_LAYERS:
> return 0;
>
> case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
> diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c
> index 5171cca..916e296 100644
> --- a/src/gallium/drivers/ilo/ilo_screen.c
> +++ b/src/gallium/drivers/ilo/ilo_screen.c
> @@ -486,6 +486,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_INVALIDATE_BUFFER:
> case PIPE_CAP_GENERATE_MIPMAP:
> case PIPE_CAP_STRING_MARKER:
> + case PIPE_CAP_MAX_FRAMEBUFFER_LAYERS:
> return 0;
>
> case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
> index 879a2e7..4484a86 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -311,6 +311,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_INVALIDATE_BUFFER:
> case PIPE_CAP_GENERATE_MIPMAP:
> case PIPE_CAP_STRING_MARKER:
> + case PIPE_CAP_MAX_FRAMEBUFFER_LAYERS:
> return 0;
> }
> /* should only get here on unhandled cases */
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> index 61d91fd..7713cc2 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -184,6 +184,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_INVALIDATE_BUFFER:
> case PIPE_CAP_GENERATE_MIPMAP:
> case PIPE_CAP_STRING_MARKER:
> + case PIPE_CAP_MAX_FRAMEBUFFER_LAYERS:
> return 0;
>
> case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> index 32da60e..8ad862e 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -227,6 +227,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_INVALIDATE_BUFFER:
> case PIPE_CAP_GENERATE_MIPMAP:
> case PIPE_CAP_STRING_MARKER:
> + case PIPE_CAP_MAX_FRAMEBUFFER_LAYERS:
> return 0;
>
> case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index 6daa224..c405119 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -217,6 +217,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_INVALIDATE_BUFFER:
> case PIPE_CAP_GENERATE_MIPMAP:
> case PIPE_CAP_STRING_MARKER:
> + case PIPE_CAP_MAX_FRAMEBUFFER_LAYERS:
> return 0;
>
> case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
> index 90c4f71..da11fe6 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -210,6 +210,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
> case PIPE_CAP_INVALIDATE_BUFFER:
> case PIPE_CAP_GENERATE_MIPMAP:
> case PIPE_CAP_STRING_MARKER:
> + case PIPE_CAP_MAX_FRAMEBUFFER_LAYERS:
> return 0;
>
> /* SWTCL-only features. */
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index 9b0f312..f941825 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -364,6 +364,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
> case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
> case PIPE_CAP_GENERATE_MIPMAP:
> case PIPE_CAP_STRING_MARKER:
> + case PIPE_CAP_MAX_FRAMEBUFFER_LAYERS:
> return 0;
>
> case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index f483f92..f219bc4 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -354,6 +354,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
> case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
> case PIPE_CAP_GENERATE_MIPMAP:
> case PIPE_CAP_STRING_MARKER:
> + case PIPE_CAP_MAX_FRAMEBUFFER_LAYERS:
> return 0;
>
> case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
> index 3bc5808..f3215e7 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -261,6 +261,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_INVALIDATE_BUFFER:
> case PIPE_CAP_GENERATE_MIPMAP:
> case PIPE_CAP_STRING_MARKER:
> + case PIPE_CAP_MAX_FRAMEBUFFER_LAYERS:
> return 0;
> }
> /* should only get here on unhandled cases */
> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
> index 8d04222..dc852d5 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -396,6 +396,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_DRAW_PARAMETERS:
> case PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL:
> case PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL:
> + case PIPE_CAP_MAX_FRAMEBUFFER_LAYERS:
> return 0;
> }
>
> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
> index 08c2dad..233f80a 100644
> --- a/src/gallium/drivers/vc4/vc4_screen.c
> +++ b/src/gallium/drivers/vc4/vc4_screen.c
> @@ -199,6 +199,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
> case PIPE_CAP_INVALIDATE_BUFFER:
> case PIPE_CAP_GENERATE_MIPMAP:
> case PIPE_CAP_STRING_MARKER:
> + case PIPE_CAP_MAX_FRAMEBUFFER_LAYERS:
> return 0;
>
> /* Stream output. */
> diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
> index fb2e567..5b7659e 100644
> --- a/src/gallium/drivers/virgl/virgl_screen.c
> +++ b/src/gallium/drivers/virgl/virgl_screen.c
> @@ -228,6 +228,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
> case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
> case PIPE_CAP_INVALIDATE_BUFFER:
> case PIPE_CAP_GENERATE_MIPMAP:
> + case PIPE_CAP_MAX_FRAMEBUFFER_LAYERS:
> return 0;
> case PIPE_CAP_VENDOR_ID:
> return 0x1af4;
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index 335f4e6..b39d11c 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -646,6 +646,7 @@ enum pipe_cap
> PIPE_CAP_INVALIDATE_BUFFER,
> PIPE_CAP_GENERATE_MIPMAP,
> PIPE_CAP_STRING_MARKER,
> + PIPE_CAP_MAX_FRAMEBUFFER_LAYERS,
> };
>
> #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index d066784..99105bd 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -490,6 +490,7 @@ void st_init_extensions(struct pipe_screen *screen,
> { o(ARB_fragment_program_shadow), PIPE_CAP_TEXTURE_SHADOW_MAP },
> { o(ARB_framebuffer_object), PIPE_CAP_MIXED_FRAMEBUFFER_SIZES },
> { o(ARB_indirect_parameters), PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS },
> + { o(ARB_framebuffer_no_attachments), PIPE_CAP_MAX_FRAMEBUFFER_LAYERS },
> { o(ARB_instanced_arrays), PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR },
> { o(ARB_occlusion_query), PIPE_CAP_OCCLUSION_QUERY },
> { o(ARB_occlusion_query2), PIPE_CAP_OCCLUSION_QUERY },
> @@ -962,6 +963,18 @@ void st_init_extensions(struct pipe_screen *screen,
> extensions->AMD_vertex_shader_viewport_index = GL_TRUE;
> }
>
> + /* ARB_framebuffer_no_attachments */
> + consts->MaxFramebufferWidth = consts->MaxViewportWidth;
> + consts->MaxFramebufferHeight = consts->MaxViewportHeight;
> + consts->MaxFramebufferSamples = consts->MaxSamples;
> + consts->MaxFramebufferLayers
> + = screen->get_param(screen, PIPE_CAP_MAX_FRAMEBUFFER_LAYERS);
> + if ((consts->MaxSamples >= 4 && consts->MaxFramebufferLayers >= 2048)
> + || (consts->MaxFramebufferSamples >= consts->MaxSamples &&
> + consts->MaxFramebufferLayers >= consts->MaxArrayTextureLayers))
> + extensions->ARB_framebuffer_no_attachments = GL_TRUE;
> +
> +
> /* GL_ARB_ES3_compatibility.
> *
> * Assume that ES3 is supported if GLSL 3.30 is supported.
>
More information about the mesa-dev
mailing list