Histogram works
This commit is contained in:
parent
79047a133f
commit
4a80fa5e6b
27
imgui.ini
27
imgui.ini
@ -5,14 +5,14 @@ Collapsed=0
|
|||||||
DockId=0x00000003,0
|
DockId=0x00000003,0
|
||||||
|
|
||||||
[Window][Edit Image]
|
[Window][Edit Image]
|
||||||
Pos=3563,19
|
Pos=3308,19
|
||||||
Size=277,2072
|
Size=532,2072
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000002,0
|
DockId=0x00000002,0
|
||||||
|
|
||||||
[Window][Image View]
|
[Window][Image View]
|
||||||
Pos=503,19
|
Pos=503,19
|
||||||
Size=3058,2072
|
Size=2803,2072
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000004,0
|
DockId=0x00000004,0
|
||||||
|
|
||||||
@ -261,10 +261,25 @@ Pos=290,135
|
|||||||
Size=700,450
|
Size=700,450
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
|
|
||||||
|
[Window][Open Image File##filebrowser_99169579131200]
|
||||||
|
Pos=290,135
|
||||||
|
Size=700,450
|
||||||
|
Collapsed=0
|
||||||
|
|
||||||
|
[Window][Open Image File##filebrowser_101923340128576]
|
||||||
|
Pos=290,135
|
||||||
|
Size=700,450
|
||||||
|
Collapsed=0
|
||||||
|
|
||||||
|
[Window][Open Image File##filebrowser_106637927567680]
|
||||||
|
Pos=290,135
|
||||||
|
Size=700,450
|
||||||
|
Collapsed=0
|
||||||
|
|
||||||
[Docking][Data]
|
[Docking][Data]
|
||||||
DockSpace ID=0xE098E157 Window=0x9E772337 Pos=0,19 Size=3840,2072 Split=X
|
DockSpace ID=0xE098E157 Window=0x9E772337 Pos=0,19 Size=3840,2072 Split=X
|
||||||
DockNode ID=0x00000001 Parent=0xE098E157 SizeRef=1641,720 Split=X
|
DockNode ID=0x00000001 Parent=0xE098E157 SizeRef=3306,720 Split=X
|
||||||
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=501,720 Selected=0x5593B2D4
|
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=501,720 Selected=0x5593B2D4
|
||||||
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=3058,720 CentralNode=1 Selected=0x9B39CB70
|
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=2803,720 CentralNode=1 Selected=0x9B39CB70
|
||||||
DockNode ID=0x00000002 Parent=0xE098E157 SizeRef=277,720 Selected=0x610DAB84
|
DockNode ID=0x00000002 Parent=0xE098E157 SizeRef=532,720 Selected=0x610DAB84
|
||||||
|
|
||||||
|
9
main.cpp
9
main.cpp
@ -1100,7 +1100,7 @@ void ComputeHistogramGPU(GLuint inputTextureID, int width, int height) {
|
|||||||
// Bind input texture as image unit 0 (read-only)
|
// Bind input texture as image unit 0 (read-only)
|
||||||
// IMPORTANT: Ensure the format matches the compute shader layout qualifier (e.g., rgba8)
|
// IMPORTANT: Ensure the format matches the compute shader layout qualifier (e.g., rgba8)
|
||||||
// If textureToDisplay is RGBA16F, you'd use layout(rgba16f) in shader
|
// If textureToDisplay is RGBA16F, you'd use layout(rgba16f) in shader
|
||||||
glBindImageTexture(0, inputTextureID, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8); // Assuming display texture is RGBA8
|
glBindImageTexture(0, inputTextureID, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA16); // Assuming display texture is RGBA8
|
||||||
|
|
||||||
// Bind SSBO to binding point 1
|
// Bind SSBO to binding point 1
|
||||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, g_histogramSSBO);
|
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, g_histogramSSBO);
|
||||||
@ -1120,7 +1120,7 @@ void ComputeHistogramGPU(GLuint inputTextureID, int width, int height) {
|
|||||||
|
|
||||||
// Unbind resources (optional here, but good practice)
|
// Unbind resources (optional here, but good practice)
|
||||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, 0);
|
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, 0);
|
||||||
glBindImageTexture(0, 0, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA8);
|
glBindImageTexture(0, 0, 0, GL_FALSE, 0, GL_READ_ONLY, GL_RGBA16);
|
||||||
glUseProgram(0);
|
glUseProgram(0);
|
||||||
|
|
||||||
// 4. Read histogram data back from SSBO to CPU vector
|
// 4. Read histogram data back from SSBO to CPU vector
|
||||||
@ -1740,7 +1740,7 @@ int main(int, char **)
|
|||||||
GLuint displayTexId = textureToDisplay; // Use the display texture ID
|
GLuint displayTexId = textureToDisplay; // Use the display texture ID
|
||||||
if (displayTexId != 0)
|
if (displayTexId != 0)
|
||||||
{
|
{
|
||||||
ComputeHistogramGPU(displayTexId, g_loadedImage.getWidth(), g_loadedImage.getHeight());
|
ComputeHistogramGPU(textureToDisplay, g_loadedImage.getWidth(), g_loadedImage.getHeight());
|
||||||
// Assume ImGuiTexInspect fills available space. This might need adjustment.
|
// Assume ImGuiTexInspect fills available space. This might need adjustment.
|
||||||
ImVec2 displaySize = availableContentSize;
|
ImVec2 displaySize = availableContentSize;
|
||||||
float displayAspect = displaySize.x / displaySize.y;
|
float displayAspect = displaySize.x / displaySize.y;
|
||||||
@ -1942,7 +1942,6 @@ int main(int, char **)
|
|||||||
ImGui::Begin("Image Exif");
|
ImGui::Begin("Image Exif");
|
||||||
if (g_imageIsLoaded)
|
if (g_imageIsLoaded)
|
||||||
{
|
{
|
||||||
ComputeHistogramGPU(textureToDisplay, g_loadedImage.getWidth(), g_loadedImage.getHeight());
|
|
||||||
ImGui::Text("Image Width: %d", g_loadedImage.m_width);
|
ImGui::Text("Image Width: %d", g_loadedImage.m_width);
|
||||||
ImGui::Text("Image Height: %d", g_loadedImage.m_height);
|
ImGui::Text("Image Height: %d", g_loadedImage.m_height);
|
||||||
ImGui::Text("Image Loaded: %s", g_imageIsLoaded ? "Yes" : "No");
|
ImGui::Text("Image Loaded: %s", g_imageIsLoaded ? "Yes" : "No");
|
||||||
@ -1963,7 +1962,7 @@ int main(int, char **)
|
|||||||
ImGui::Begin("Edit Image");
|
ImGui::Begin("Edit Image");
|
||||||
|
|
||||||
if (ImGui::CollapsingHeader("Histogram", ImGuiTreeNodeFlags_DefaultOpen)) {
|
if (ImGui::CollapsingHeader("Histogram", ImGuiTreeNodeFlags_DefaultOpen)) {
|
||||||
DrawHistogramWidget("ExifHistogram", ImVec2(-1, 100));
|
DrawHistogramWidget("ExifHistogram", ImVec2(-1, 256));
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Edit Image (Right) ---
|
// --- Edit Image (Right) ---
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// Input Texture (the processed image ready for display)
|
// Input Texture (the processed image ready for display)
|
||||||
// Binding = 0 matches glBindImageTexture unit
|
// Binding = 0 matches glBindImageTexture unit
|
||||||
// Use rgba8 format as we assume display texture is 8-bit sRGB (adjust if needed)
|
// Use rgba8 format as we assume display texture is 8-bit sRGB (adjust if needed)
|
||||||
layout(binding = 0, rgba8) uniform readonly image2D InputTexture;
|
layout(binding = 0, rgba16f) uniform readonly image2D InputTexture;
|
||||||
|
|
||||||
// Output Histogram Buffer (SSBO)
|
// Output Histogram Buffer (SSBO)
|
||||||
// Binding = 1 matches glBindBufferBase index
|
// Binding = 1 matches glBindBufferBase index
|
||||||
|
Loading…
x
Reference in New Issue
Block a user