Skip to content

Commit

Permalink
d3d: Fix first_texture_number when compiled with sokol
Browse files Browse the repository at this point in the history
  • Loading branch information
IonAgorria committed Jun 12, 2024
1 parent 9aef5fe commit 7af6f7d
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions Source/Render/tilemap/TileMapRender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ void cTileMapRender::DrawBump(cCamera* DrawNode,eBlendMode MatMode,TILEMAP_DRAW

// if(pNormalCamera==DrawNode)
// gb_RenderDevice->SetRenderState(RS_WIREFRAME,1);
int first_texture_number = 0;
int first_texture_number = use_shadow_map ? 1 : 0;
#ifdef PERIMETER_D3D9
uint32_t tss_colorarg2 = 0;
uint32_t tss_alphaarg2 = 0;
Expand All @@ -591,11 +591,6 @@ void cTileMapRender::DrawBump(cCamera* DrawNode,eBlendMode MatMode,TILEMAP_DRAW
}
}
#endif
#ifdef PERIMETER_SOKOL
if (use_shadow_map) {
first_texture_number = 1;
}
#endif

#ifdef DEBUG_TILES
int st_VBSw = 0, st_Poly = 0;
Expand All @@ -610,13 +605,13 @@ void cTileMapRender::DrawBump(cCamera* DrawNode,eBlendMode MatMode,TILEMAP_DRAW
}

if (shadow) {
TextureImage zero_texture;
#ifdef PERIMETER_D3D9
TextureImage teximg(gb_RenderDevice3D->dtAdvance->GetTilemapShadow0());
gb_RenderDevice3D->SetTextureImage(0, &teximg);
#endif
#ifdef PERIMETER_SOKOL
gb_RenderDevice->SetTextureImage(0, nullptr);
if (gb_RenderDevice3D) {
zero_texture.d3d = gb_RenderDevice3D->dtAdvance->GetTilemapShadow0();
}
#endif
gb_RenderDevice->SetTextureImage(0, zero_texture.ptr ? &zero_texture : nullptr);
} else {
gb_RenderDevice->SetTextureImage(first_texture_number, curpool->GetTexture()->GetFrameImage(0));
}
Expand Down

0 comments on commit 7af6f7d

Please sign in to comment.