This commit is contained in:
Isuru Samarathunga
2025-10-16 22:59:33 +05:30
parent f742dcfaff
commit dfce12ee10
9 changed files with 89 additions and 31 deletions

View File

@ -51,7 +51,14 @@ namespace ia::iae
SDL_GPUColorTargetDescription colorTargetDesc = {
.format = Renderer::GetRenderTargetFormat(),
};
.blend_state = {.src_color_blendfactor = SDL_GPU_BLENDFACTOR_ONE,
.dst_color_blendfactor = SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
.color_blend_op = SDL_GPU_BLENDOP_ADD,
.src_alpha_blendfactor = SDL_GPU_BLENDFACTOR_ONE,
.dst_alpha_blendfactor = SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
.alpha_blend_op = SDL_GPU_BLENDOP_ADD,
.enable_blend = true,
.enable_color_write_mask = false}};
SDL_GPUVertexBufferDescription vertexBufferDesc = {
.slot = 0,
@ -85,16 +92,15 @@ namespace ia::iae
.front_face = SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE},
.depth_stencil_state = SDL_GPUDepthStencilState{.compare_op = SDL_GPU_COMPAREOP_GREATER_OR_EQUAL,
.write_mask = 0xFF,
.enable_depth_test = enableDepthTest,
.enable_depth_write = enableDepthTest,
.enable_depth_test = false,
.enable_depth_write = false,
.enable_stencil_test = false},
.target_info = {.color_target_descriptions = &colorTargetDesc,
.num_color_targets = 1,
.depth_stencil_format = SDL_GPU_TEXTUREFORMAT_D16_UNORM,
.has_depth_stencil_target = enableDepthTest},
.has_depth_stencil_target = false},
};
if(!(m_handle = SDL_CreateGPUGraphicsPipeline(Renderer::GetDevice(), &createInfo)))
if (!(m_handle = SDL_CreateGPUGraphicsPipeline(Renderer::GetDevice(), &createInfo)))
THROW_UNKNOWN("Failed to create a SDL graphics pipeline: ", SDL_GetError());
SDL_ReleaseGPUShader(Renderer::GetDevice(), pixelShader);