[Mesa-dev] [PATCH 3/8] mesa: implement glGet for AMD_framebuffer_multisample_advanced
Marek Olšák
maraeo at gmail.com
Wed Aug 1 23:25:59 UTC 2018
From: Marek Olšák <marek.olsak at amd.com>
---
src/mesa/main/extensions_table.h | 1 +
src/mesa/main/get.c | 8 ++++++++
src/mesa/main/get_hash_params.py | 7 +++++++
src/mesa/main/mtypes.h | 16 ++++++++++++++++
4 files changed, 32 insertions(+)
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 3f01896cae7..bdba49d5380 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -3,20 +3,21 @@
#define GLL 0
#define GLC 0
#define ES1 0
#define ES2 0
#define x ~0
EXT(3DFX_texture_compression_FXT1 , TDFX_texture_compression_FXT1 , GLL, GLC, x , x , 1999)
EXT(AMD_conservative_depth , ARB_conservative_depth , GLL, GLC, x , x , 2009)
EXT(AMD_draw_buffers_blend , ARB_draw_buffers_blend , GLL, GLC, x , x , 2009)
+EXT(AMD_framebuffer_multisample_advanced , AMD_framebuffer_multisample_advanced , GLL, GLC, x , ES2, 2018)
EXT(AMD_performance_monitor , AMD_performance_monitor , GLL, GLC, x , ES2, 2007)
EXT(AMD_pinned_memory , AMD_pinned_memory , GLL, GLC, x , x , 2013)
EXT(AMD_seamless_cubemap_per_texture , AMD_seamless_cubemap_per_texture , GLL, GLC, x , x , 2009)
EXT(AMD_shader_stencil_export , ARB_shader_stencil_export , GLL, GLC, x , x , 2009)
EXT(AMD_shader_trinary_minmax , dummy_true , GLL, GLC, x , x , 2012)
EXT(AMD_vertex_shader_layer , AMD_vertex_shader_layer , GLL, GLC, x , x , 2012)
EXT(AMD_vertex_shader_viewport_index , AMD_vertex_shader_viewport_index , GLL, GLC, x , x , 2012)
EXT(ANDROID_extension_pack_es31a , ANDROID_extension_pack_es31a , x , x , x , 31, 2014)
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index db0079beb51..f870b217db5 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -511,20 +511,21 @@ EXTRA_EXT(ARB_cull_distance);
EXTRA_EXT(EXT_window_rectangles);
EXTRA_EXT(KHR_blend_equation_advanced_coherent);
EXTRA_EXT(OES_primitive_bounding_box);
EXTRA_EXT(ARB_compute_variable_group_size);
EXTRA_EXT(KHR_robustness);
EXTRA_EXT(ARB_sparse_buffer);
EXTRA_EXT(NV_conservative_raster);
EXTRA_EXT(NV_conservative_raster_dilate);
EXTRA_EXT(NV_conservative_raster_pre_snap_triangles);
EXTRA_EXT(ARB_sample_locations);
+EXTRA_EXT(AMD_framebuffer_multisample_advanced);
static const int
extra_ARB_color_buffer_float_or_glcore[] = {
EXT(ARB_color_buffer_float),
EXTRA_API_GL_CORE,
EXTRA_END
};
static const int
extra_NV_primitive_restart[] = {
@@ -1221,20 +1222,27 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu
v->value_uint = width;
else if (d->pname == GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_ARB)
v->value_uint = height;
else
v->value_uint = bits;
}
break;
case GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_ARB:
v->value_uint = MAX_SAMPLE_LOCATION_TABLE_SIZE;
break;
+
+ /* GL_AMD_framebuffer_multisample_advanced */
+ case GL_SUPPORTED_MULTISAMPLE_MODES_AMD:
+ v->value_int_n.n = ctx->Const.NumSupportedMultisampleModes * 3;
+ memcpy(v->value_int_n.ints, ctx->Const.SupportedMultisampleModes,
+ v->value_int_n.n * sizeof(GLint));
+ break;
}
}
/**
* Check extra constraints on a struct value_desc descriptor
*
* If a struct value_desc has a non-NULL extra pointer, it means that
* there are a number of extra constraints to check or actions to
* perform. The extras is just an integer array where each integer
* encode different constraints or actions.
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 618e306e509..5c672a33123 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -361,20 +361,27 @@ descriptor=[
[ "SUBPIXEL_PRECISION_BIAS_Y_BITS_NV", "CONTEXT_UINT(SubpixelPrecisionBias[1]), extra_NV_conservative_raster" ],
[ "MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV", "CONTEXT_UINT(Const.MaxSubpixelPrecisionBiasBits), extra_NV_conservative_raster" ],
# GL_NV_conservative_raster_dilate
[ "CONSERVATIVE_RASTER_DILATE_RANGE_NV", "CONTEXT_FLOAT2(Const.ConservativeRasterDilateRange), extra_NV_conservative_raster_dilate" ],
[ "CONSERVATIVE_RASTER_DILATE_GRANULARITY_NV", "CONTEXT_FLOAT(Const.ConservativeRasterDilateGranularity), extra_NV_conservative_raster_dilate" ],
[ "CONSERVATIVE_RASTER_DILATE_NV", "CONTEXT_FLOAT(ConservativeRasterDilate), extra_NV_conservative_raster_dilate" ],
# GL_NV_conservative_raster_pre_snap_triangles
[ "CONSERVATIVE_RASTER_MODE_NV", "CONTEXT_ENUM16(ConservativeRasterMode), extra_NV_conservative_raster_pre_snap_triangles" ],
+
+# GL_AMD_framebuffer_multisample_advanced
+ [ "MAX_COLOR_FRAMEBUFFER_SAMPLES_AMD", "CONTEXT_INT(Const.MaxColorFramebufferSamples), extra_AMD_framebuffer_multisample_advanced" ],
+ [ "MAX_COLOR_FRAMEBUFFER_STORAGE_SAMPLES_AMD", "CONTEXT_INT(Const.MaxColorFramebufferStorageSamples), extra_AMD_framebuffer_multisample_advanced" ],
+ [ "MAX_DEPTH_STENCIL_FRAMEBUFFER_SAMPLES_AMD", "CONTEXT_INT(Const.MaxDepthStencilFramebufferSamples), extra_AMD_framebuffer_multisample_advanced" ],
+ [ "NUM_SUPPORTED_MULTISAMPLE_MODES_AMD", "CONTEXT_INT(Const.NumSupportedMultisampleModes), extra_AMD_framebuffer_multisample_advanced" ],
+ [ "SUPPORTED_MULTISAMPLE_MODES_AMD", "LOC_CUSTOM, TYPE_INT_N, 0, extra_AMD_framebuffer_multisample_advanced" ],
]},
# GLES3 is not a typo.
{ "apis": ["GL", "GLES", "GLES3", "GL_CORE"], "params": [
# GL_EXT_texture_lod_bias
[ "MAX_TEXTURE_LOD_BIAS_EXT", "CONTEXT_FLOAT(Const.MaxTextureLodBias), NO_EXTRA" ],
]},
# Enums in OpenGL and ES 3.0
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index d71872835d1..f707e1629a5 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3930,20 +3930,35 @@ struct gl_constants
* Disable interpretation of line continuations (lines ending with a
* backslash character ('\') in GLSL source.
*/
GLboolean DisableGLSLLineContinuations;
/** GL_ARB_texture_multisample */
GLint MaxColorTextureSamples;
GLint MaxDepthTextureSamples;
GLint MaxIntegerSamples;
+ /** GL_AMD_framebuffer_multisample_advanced */
+ GLint MaxColorFramebufferSamples;
+ GLint MaxColorFramebufferStorageSamples;
+ GLint MaxDepthStencilFramebufferSamples;
+
+ /* An array of supported MSAA modes allowing different sample
+ * counts per attachment type.
+ */
+ struct {
+ GLint NumColorSamples;
+ GLint NumColorStorageSamples;
+ GLint NumDepthStencilSamples;
+ } SupportedMultisampleModes[40];
+ GLint NumSupportedMultisampleModes;
+
/**
* GL_EXT_texture_multisample_blit_scaled implementation assumes that
* samples are laid out in a rectangular grid roughly corresponding to
* sample locations within a pixel. Below SampleMap{2,4,8}x variables
* are used to map indices of rectangular grid to sample numbers within
* a pixel. This mapping of indices to sample numbers must be initialized
* by the driver for the target hardware. For example, if we have the 8X
* MSAA sample number layout (sample positions) for XYZ hardware:
*
* sample indices layout sample number layout
@@ -4228,20 +4243,21 @@ struct gl_extensions
GLboolean EXT_window_rectangles;
GLboolean OES_copy_image;
GLboolean OES_primitive_bounding_box;
GLboolean OES_sample_variables;
GLboolean OES_standard_derivatives;
GLboolean OES_texture_buffer;
GLboolean OES_texture_cube_map_array;
GLboolean OES_texture_view;
GLboolean OES_viewport_array;
/* vendor extensions */
+ GLboolean AMD_framebuffer_multisample_advanced;
GLboolean AMD_performance_monitor;
GLboolean AMD_pinned_memory;
GLboolean AMD_seamless_cubemap_per_texture;
GLboolean AMD_vertex_shader_layer;
GLboolean AMD_vertex_shader_viewport_index;
GLboolean ANDROID_extension_pack_es31a;
GLboolean APPLE_object_purgeable;
GLboolean ATI_meminfo;
GLboolean ATI_texture_compression_3dc;
GLboolean ATI_texture_mirror_once;
--
2.17.1
More information about the mesa-dev
mailing list