mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-12 02:41:14 +00:00
* Add camera position to the rendering * Rebase with anders' camera code * Add perspective matrix * Add (at least) a better fov * Fix formatting * Zero out matrix in perspective function * Fix formatting again * Make functions static in D3DRM viewport code Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com> * Implement GetGroupMaterial() (#175) * Fix naming conflict * Fix conflict in HMM_Perspective_LH_NO * Fix formating --------- Co-authored-by: Anders Jenbo <anders@jenbo.dk> Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
147 lines
4.9 KiB
C++
147 lines
4.9 KiB
C++
// clang-format off
|
|
|
|
// +==============================================+
|
|
// | This file is auto-generated, do not edit it. |
|
|
// +==============================================+
|
|
|
|
#include "ShaderIndex.h"
|
|
|
|
#include "PositionColor.vert.h"
|
|
#include "SolidColor.frag.h"
|
|
|
|
#if defined(SDL_PLATFORM_WINDOWS)
|
|
static const SDL_GPUShaderCreateInfo VertexShaderDXILCodes[] = {
|
|
// VertexShaderId::SolidColor
|
|
{
|
|
/* code_size */ sizeof(PositionColor_vert_dxil),
|
|
/* code */ PositionColor_vert_dxil,
|
|
/* entrypoint */ "main",
|
|
/* format */ SDL_GPU_SHADERFORMAT_DXIL,
|
|
/* stage */ SDL_GPU_SHADERSTAGE_VERTEX,
|
|
/* num_samplers */ 0,
|
|
/* num_storage_textures */ 0,
|
|
/* num_storage_buffers */ 0,
|
|
/* num_uniform_buffers */ 1,
|
|
},
|
|
};
|
|
#endif
|
|
|
|
#if defined(SDL_PLATFORM_APPLE)
|
|
static const SDL_GPUShaderCreateInfo VertexShaderMSLCodes[] = {
|
|
{
|
|
/* code_size */ sizeof(PositionColor_vert_msl),
|
|
/* code */ PositionColor_vert_msl,
|
|
/* entrypoint */ "main0",
|
|
/* format */ SDL_GPU_SHADERFORMAT_MSL,
|
|
/* stage */ SDL_GPU_SHADERSTAGE_VERTEX,
|
|
/* num_samplers */ 0,
|
|
/* num_storage_textures */ 0,
|
|
/* num_storage_buffers */ 0,
|
|
/* num_uniform_buffers */ 1,
|
|
},
|
|
};
|
|
#endif
|
|
|
|
static const SDL_GPUShaderCreateInfo VertexShaderSPIRVCodes[] = {
|
|
{
|
|
/* code_size */ sizeof(PositionColor_vert_spirv),
|
|
/* code */ PositionColor_vert_spirv,
|
|
/* entrypoint */ "main",
|
|
/* format */ SDL_GPU_SHADERFORMAT_SPIRV,
|
|
/* stage */ SDL_GPU_SHADERSTAGE_VERTEX,
|
|
/* num_samplers */ 0,
|
|
/* num_storage_textures */ 0,
|
|
/* num_storage_buffers */ 0,
|
|
/* num_uniform_buffers */ 1,
|
|
},
|
|
};
|
|
|
|
#if defined(SDL_PLATFORM_WINDOWS)
|
|
static const SDL_GPUShaderCreateInfo FragmentShaderDXILCodes[] = {
|
|
// FragmentShaderId::PositionColor
|
|
{
|
|
/* code_size */ sizeof(SolidColor_frag_dxil),
|
|
/* code */ SolidColor_frag_dxil,
|
|
/* entrypoint */ "main",
|
|
/* format */ SDL_GPU_SHADERFORMAT_DXIL,
|
|
/* stage */ SDL_GPU_SHADERSTAGE_FRAGMENT,
|
|
/* num_samplers */ 0,
|
|
/* num_storage_textures */ 0,
|
|
/* num_storage_buffers */ 0,
|
|
/* num_uniform_buffers */ 0,
|
|
},
|
|
};
|
|
#endif
|
|
|
|
#if defined(SDL_PLATFORM_APPLE)
|
|
static const SDL_GPUShaderCreateInfo FragmentShaderMSLCodes[] = {
|
|
{
|
|
/* code_size */ sizeof(SolidColor_frag_msl),
|
|
/* code */ SolidColor_frag_msl,
|
|
/* entrypoint */ "main0",
|
|
/* format */ SDL_GPU_SHADERFORMAT_MSL,
|
|
/* stage */ SDL_GPU_SHADERSTAGE_FRAGMENT,
|
|
/* num_samplers */ 0,
|
|
/* num_storage_textures */ 0,
|
|
/* num_storage_buffers */ 0,
|
|
/* num_uniform_buffers */ 0,
|
|
},
|
|
};
|
|
#endif
|
|
|
|
static const SDL_GPUShaderCreateInfo FragmentShaderSPIRVCodes[] = {
|
|
{
|
|
/* code_size */ sizeof(SolidColor_frag_spirv),
|
|
/* code */ SolidColor_frag_spirv,
|
|
/* entrypoint */ "main",
|
|
/* format */ SDL_GPU_SHADERFORMAT_SPIRV,
|
|
/* stage */ SDL_GPU_SHADERSTAGE_FRAGMENT,
|
|
/* num_samplers */ 0,
|
|
/* num_storage_textures */ 0,
|
|
/* num_storage_buffers */ 0,
|
|
/* num_uniform_buffers */ 0,
|
|
},
|
|
};
|
|
|
|
const SDL_GPUShaderCreateInfo* GetVertexShaderCode(VertexShaderId id, SDL_GPUShaderFormat formats) {
|
|
#if defined(SDL_PLATFORM_WINDOWS)
|
|
if (formats & SDL_GPU_SHADERFORMAT_DXIL) {
|
|
SDL_assert(id < SDL_arraysize(VertexShaderDXILCodes));
|
|
return &VertexShaderDXILCodes[id];
|
|
}
|
|
#endif
|
|
#if defined(SDL_PLATFORM_APPLE)
|
|
if (formats & SDL_GPU_SHADERFORMAT_MSL) {
|
|
SDL_assert(id < SDL_arraysize(VertexShaderMSLCodes));
|
|
return &VertexShaderMSLCodes[id];
|
|
}
|
|
#endif
|
|
if (formats & SDL_GPU_SHADERFORMAT_SPIRV) {
|
|
SDL_assert(id < SDL_arraysize(VertexShaderSPIRVCodes));
|
|
return &VertexShaderSPIRVCodes[id];
|
|
}
|
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not find vertex shader code for id=%d and formats=0x%x", id, formats);
|
|
return nullptr;
|
|
}
|
|
|
|
const SDL_GPUShaderCreateInfo* GetFragmentShaderCode(FragmentShaderId id, SDL_GPUShaderFormat formats) {
|
|
#if defined(SDL_PLATFORM_WINDOWS)
|
|
if (formats & SDL_GPU_SHADERFORMAT_DXIL) {
|
|
SDL_assert(id < SDL_arraysize(FragmentShaderDXILCodes));
|
|
return &FragmentShaderDXILCodes[id];
|
|
}
|
|
#endif
|
|
#if defined(SDL_PLATFORM_APPLE)
|
|
if (formats & SDL_GPU_SHADERFORMAT_MSL) {
|
|
SDL_assert(id < SDL_arraysize(FragmentShaderMSLCodes));
|
|
return &FragmentShaderMSLCodes[id];
|
|
}
|
|
#endif
|
|
if (formats & SDL_GPU_SHADERFORMAT_SPIRV) {
|
|
SDL_assert(id < SDL_arraysize(FragmentShaderSPIRVCodes));
|
|
return &FragmentShaderSPIRVCodes[id];
|
|
}
|
|
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not find fragment shader code for id=%d and formats=0x%x", id, formats);
|
|
return nullptr;
|
|
}
|