radv: don't store the number of samples as log2
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 19 Jun 2018 12:25:47 +0000 (14:25 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 20 Jun 2018 11:21:42 +0000 (13:21 +0200)
Needed for the following patch.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_nir_to_llvm.c
src/amd/vulkan/radv_pipeline.c
src/amd/vulkan/radv_private.h
src/amd/vulkan/radv_shader.h

index 21f2e9d26ba088d36f69fb744b95c98acfe47b75..d45af9d0fc3f9237aa1826689a06e264eae78727 100644 (file)
@@ -1648,9 +1648,14 @@ static LLVMValueRef load_sample_position(struct ac_shader_abi *abi,
 static LLVMValueRef load_sample_mask_in(struct ac_shader_abi *abi)
 {
        struct radv_shader_context *ctx = radv_shader_context_from_abi(abi);
-       uint8_t log2_ps_iter_samples = ctx->shader_info->info.ps.force_persample ?
-               ctx->options->key.fs.log2_num_samples :
-               ctx->options->key.fs.log2_ps_iter_samples;
+       uint8_t log2_ps_iter_samples;
+
+       if (ctx->shader_info->info.ps.force_persample) {
+               log2_ps_iter_samples =
+                       util_logbase2(ctx->options->key.fs.num_samples);
+       } else {
+               log2_ps_iter_samples = ctx->options->key.fs.log2_ps_iter_samples;
+       }
 
        /* The bit pattern matches that used by fixed function fragment
         * processing. */
index 70a8c63c926105a5e5fb10ade0bbc01ee5e9bb9e..54faddf5882a35411020ce35e7d951a9fcfaab36 100644 (file)
@@ -1868,7 +1868,7 @@ radv_generate_graphics_pipeline_key(struct radv_pipeline *pipeline,
            pCreateInfo->pMultisampleState->rasterizationSamples > 1) {
                uint32_t num_samples = pCreateInfo->pMultisampleState->rasterizationSamples;
                uint32_t ps_iter_samples = radv_pipeline_get_ps_iter_samples(pCreateInfo->pMultisampleState);
-               key.log2_num_samples = util_logbase2(num_samples);
+               key.num_samples = num_samples;
                key.log2_ps_iter_samples = util_logbase2(ps_iter_samples);
        }
 
@@ -1912,7 +1912,7 @@ radv_fill_shader_keys(struct radv_shader_variant_key *keys,
        keys[MESA_SHADER_FRAGMENT].fs.is_int8 = key->is_int8;
        keys[MESA_SHADER_FRAGMENT].fs.is_int10 = key->is_int10;
        keys[MESA_SHADER_FRAGMENT].fs.log2_ps_iter_samples = key->log2_ps_iter_samples;
-       keys[MESA_SHADER_FRAGMENT].fs.log2_num_samples = key->log2_num_samples;
+       keys[MESA_SHADER_FRAGMENT].fs.num_samples = key->num_samples;
 }
 
 static void
index abaf2eb929a58698d1cc2ff1a69ec8e4f4342f8f..27440da595e2482d07b9ab39d2d456b3d8f8847b 100644 (file)
@@ -361,7 +361,7 @@ struct radv_pipeline_key {
        uint32_t is_int8;
        uint32_t is_int10;
        uint8_t log2_ps_iter_samples;
-       uint8_t log2_num_samples;
+       uint8_t num_samples;
        uint32_t has_multiview_view_index : 1;
        uint32_t optimisations_disabled : 1;
 };
index e95bbfca89457d9dce74e6770625229a549e9a8b..7a35f9346da98c722af264cf93939a07bf4c6b7f 100644 (file)
@@ -95,7 +95,7 @@ struct radv_tcs_variant_key {
 struct radv_fs_variant_key {
        uint32_t col_format;
        uint8_t log2_ps_iter_samples;
-       uint8_t log2_num_samples;
+       uint8_t num_samples;
        uint32_t is_int8;
        uint32_t is_int10;
 };