-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allowing per pixel lighting to be turned on dynamically
Also cleaning up some redundant state binding
- Loading branch information
1 parent
36c1fb8
commit dbd10b8
Showing
5 changed files
with
83 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,8 +50,8 @@ You can contact Cyan Worlds, Inc. by email [email protected] | |
#include "plMetalDevice.h" | ||
#include "plSurface/plShaderTable.h" | ||
|
||
#ifndef PLASMA_PER_PIXEL_LIGHTING | ||
#define PLASMA_PER_PIXEL_LIGHTING 0 | ||
#ifndef PLASMA_FORCE_PER_PIXEL_LIGHTING | ||
#define PLASMA_FORCE_PER_PIXEL_LIGHTING 0 | ||
#endif | ||
|
||
enum plMetalPipelineType | ||
|
@@ -151,12 +151,13 @@ struct plMetalFragmentShaderDescription | |
uint32_t fBlendModes[8]; | ||
uint32_t fMiscFlags[8]; | ||
uint8_t fNumLayers; | ||
bool fUsePerPixelLighting; | ||
|
||
size_t hash; | ||
|
||
bool operator==(const plMetalFragmentShaderDescription& p) const | ||
{ | ||
bool match = fNumLayers == p.fNumLayers && memcmp(fPassTypes, p.fPassTypes, sizeof(fPassTypes)) == 0 && memcmp(fBlendModes, p.fBlendModes, sizeof(fBlendModes)) == 0 && memcmp(fMiscFlags, p.fMiscFlags, sizeof(fMiscFlags)) == 0; | ||
bool match = fNumLayers == p.fNumLayers && memcmp(fPassTypes, p.fPassTypes, sizeof(fPassTypes)) == 0 && memcmp(fBlendModes, p.fBlendModes, sizeof(fBlendModes)) == 0 && memcmp(fMiscFlags, p.fMiscFlags, sizeof(fMiscFlags)) == 0 && fUsePerPixelLighting == p.fUsePerPixelLighting; | ||
return match; | ||
} | ||
|
||
|
@@ -173,6 +174,8 @@ struct plMetalFragmentShaderDescription | |
|
||
std::size_t value = std::hash<uint8_t>()(fNumLayers); | ||
value ^= std::hash<uint8_t>()(fNumLayers); | ||
|
||
value ^= std::hash<bool>()(fUsePerPixelLighting); | ||
|
||
for (int i = 0; i < 8; i++) { | ||
value ^= std::hash<uint32_t>()(fBlendModes[i]); | ||
|