diff options
author | Indrajit Kumar Das <[email protected]> | 2020-04-21 16:00:14 +0530 |
---|---|---|
committer | Indrajit Kumar Das <[email protected]> | 2020-04-23 12:02:45 +0530 |
commit | ede36a2efe4d40c0ec81f465fdde761a7c335290 (patch) | |
tree | 724b39cd740e1de97fc37533369f9f1cd8881dd8 /src/mesa | |
parent | d82f0572180a0d3f4bb87cf49c325439d38ab6e3 (diff) |
mesa: add support for AlphaToCoverageDitherControlNV
Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4543>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/attrib.c | 2 | ||||
-rw-r--r-- | src/mesa/main/extensions_table.h | 1 | ||||
-rw-r--r-- | src/mesa/main/get_hash_params.py | 3 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 4 | ||||
-rw-r--r-- | src/mesa/main/multisample.c | 31 | ||||
-rw-r--r-- | src/mesa/main/multisample.h | 6 | ||||
-rw-r--r-- | src/mesa/main/tests/dispatch_sanity.cpp | 4 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_atom_blend.c | 3 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 1 |
9 files changed, 55 insertions, 0 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 35231335813..e95bf19846b 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1519,6 +1519,8 @@ _mesa_PopAttrib(void) _mesa_SampleCoverage(ms->SampleCoverageValue, ms->SampleCoverageInvert); + + _mesa_AlphaToCoverageDitherControlNV(ms->SampleAlphaToCoverageDitherControl); } break; diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h index 66f5d2e9d9d..18d5f8073bf 100644 --- a/src/mesa/main/extensions_table.h +++ b/src/mesa/main/extensions_table.h @@ -371,6 +371,7 @@ EXT(MESA_ycbcr_texture , MESA_ycbcr_texture EXT(NVX_gpu_memory_info , NVX_gpu_memory_info , GLL, GLC, x , x , 2013) +EXT(NV_alpha_to_coverage_dither_control , NV_alpha_to_coverage_dither_control , GLL, GLC, x , ES2, 2017) EXT(NV_blend_square , dummy_true , GLL, x , x , x , 1999) EXT(NV_compute_shader_derivatives , NV_compute_shader_derivatives , GLL, GLC, x , 32, 2018) EXT(NV_conditional_render , NV_conditional_render , GLL, GLC, x , ES2, 2008) diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index 31563679593..1e09c48aca0 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -382,6 +382,9 @@ descriptor=[ [ "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" ], + +# GL_NV_alpha_to_coverage_dither_control + [ "ALPHA_TO_COVERAGE_DITHER_MODE_NV", "CONTEXT_ENUM(Multisample.SampleAlphaToCoverageDitherControl ), NO_EXTRA" ], ]}, # GLES3 is not a typo. diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 62f1e9be5bc..1f1e8e7ada0 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -689,6 +689,9 @@ struct gl_multisample_attrib /** The GL spec defines this as an array but >32x MSAA is madness */ GLbitfield SampleMaskValue; + + /* NV_alpha_to_coverage_dither_control */ + GLenum SampleAlphaToCoverageDitherControl; }; @@ -4387,6 +4390,7 @@ struct gl_extensions GLboolean EXT_shader_framebuffer_fetch_non_coherent; GLboolean MESA_shader_integer_functions; GLboolean MESA_ycbcr_texture; + GLboolean NV_alpha_to_coverage_dither_control; GLboolean NV_compute_shader_derivatives; GLboolean NV_conditional_render; GLboolean NV_copy_image; diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c index d494a43ac7d..66eb0c8b98e 100644 --- a/src/mesa/main/multisample.c +++ b/src/mesa/main/multisample.c @@ -63,6 +63,7 @@ _mesa_init_multisample(struct gl_context *ctx) { ctx->Multisample.Enabled = GL_TRUE; ctx->Multisample.SampleAlphaToCoverage = GL_FALSE; + ctx->Multisample.SampleAlphaToCoverageDitherControl = GL_ALPHA_TO_COVERAGE_DITHER_DEFAULT_NV; ctx->Multisample.SampleAlphaToOne = GL_FALSE; ctx->Multisample.SampleCoverage = GL_FALSE; ctx->Multisample.SampleCoverageValue = 1.0; @@ -351,3 +352,33 @@ _mesa_check_sample_count(struct gl_context *ctx, GLenum target, return (GLuint) samples > ctx->Const.MaxSamples ? GL_INVALID_VALUE : GL_NO_ERROR; } + +void GLAPIENTRY +_mesa_AlphaToCoverageDitherControlNV_no_error(GLenum mode) +{ + GET_CURRENT_CONTEXT(ctx); + + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleAlphaToXEnable ? 0 : + _NEW_MULTISAMPLE); + ctx->NewDriverState |= ctx->DriverFlags.NewSampleAlphaToXEnable; + ctx->Multisample.SampleAlphaToCoverageDitherControl = mode; +} + +void GLAPIENTRY +_mesa_AlphaToCoverageDitherControlNV(GLenum mode) +{ + GET_CURRENT_CONTEXT(ctx); + + FLUSH_VERTICES(ctx, ctx->DriverFlags.NewSampleAlphaToXEnable ? 0 : + _NEW_MULTISAMPLE); + ctx->NewDriverState |= ctx->DriverFlags.NewSampleAlphaToXEnable; + switch (mode) { + case GL_ALPHA_TO_COVERAGE_DITHER_DEFAULT_NV: + case GL_ALPHA_TO_COVERAGE_DITHER_ENABLE_NV: + case GL_ALPHA_TO_COVERAGE_DITHER_DISABLE_NV: + ctx->Multisample.SampleAlphaToCoverageDitherControl = mode; + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "glAlphaToCoverageDitherControlNV(invalid parameter)"); + } +} diff --git a/src/mesa/main/multisample.h b/src/mesa/main/multisample.h index 49683cacdc9..9cd4724947a 100644 --- a/src/mesa/main/multisample.h +++ b/src/mesa/main/multisample.h @@ -58,4 +58,10 @@ _mesa_check_sample_count(struct gl_context *ctx, GLenum target, GLenum internalFormat, GLsizei samples, GLsizei storageSamples); +extern void GLAPIENTRY +_mesa_AlphaToCoverageDitherControlNV_no_error(GLenum mode); + +extern void GLAPIENTRY +_mesa_AlphaToCoverageDitherControlNV(GLenum mode); + #endif diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 69dd56598e2..0fe3c9c348c 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -911,6 +911,10 @@ const struct function common_desktop_functions_possible[] = { { "glDepthRangeArrayv", 43, -1 }, { "glDepthRangeIndexed", 43, -1 }, +/* GL 4.4 */ + /* GL_NV_alpha_to_coverage_dither_control */ + { "glAlphaToCoverageDitherControlNV", 44, -1 }, + /* GL 4.5 */ /* aliased versions checked above */ //{ "glGetGraphicsResetStatus", 45, -1 }, diff --git a/src/mesa/state_tracker/st_atom_blend.c b/src/mesa/state_tracker/st_atom_blend.c index 10e9b6a38c4..35c99b9f089 100644 --- a/src/mesa/state_tracker/st_atom_blend.c +++ b/src/mesa/state_tracker/st_atom_blend.c @@ -287,6 +287,9 @@ st_update_blend( struct st_context *st ) */ blend->alpha_to_coverage = ctx->Multisample.SampleAlphaToCoverage; blend->alpha_to_one = ctx->Multisample.SampleAlphaToOne; + blend->alpha_to_coverage_dither = + ctx->Multisample.SampleAlphaToCoverageDitherControl != + GL_ALPHA_TO_COVERAGE_DITHER_DISABLE_NV; } cso_set_blend(st->cso_context, blend); diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 42d8a5b9f51..b0ee3e2210a 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -799,6 +799,7 @@ void st_init_extensions(struct pipe_screen *screen, { o(INTEL_conservative_rasterization), PIPE_CAP_CONSERVATIVE_RASTER_INNER_COVERAGE }, { o(INTEL_shader_atomic_float_minmax), PIPE_CAP_ATOMIC_FLOAT_MINMAX }, { o(MESA_tile_raster_order), PIPE_CAP_TILE_RASTER_ORDER }, + { o(NV_alpha_to_coverage_dither_control), PIPE_CAP_ALPHA_TO_COVERAGE_DITHER_CONTROL }, { o(NV_compute_shader_derivatives), PIPE_CAP_COMPUTE_SHADER_DERIVATIVES }, { o(NV_conditional_render), PIPE_CAP_CONDITIONAL_RENDER }, { o(NV_fill_rectangle), PIPE_CAP_POLYGON_MODE_FILL_RECTANGLE }, |