<commit_before>#include "nova_renderer/loading/shader_includer.hpp"

#include "rx/core/log.h"

namespace nova::renderer {
    RX_LOG("NovaDxcIncludeHandler", logger);

    constexpr const char* STANDARD_PIPELINE_LAYOUT_FILE_NAME = "./nova/standard_pipeline_layout.hlsl";

    NovaDxcIncludeHandler::NovaDxcIncludeHandler(rx::memory::allocator& allocator, IDxcLibrary& library)
        : allocator{allocator}, library{library}, builtin_files{&allocator} {
        const auto standard_pipeline_layout_hlsl = R"(
struct Camera {
    float4x4 view;
    float4x4 projection;
};

/*!
 * \brief All the push constants that are available to a shader that uses the standard pipeline layout
 */
[[vk::push_constant]]
struct StandardPushConstants {
    /*!
     * \brief Index of the camera that will render this draw
     */
    uint camera_index;

    /*!
     * \brief Index of the material data for the current draw
     */
    uint material_index;
} constants;

/*!
 * \brief Array of all the materials 
 */
[[vk::binding(0, 0)]]
StructuredBuffer<Camera> cameras : register (t0);

/*!
 * \brief Array of all the materials 
 */
[[vk::binding(1, 0)]]
StructuredBuffer<MaterialData> material_buffer : register (t1);

/*!
 * \brief Point sampler you can use to sample any texture
 */
[[vk::binding(2, 0)]]
SamplerState point_sampler : register(s0);

/*!
 * \brief Bilinear sampler you can use to sample any texture
 */
[[vk::binding(3, 0)]]
SamplerState bilinear_filter : register(s1);

/*!
 * \brief Trilinear sampler you can use to sample any texture
 */
[[vk::binding(4, 0)]]
SamplerState trilinear_filter : register(s3);

/*!
 * \brief Array of all the textures that are available for a shader to sample from
 */
[[vk::binding(5, 0)]]
Texture2D textures[] : register(t3);
        )";

        builtin_files.insert(STANDARD_PIPELINE_LAYOUT_FILE_NAME, standard_pipeline_layout_hlsl);
    }

    HRESULT NovaDxcIncludeHandler::QueryInterface(const REFIID class_id, void** output_object) {
        if(!output_object) {
            return E_INVALIDARG;
        }

        *output_object = nullptr;

        if(class_id == IID_IUnknown || class_id == __uuidof(IDxcIncludeHandler)) {
            *output_object = reinterpret_cast<LPVOID>(this);
            AddRef();

            return 0;<commit_msg>[includer] Fix QueryInterface to be non-conformant but also Linux-compatible<commit_after>#include "nova_renderer/loading/shader_includer.hpp"

#include "rx/core/log.h"

namespace nova::renderer {
    RX_LOG("NovaDxcIncludeHandler", logger);

    constexpr const char* STANDARD_PIPELINE_LAYOUT_FILE_NAME = "./nova/standard_pipeline_layout.hlsl";

    NovaDxcIncludeHandler::NovaDxcIncludeHandler(rx::memory::allocator& allocator, IDxcLibrary& library)
        : allocator{allocator}, library{library}, builtin_files{&allocator} {
        const auto standard_pipeline_layout_hlsl = R"(
struct Camera {
    float4x4 view;
    float4x4 projection;
};

/*!
 * \brief All the push constants that are available to a shader that uses the standard pipeline layout
 */
[[vk::push_constant]]
struct StandardPushConstants {
    /*!
     * \brief Index of the camera that will render this draw
     */
    uint camera_index;

    /*!
     * \brief Index of the material data for the current draw
     */
    uint material_index;
} constants;

/*!
 * \brief Array of all the materials 
 */
[[vk::binding(0, 0)]]
StructuredBuffer<Camera> cameras : register (t0);

/*!
 * \brief Array of all the materials 
 */
[[vk::binding(1, 0)]]
StructuredBuffer<MaterialData> material_buffer : register (t1);

/*!
 * \brief Point sampler you can use to sample any texture
 */
[[vk::binding(2, 0)]]
SamplerState point_sampler : register(s0);

/*!
 * \brief Bilinear sampler you can use to sample any texture
 */
[[vk::binding(3, 0)]]
SamplerState bilinear_filter : register(s1);

/*!
 * \brief Trilinear sampler you can use to sample any texture
 */
[[vk::binding(4, 0)]]
SamplerState trilinear_filter : register(s3);

/*!
 * \brief Array of all the textures that are available for a shader to sample from
 */
[[vk::binding(5, 0)]]
Texture2D textures[] : register(t3);
        )";

        builtin_files.insert(STANDARD_PIPELINE_LAYOUT_FILE_NAME, standard_pipeline_layout_hlsl);
    }

    HRESULT NovaDxcIncludeHandler::QueryInterface(const REFIID class_id, void** output_object) {
        if(!output_object) {
            return E_INVALIDARG;
        }

        *output_object = nullptr;

        if(class_id == __uuidof(IDxcIncludeHandler)) {
            *output_object = reinterpret_cast<LPVOID>(this);
            AddRef();

            return 0;
{'fraction_non_alphanumeric': 0.11667751030145304, 'fraction_numerical': 0.01040988939492518, 'mean_word_length': 3.72057318321392, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6949170', 'n_tokens_mistral': 1480, 'n_tokens_neox': 1421, 'n_words': 377}