{"id":20989637,"url":"https://github.com/redorav/ddspp","last_synced_at":"2025-09-11T12:35:37.028Z","repository":{"id":86843781,"uuid":"142486452","full_name":"redorav/ddspp","owner":"redorav","description":"Single file DDS header encoder and decoder","archived":false,"fork":false,"pushed_at":"2024-09-09T21:17:03.000Z","size":1926,"stargazers_count":70,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-04T05:39:47.332Z","etag":null,"topics":["d3d","d3d11","d3d12","d3d9","dds","graphics","vulkan"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redorav.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-26T19:42:43.000Z","updated_at":"2025-02-21T13:56:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"3ca88f2a-d297-4faa-879e-b276a07db806","html_url":"https://github.com/redorav/ddspp","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redorav%2Fddspp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redorav%2Fddspp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redorav%2Fddspp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redorav%2Fddspp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redorav","download_url":"https://codeload.github.com/redorav/ddspp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243960667,"owners_count":20375104,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["d3d","d3d11","d3d12","d3d9","dds","graphics","vulkan"],"created_at":"2024-11-19T06:25:37.851Z","updated_at":"2025-03-17T02:06:18.777Z","avatar_url":"https://github.com/redorav.png","language":"C++","readme":"# DDS++\n\nDDS image readers are typically not multiplatform and pull in many extra headers (e.g. the fantastic [gli](https://github.com/g-truc/gli) or [Microsoft DirectXTex](https://github.com/Microsoft/DirectXTex)) This single no-dependency header can decode and encode the DDS headers and compute the mipmap and slice offset of a given DDS texture. It is meant as an aid to provide this information directly to graphics APIs to upload data to the GPU.\n\n## Usage\n\nThe code below is not meant to be an exhaustive example on how to create textures from a DDS file, merely a guideline of how you would go about using this in your own engine/API.\n\n```cpp\n#include \"ddspp.h\"\n\n// Load image as a stream of bytes\nconst char* ddsData = ...\n\n// Decode header and get pointer to initial data\nddspp::Descriptor desc;\nddspp::Result decodeResult = ddspp::decode_header(ddsData, desc);\n\n// Feed to the graphics API\nif(decodeResult == ddspp::Success)\n{\n    const char* initialData = ddsData + desc.headerSize;\n\n    // D3D example\n    {\n        D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc = {};\n        srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;\n        srvDesc.Format = desc.format; // Maps directly to D3D\n        if(desc.type == ddspp::Texture2D)\n        {\n            if(desc.arraySize \u003e 1)\n            {\n                srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2DARRAY;\n                srvDesc.Texture2DArray.MipLevels = desc.numMips;\n                srvDesc.Texture2DArray.ArraySize = desc.arraySize;\n            }\n            else\n            {\n                srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;\n                srvDesc.Texture2D.MipLevels = desc.mipMapCount;\n            }\n        }\n        // ... Fill in the rest\n    }\n\n    // Vulkan Example\n    {\n        VkImageCreateInfo imageCreateInfo = {};\n        imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;\n        imageCreateInfo.pNext = nullptr;\n        imageCreateInfo.format = GetVulkanFormat(desc.format); // Translate DXGI format to Vulkan\n        imageCreateInfo.extent = { desc.width, desc.height, desc.depth };\n        imageCreateInfo.mipLevels = desc.numMips;\n        imageCreateInfo.arrayLayers = desc.arraySize;\n        if(desc.type == ddspp::Texture2D)\n        {\n            imageCreateInfo.imageType = VK_IMAGE_TYPE_2D;\n        }\n        // ... Fill in the rest\n    }\n}\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredorav%2Fddspp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredorav%2Fddspp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredorav%2Fddspp/lists"}